/* =============================================
   補助金申請ナビゲーター CSS
   ============================================= */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --accent: #0891b2;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --success: #059669;
    --success-light: #d1fae5;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --error: #dc2626;
    --error-light: #fee2e2;
    --radius: 0.75rem;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ---- Navbar ---- */
.nav-bar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.875rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.nav-logo {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--primary);
    text-decoration: none;
}

.nav-back {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9375rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    transition: background 0.15s;
}

.nav-back:hover {
    background: var(--border-light);
    color: var(--text);
}

/* ---- Layout ---- */
.layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ---- Sidebar ---- */
.sidebar {
    width: 280px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1.25rem;
}

.steps {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.step {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem;
    border-radius: var(--radius);
    transition: background 0.15s;
}

.step-num {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: var(--border-light);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: all 0.2s;
}

.step.active {
    background: var(--primary-light);
}

.step.active .step-num {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.step.active .step-label {
    color: var(--primary-dark);
    font-weight: 700;
}

.step.completed .step-num {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}

.step.completed .step-num::after {
    content: '✓';
    font-size: 0.875rem;
}

.step-info {
    flex: 1;
    min-width: 0;
}

.step-label {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}

.step-sub {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.3;
    margin-top: 0.125rem;
}

/* ---- Main ---- */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ---- Progress bar ---- */
.progress-bar {
    height: 4px;
    background: var(--border-light);
    flex-shrink: 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}

/* ---- Step header ---- */
.step-header {
    padding: 1.5rem 2rem 0;
    flex-shrink: 0;
}

.step-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.375rem;
}

.step-desc {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ---- Form area ---- */
.form-area {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

/* Scrollbar */
.form-area::-webkit-scrollbar { width: 6px; }
.form-area::-webkit-scrollbar-track { background: transparent; }
.form-area::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.form-area { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }

/* ---- Form group (each question) ---- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.form-label .required {
    color: var(--error);
    font-size: 0.875rem;
}

.form-hint {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ---- Text input / textarea / select ---- */
.input-text,
.input-textarea,
.input-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.15s, box-shadow 0.15s;
    line-height: 1.6;
}

.input-text:focus,
.input-textarea:focus,
.input-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.input-text::placeholder,
.input-textarea::placeholder {
    color: #94a3b8;
}

.input-textarea {
    resize: vertical;
    min-height: 120px;
}

.input-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}

/* ---- Radio / Checkbox cards ---- */
.option-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option-grid.cols-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.option-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    background: var(--surface);
}

.option-card:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.03);
}

.option-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 1px var(--primary);
}

.option-card input[type="radio"],
.option-card input[type="checkbox"] {
    margin-top: 0.125rem;
    flex-shrink: 0;
    accent-color: var(--primary);
    width: 1.125rem;
    height: 1.125rem;
    cursor: pointer;
}

.option-card-content {
    flex: 1;
}

.option-card-label {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    line-height: 1.4;
}

.option-card-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    line-height: 1.4;
}

/* ---- Subsidy card (Step 1 special) ---- */
.subsidy-grid {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.subsidy-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.125rem 1.25rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    background: var(--surface);
}

.subsidy-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.subsidy-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 1px var(--primary);
}

.subsidy-card input[type="radio"] {
    margin-top: 0.25rem;
    flex-shrink: 0;
    accent-color: var(--primary);
    width: 1.25rem;
    height: 1.25rem;
}

.subsidy-card-body {
    flex: 1;
}

.subsidy-card-name {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.subsidy-card-desc {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.subsidy-card-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.subsidy-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--primary);
    background: rgba(37, 99, 235, 0.08);
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
}

/* ---- Action bar ---- */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.step-indicator {
    font-size: 0.9375rem;
    color: var(--text-muted);
    font-weight: 500;
}

.btn-group {
    display: flex;
    gap: 0.75rem;
}

.btn {
    padding: 0.6875rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-next {
    background: var(--primary);
    color: #fff;
}

.btn-next:hover:not(:disabled) {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
}

.btn-back {
    background: var(--border-light);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-back:hover:not(:disabled) {
    background: var(--border);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-download {
    background: var(--success);
    color: #fff;
}

.btn-download:hover { background: #047857; }

.btn-print {
    background: var(--text-muted);
    color: #fff;
}

.btn-print:hover { background: #475569; }

/* ---- Preview (Step 5) ---- */
.preview-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.preview-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: var(--success-light);
    color: var(--success);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.preview-section {
    margin-bottom: 1.75rem;
}

.preview-section-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 1rem;
    padding-bottom: 0.625rem;
    border-bottom: 2px solid var(--primary-light);
}

.preview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.preview-field {
    background: var(--border-light);
    padding: 1rem;
    border-radius: var(--radius);
}

.preview-field.full {
    grid-column: 1 / -1;
}

.preview-field-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.375rem;
}

.preview-field-value {
    font-size: 1rem;
    color: var(--text);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Info box */
.info-box {
    padding: 1.25rem;
    border-radius: var(--radius);
    margin-top: 1.5rem;
}

.info-box.notice {
    background: var(--primary-light);
    border: 1px solid rgba(37, 99, 235, 0.2);
}

.info-box.warning {
    background: var(--warning-light);
    border: 1px solid rgba(217, 119, 6, 0.2);
}

.info-box-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.625rem;
}

.info-box.notice .info-box-title { color: var(--primary-dark); }
.info-box.warning .info-box-title { color: var(--warning); }

.info-box p, .info-box li {
    font-size: 0.9375rem;
    line-height: 1.7;
}

.info-box.notice p, .info-box.notice li { color: #1e40af; }
.info-box.warning p, .info-box.warning li { color: #92400e; }

.info-box ol, .info-box ul {
    margin-left: 1.25rem;
}

/* ---- Validation error ---- */
.form-group.has-error .input-text,
.form-group.has-error .input-textarea,
.form-group.has-error .input-select {
    border-color: var(--error);
}

.form-error-msg {
    font-size: 0.875rem;
    color: var(--error);
    font-weight: 500;
}

/* ---- Mobile ---- */
@media (max-width: 768px) {
    .layout { flex-direction: column; }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 1rem;
        overflow-x: auto;
    }

    .steps {
        flex-direction: row;
        gap: 0.5rem;
    }

    .step {
        min-width: fit-content;
        padding: 0.5rem 0.75rem;
    }

    .step-sub { display: none; }

    .step-header { padding: 1rem 1.25rem 0; }
    .form-area { padding: 1rem 1.25rem 1.5rem; }
    .action-bar { padding: 0.75rem 1.25rem; }

    .option-grid.cols-2 { grid-template-columns: 1fr; }
    .preview-grid { grid-template-columns: 1fr; }

    .nav-bar { padding: 0.75rem 1rem; }
}

/* ---- Print ---- */
@media print {
    .nav-bar, .sidebar, .action-bar, .step-header { display: none; }
    .main { overflow: visible; }
    .form-area { overflow: visible; padding: 0; }
    .preview-wrap { box-shadow: none; border: none; }
}

/* ---- Animations ---- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.form-group { animation: fadeIn 0.25s ease-out; }

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
