/* PDF Analyzer Pro - Frontend Styles */

.pdf-tool-wrapper {
    width: 100%;
    padding: 5px;
    box-sizing: border-box !important;
}

.tool-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    width: 100% !important;
    max-width: 1000px;
    margin: 20px auto;
    padding: 25px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    box-sizing: border-box !important;
}

.tool-container h3 {
    text-align: left;
    margin: 0 0 15px 0;
    font-size: 1.5em;
    font-weight: bold;
    color: #333;
}

.instruction-box {
    display: block;
    font-size: 1em;
    font-weight: bold;
    color: #0055aa;
    text-align: center;
    margin-bottom: 20px;
    line-height: 1.6;
    background: #f0f7ff;
    padding: 15px;
    border-radius: 8px;
    border: 1px dashed #0055aa;
}

/* ステップセクション */
.step-section {
    margin-bottom: 30px;
}

.step-header {
    font-size: 1.2em;
    font-weight: bold;
    color: #004488;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #004488;
}

/* 設定グリッド */
.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    background: #f4f4f4;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    align-items: end; /* 全セルを下揃えにして高さを統一 */
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    display: block;
    font-weight: bold;
    font-size: 0.85em;
    margin-bottom: 5px;
    color: #555;
}

/* input と select を完全に同じ見た目・高さに統一 */
.input-group input,
.input-group select {
    width: 100%;
    height: 48px;           /* 固定高さで揃える */
    padding: 0 12px;        /* 上下paddingをゼロにしてheightで管理 */
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box;
    transition: border-color 0.3s;
    background-color: #fff;
    appearance: auto;       /* select のネイティブ矢印を維持 */
    -webkit-appearance: auto;
    line-height: 1;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #004488;
}

/* ボタン */
.btn-submit {
    display: block;
    width: 100%;
    padding: 18px;
    background: #004488;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1.2em;
    transition: background 0.3s;
}

.btn-submit:hover {
    background: #002d5a;
}

.btn-secondary {
    display: inline-block;
    padding: 12px 24px;
    background: #777;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.3s;
    margin-right: 10px;
    margin-top: 10px;
}

.btn-secondary:hover {
    background: #555;
}

.btn-select-file {
    padding: 12px 30px;
    background: #004488;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.3s;
}

.btn-select-file:hover {
    background: #002d5a;
}

/* アップロードエリア */
.upload-area {
    margin-top: 20px;
}

.drop-zone {
    border: 3px dashed #0055aa;
    border-radius: 8px;
    padding: 60px 40px;
    text-align: center;
    background-color: #f0f7ff;
    transition: all 0.3s ease;
    cursor: default;         /* 通常時はデフォルトカーソル */
    user-select: none;
}

.drop-zone:hover {
    background-color: #e0edff;
    border-color: #003d7a;
}

/* ドラッグ中はコピーカーソルで「ここに置ける」を明示 */
.drop-zone.dragover {
    background-color: #d0e4ff;
    border-color: #002d5a;
    border-style: solid;
    transform: scale(1.01);
    cursor: copy;            /* ドロップ可能を示すコピーカーソル */
}

.drop-zone-content {
    pointer-events: none;    /* 子要素へのdrag系イベントを親に通す */
}

/* ボタンだけはclickを受け付けるため明示的に戻す */
.drop-zone-content .btn-select-file {
    pointer-events: auto;
}

.upload-icon {
    font-size: 64px;
    display: block;
    margin-bottom: 15px;
}

.drop-zone-content p {
    font-size: 16px;
    color: #0055aa;
    margin: 10px 0;
    font-weight: 600;
}

.file-info {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 25px;
    margin-top: 20px;
}

.file-info p {
    font-size: 15px;
    margin-bottom: 12px;
    color: #333;
}

.file-info strong {
    display: inline-block;
    min-width: 140px;
    color: #555;
}

/* ローディング */
.loading {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #004488;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    font-size: 16px;
    color: #555;
    font-weight: 600;
}

/* 結果セクション */
.results {
    margin-top: 30px;
}

.result-section {
    margin-bottom: 30px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
}

.result-section h4 {
    font-size: 1.3em;
    color: #004488;
    margin: 0 0 15px 0;
    font-weight: bold;
}

/* 総合判定 */
.overall-status {
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 25px;
    text-align: center;
    font-size: 1.3em;
    font-weight: bold;
}

.overall-status.status-pass {
    background: #d4edda;
    border: 2px solid #28a745;
    color: #155724;
}

.overall-status.status-warning {
    background: #fff3cd;
    border: 2px solid #ffc107;
    color: #856404;
}

.overall-status.status-error {
    background: #f8d7da;
    border: 2px solid #dc3545;
    color: #721c24;
}

/* 仕様照合テーブル */
.spec-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.spec-table th,
.spec-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.spec-table th {
    background: #f4f4f4;
    font-weight: bold;
    color: #555;
    font-size: 0.9em;
}

.spec-table td {
    font-size: 0.95em;
}

.spec-match {
    color: #28a745;
    font-weight: bold;
}

.spec-mismatch {
    color: #dc3545;
    font-weight: bold;
}

.spec-icon {
    font-size: 1.2em;
    margin-right: 5px;
}

/* サムネイルグリッド */
.thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.thumbnail-item {
    border: 3px solid #dc3545;
    border-radius: 8px;
    padding: 10px;
    background: #fff;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.thumbnail-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.thumbnail-canvas {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

.thumbnail-label {
    margin-top: 8px;
    font-size: 0.9em;
    font-weight: bold;
    color: #dc3545;
    text-align: center;
}

.thumbnail-warnings {
    margin-top: 5px;
    font-size: 0.8em;
    color: #555;
    text-align: left;
}

.thumbnail-warnings ul {
    margin: 5px 0 0 0;
    padding-left: 20px;
}

.thumbnail-warnings li {
    margin-bottom: 3px;
}

/* 詳細グリッド */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
}

.detail-card {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
}

.detail-card h5 {
    font-size: 1em;
    color: #004488;
    margin: 0 0 12px 0;
    font-weight: bold;
    border-bottom: 1px solid #ccc;
    padding-bottom: 8px;
}

.detail-list {
    font-size: 0.9em;
    color: #333;
}

.detail-list ul {
    margin: 0;
    padding-left: 20px;
}

.detail-list li {
    margin-bottom: 5px;
}

.status-badge {
    display: inline-block;
    padding: 3px 8px;
    margin-left: 6px;
    border-radius: 10px;
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
}

.status-badge.badge-success {
    background: #d4edda;
    color: #155724;
}

.status-badge.badge-error {
    background: #f8d7da;
    color: #721c24;
}

.status-badge.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.status-badge.badge-warning {
    background: #fff3cd;
    color: #856404;
}

/* カラースウォッチ */
.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
}

.color-item {
    text-align: center;
}

.color-swatch {
    width: 100%;
    height: 40px;
    border-radius: 4px;
    border: 1px solid #ccc;
    margin-bottom: 5px;
}

.color-code {
    font-size: 0.75em;
    color: #555;
    font-family: monospace;
}

/* 改善提案 */
.improvements-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.improvement-item {
    background: #fff;
    border-left: 4px solid #777;
    border-radius: 4px;
    padding: 15px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.improvement-item.item-success {
    border-left-color: #28a745;
    background: #f0fff4;
}

.improvement-item.item-error {
    border-left-color: #dc3545;
    background: #fff5f5;
}

.improvement-item.item-warning {
    border-left-color: #ffc107;
    background: #fffbf0;
}

.improvement-item.item-info {
    border-left-color: #17a2b8;
    background: #f0f9ff;
}

.improvement-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.improvement-icon {
    font-size: 1.3em;
}

.improvement-header strong {
    font-size: 1.05em;
    color: #333;
}

.improvement-item p {
    margin: 0;
    font-size: 0.95em;
    color: #555;
    line-height: 1.5;
}

/* アクションボタン */
.action-buttons {
    margin-top: 30px;
    text-align: center;
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    background-color: #fff;
    margin: 3% auto;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 900px;
    position: relative;
}

.modal-close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 32px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #000;
}

#modal-canvas {
    width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#modal-info {
    margin-top: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 4px;
}

#modal-info h4 {
    margin-top: 0;
    color: #004488;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .tool-container {
        padding: 15px;
    }
    
    .config-grid {
        grid-template-columns: 1fr;
    }
    
    .thumbnail-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .details-grid {
        grid-template-columns: 1fr;
    }
    
    .drop-zone {
        padding: 40px 20px;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
    }
}
