/* app.css */
:root { --primary:#7c3aed; --primary-color:var(--primary); }

/* レイアウト */
.container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.row {
    display: flex;
    gap: 16px;
}

.row > * {
    flex: 1;
}

#editor-pane {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#preview-pane {
    display: none; /* スマホでは初期非表示 */
    flex-direction: column;
    gap: 16px;
}

.kpi-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

#form-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
#form-container h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}
#form-container input, #form-container textarea, #form-container select {
    width: 100%;
}
#settings-card, #guide-card {
    background-color: var(--bg-color-offset);
    padding: 16px;
    border-radius: 8px;
}
.skills-textarea {
    white-space: pre-wrap;
}

/* プレビュー */
.a4-preview {
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    overflow-y: auto;
    padding: 20mm; /* A4余白の目安 */
    font-size: 10.5pt; /* 標準的な文字サイズ */
    color: #000;
    aspect-ratio: 210 / 297; /* A4比率 */
    max-height: calc(100vh - 150px);
}
#resume-content {
    line-height: 1.6;
}
#resume-content h1 { font-size: 18pt; margin-bottom: 4mm; text-align: center; }
#resume-content .resume-date-name { text-align: right; }
#resume-content h2 { font-size: 14pt; border-bottom: 2px solid #333; padding-bottom: 2mm; margin-top: 8mm; margin-bottom: 4mm;}
#resume-content h3 { font-size: 12pt; border-left: 4px solid #333; padding-left: 3mm; margin-top: 6mm; margin-bottom: 3mm;}
#resume-content table { width: 100%; border-collapse: collapse; margin-top: 3mm; }
#resume-content th, #resume-content td { border: 1px solid #ccc; padding: 2mm; vertical-align: top; }
#resume-content th { background-color: #f2f2f2; width: 25%; text-align: left; }
#resume-content ul { padding-left: 20px; margin: 0; }

/* テンプレート: standard */
.template-standard #resume-content h2 { border-bottom: 2px solid #333; }
.template-standard #resume-content h3 { border-left: 4px solid #333; }

/* テンプレート: simple */
.template-simple #resume-content th, .template-simple #resume-content td { border: none; }
.template-simple #resume-content table { border-top: 1px solid #ccc; border-bottom: 1px solid #ccc; }
.template-simple #resume-content h2 { border-bottom: 1px solid #ccc; }
.template-simple #resume-content h3 { border-left: none; font-weight: bold; }

/* テンプレート: modern (Pro) */
.template-modern #resume-content h2 { 
    border-bottom: none; 
    color: var(--accent-color, #2a9d8f);
    padding-bottom: 0;
}
.template-modern #resume-content h3 {
    border-left: none;
    border-bottom: 2px solid var(--accent-color, #2a9d8f);
    padding-left: 0;
    color: var(--accent-color, #2a9d8f);
}
.template-modern #resume-content th {
    background-color: var(--accent-color-light, #eaf6f5);
}
.template-modern #resume-content th, .template-modern #resume-content td {
     border: 1px solid #eee;
}

/* 文字サイズ */
.font-sm .a4-preview { font-size: 9pt; }
.font-md .a4-preview { font-size: 10.5pt; }
.font-lg .a4-preview { font-size: 12pt; }

/* 余白 */
.margin-sm .a4-preview { padding: 15mm; }
.margin-md .a4-preview { padding: 20mm; }
.margin-lg .a4-preview { padding: 25mm; }

/* 動的要素 */
.work-history-item, .license-item {
    border: 1px dashed #ccc;
    padding: 12px;
    margin-bottom: 16px;
    border-radius: 4px;
    background-color: var(--bg-color);
}
.work-history-item .btn-row, .license-item .btn-row {
    justify-content: flex-end;
}

.hidden {
    display: none !important;
}

#accent-color-picker {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
#accent-color-picker input {
    width: 60px;
    height: 30px;
}

/* モバイル対応 */
@media (max-width: 768px) {
    .row {
        flex-direction: column;
    }
    #preview-pane.active {
        display: flex;
    }
    #editor-pane.hidden-mobile {
        display: none;
    }
    #switch-to-editor-btn {
        display: inline-block;
    }
    #switch-to-preview-btn {
        display: inline-block;
    }
    .a4-preview {
        max-height: none;
        height: auto;
    }
}

@media (min-width: 769px) {
    .container {
        flex-direction: row;
        align-items: flex-start;
    }
    #editor-pane {
        width: 45%;
        max-width: 600px;
    }
    #preview-pane {
        width: 55%;
        display: flex; /* PCでは常に表示 */
        position: sticky;
        top: 16px;
    }
    #switch-to-editor-btn, #switch-to-preview-btn {
        display: none; /* PCでは切り替えボタン不要 */
    }
}

/* 印刷用スタイル */
@media print {
    body {
        background-color: #fff;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .app-header, .app-footer, #editor-pane, #preview-pane .btn-row, .no-print {
        display: none !important;
    }
    .container {
        display: block;
    }
    #preview-pane {
        display: block;
        width: 100%;
        position: static;
        box-shadow: none;
        border: none;
        padding: 0;
        margin: 0;
    }
    .a4-preview {
        padding: 0;
        margin: 0;
        border: none;
        box-shadow: none;
        max-height: none;
        height: auto;
        overflow: visible;
        aspect-ratio: auto;
        font-size: 10.5pt; /* 印刷時の文字サイズを固定 */
    }
    /* ページ区切り */
    #resume-content {
        page-break-before: auto;
        page-break-after: auto;
    }
    h2, h3 {
        page-break-after: avoid;
    }
    table {
        page-break-inside: avoid;
    }
}
