/* ===== Financial Statement ===== */
.financial-statement {
    padding: 12px;
}

.fs-section {
    margin-bottom: 12px;
}

.fs-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 4px;
    cursor: pointer;
    user-select: none;
}

.fs-section-header.income-header {
    background: #dcfce7;
    color: #166534;
}

.fs-section-header.expense-header {
    background: #fee2e2;
    color: #991b1b;
}

.fs-section-header.asset-header {
    background: #dbeafe;
    color: #1e40af;
}

.fs-section-header.liability-header {
    background: #f3e8ff;
    color: #6b21a8;
}

.fs-section-total {
    font-weight: 700;
    font-size: 0.9rem;
}

.fs-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 10px;
    font-size: 0.8rem;
    border-bottom: 1px solid #f1f5f9;
}

.fs-row:last-child {
    border-bottom: none;
}

.fs-row-label {
    color: var(--color-text-light);
}

.fs-row-value {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.fs-row-value.positive {
    color: var(--color-income);
}

.fs-row-value.negative {
    color: var(--color-expense);
}

.fs-divider {
    height: 1px;
    background: var(--color-border);
    margin: 8px 0;
}

.fs-summary {
    background: #f8fafc;
    border-radius: var(--radius);
    padding: 10px;
    margin-top: 8px;
}

.fs-summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    padding: 2px 0;
}

.fs-summary-row.highlight {
    font-weight: 700;
    font-size: 0.95rem;
    margin-top: 4px;
    padding-top: 6px;
    border-top: 2px solid var(--color-border);
}

.fs-summary-row.highlight .fs-row-value.positive {
    color: var(--color-income);
    font-size: 1.05rem;
}

.fs-summary-row.highlight .fs-row-value.negative {
    color: var(--color-expense);
    font-size: 1.05rem;
}

/* Asset detail items */
.fs-asset-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 10px;
    font-size: 0.75rem;
    background: #f8fafc;
    border-radius: 4px;
    margin-bottom: 2px;
}

.fs-asset-name {
    flex: 1;
    font-weight: 500;
}

.fs-asset-detail {
    color: var(--color-text-light);
    margin-left: 8px;
}

/* ===== Profession Cards ===== */
.profession-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 4px;
}

.profession-card {
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    padding: 14px 10px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
}

.profession-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.profession-card .prof-icon {
    font-size: 2rem;
    margin-bottom: 6px;
}

.profession-card .prof-name {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.profession-card .prof-salary {
    font-size: 0.8rem;
    color: var(--color-income);
}

/* Profession Detail */
.profession-detail-content {
    line-height: 1.8;
}

.prof-detail-section {
    margin-bottom: 12px;
}

.prof-detail-section h4 {
    font-size: 0.9rem;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--color-border);
}

.prof-detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    padding: 2px 0;
}

/* ===== Card Display ===== */
.card-display {
    text-align: center;
}

.card-type {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.card-type.type-opportunity {
    background: #dbeafe;
    color: #1e40af;
}

.card-type.type-market {
    background: #fef3c7;
    color: #92400e;
}

.card-type.type-doodad {
    background: #fee2e2;
    color: #991b1b;
}

.card-type.type-baby {
    background: #fce7f3;
    color: #9d174d;
}

.card-type.type-downsized {
    background: #fde68a;
    color: #92400e;
}

.card-type.type-charity {
    background: #e0e7ff;
    color: #3730a3;
}

.card-type.type-fast-track {
    background: #f3e8ff;
    color: #6b21a8;
}

.card-title {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.card-body {
    font-size: 0.9rem;
    color: var(--color-text-light);
    margin-bottom: 12px;
    line-height: 1.6;
}

.card-details {
    background: #f8fafc;
    border-radius: var(--radius);
    padding: 10px;
    text-align: left;
    font-size: 0.85rem;
}

.card-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
}

.card-detail-label {
    color: var(--color-text-light);
}

.card-detail-value {
    font-weight: 600;
}

/* ===== Deal Analysis ===== */
.deal-info {
    margin-bottom: 16px;
}

.deal-analysis {
    background: #f8fafc;
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 12px;
}

.deal-analysis h4 {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: var(--color-primary);
}

.deal-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    padding: 3px 0;
}

.deal-highlight {
    font-weight: 700;
    padding-top: 6px;
    margin-top: 4px;
    border-top: 1px solid var(--color-border);
}

.deal-warning {
    color: var(--color-danger);
    font-size: 0.85rem;
    margin-top: 8px;
    padding: 8px;
    background: #fff1f2;
    border-radius: var(--radius);
}

/* ===== Asset Management ===== */
.asset-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
}

.asset-tabs .tab-btn {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
}

.asset-tabs .tab-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    border-bottom: none;
}

.asset-content {
    max-height: 50vh;
    overflow-y: auto;
}

.asset-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 6px;
}

.asset-item-info {
    flex: 1;
}

.asset-item-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.asset-item-detail {
    font-size: 0.8rem;
    color: var(--color-text-light);
}

.asset-item-actions {
    display: flex;
    gap: 6px;
}

/* ===== Dream Grid ===== */
.dream-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    max-height: 60vh;
    overflow-y: auto;
}

.dream-card {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 2px solid #f59e0b;
    border-radius: var(--radius-lg);
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
}

.dream-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.dream-card .dream-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.dream-card .dream-name {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 4px;
}

.dream-card .dream-desc {
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin-bottom: 6px;
}

.dream-card .dream-cost {
    font-weight: 700;
    color: var(--color-danger);
}

/* ===== Notifications ===== */
.notification {
    position: fixed;
    top: 60px;
    right: 16px;
    padding: 12px 20px;
    border-radius: var(--radius);
    color: white;
    font-size: 0.9rem;
    z-index: 200;
    animation: notifIn 0.3s ease, notifOut 0.3s ease 2.7s forwards;
    max-width: 300px;
    box-shadow: var(--shadow-lg);
}

.notification.success { background: var(--color-success); }
.notification.error { background: var(--color-danger); }
.notification.warning { background: var(--color-warning); }
.notification.info { background: var(--color-info); }

@keyframes notifIn {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes notifOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(-20px); }
}

/* ===== Stock Quantity Input ===== */
.quantity-input {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    margin: 12px 0;
}

.quantity-input label {
    font-size: 0.9rem;
}

.quantity-input input {
    width: 80px;
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    text-align: center;
    font-family: inherit;
}

.quantity-input .cost-preview {
    font-size: 0.85rem;
    color: var(--color-text-light);
}

/* ===== Escape Progress Bar ===== */
.escape-progress-container {
    position: relative;
    height: 14px;
    background: #e2e8f0;
    border-radius: 7px;
    overflow: hidden;
}

.escape-progress-bar {
    height: 100%;
    border-radius: 7px;
    transition: width 0.5s ease, background 0.5s ease;
    min-width: 2px;
}

.escape-progress-label {
    position: absolute;
    right: 6px;
    top: 0;
    line-height: 14px;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--color-text);
}

/* ===== Deal Before/After Comparison ===== */
.deal-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 10px 0;
    font-size: 0.85rem;
}

.deal-comparison-col {
    padding: 8px;
    border-radius: var(--radius);
    text-align: center;
}

.deal-comparison-col.before {
    background: #f1f5f9;
}

.deal-comparison-col.after {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.deal-comparison-label {
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--color-text-light);
    margin-bottom: 4px;
}

.deal-comparison-value {
    font-weight: 700;
    font-size: 1rem;
}

.deal-comparison-detail {
    font-size: 0.75rem;
    color: var(--color-text-light);
    margin-top: 2px;
}

/* ===== Player Header in Financial Statement ===== */
.fs-player-header {
    font-size: 0.9rem;
    padding: 4px 0;
}

/* ===== Challenge Cards ===== */
.challenge-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 12px 0;
}

.challenge-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition);
    background: var(--color-surface);
}

.challenge-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.challenge-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.challenge-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.challenge-name {
    font-weight: 700;
    font-size: 1rem;
}

.challenge-desc {
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin-top: 2px;
}

/* ===== Card Flip Animation ===== */
@keyframes cardFlipIn {
    0% { transform: perspective(600px) rotateY(90deg); opacity: 0; }
    100% { transform: perspective(600px) rotateY(0deg); opacity: 1; }
}

.card-display.card-flip {
    animation: cardFlipIn 0.4s ease-out;
}

/* ===== Payday Animation ===== */
@keyframes paydayGlow {
    0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.4); }
    50% { box-shadow: 0 0 20px 10px rgba(22, 163, 74, 0.2); }
    100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

.payday-glow {
    animation: paydayGlow 0.8s ease;
}

/* ===== Save Slot Cards ===== */
.save-slot-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 12px 0;
}

.save-slot-card {
    padding: 14px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    background: var(--color-surface);
}

.save-slot-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.save-slot-card.save-slot-empty {
    border-style: dashed;
}

.save-slot-header {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.save-slot-info {
    font-size: 0.8rem;
    color: var(--color-text-light);
}

/* ===== Achievement Styles ===== */
.achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin: 12px 0;
}

.achievement-card {
    padding: 12px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    text-align: center;
    transition: all var(--transition);
    opacity: 0.4;
}

.achievement-card.unlocked {
    opacity: 1;
    border-color: #f59e0b;
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
}

[data-theme="dark"] .achievement-card.unlocked {
    background: linear-gradient(135deg, #422006, #78350f);
    border-color: #f59e0b;
}

.achievement-card .ach-icon {
    font-size: 2rem;
    margin-bottom: 4px;
}

.achievement-card .ach-name {
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 2px;
}

.achievement-card .ach-desc {
    font-size: 0.7rem;
    color: var(--color-text-light);
}

/* ===== Achievement Unlock Notification ===== */
.achievement-notify {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    padding: 14px 28px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border-radius: var(--radius-lg);
    font-weight: 700;
    font-size: 1rem;
    z-index: 250;
    box-shadow: 0 4px 20px rgba(245,158,11,0.4);
    animation: achIn 0.5s ease, achOut 0.5s ease 2.5s forwards;
}

@keyframes achIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-30px) scale(0.8); }
    to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

@keyframes achOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* ===== Dark Theme Components ===== */
[data-theme="dark"] .card-type.type-opportunity { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .card-type.type-market { background: #422006; color: #fcd34d; }
[data-theme="dark"] .card-type.type-doodad { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .card-type.type-baby { background: #4a0e2b; color: #f9a8d4; }
[data-theme="dark"] .card-type.type-downsized { background: #78350f; color: #fde68a; }
[data-theme="dark"] .card-type.type-charity { background: #312e81; color: #a5b4fc; }
[data-theme="dark"] .card-type.type-fast-track { background: #3b0764; color: #c4b5fd; }

[data-theme="dark"] .asset-tabs .tab-btn {
    background: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-text);
}

[data-theme="dark"] .asset-tabs .tab-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

[data-theme="dark"] .challenge-card {
    background: var(--color-surface);
}

[data-theme="dark"] .quantity-input input {
    background: #0f172a;
    color: var(--color-text);
    border-color: var(--color-border);
}

/* ===== Calculator Form ===== */
.calculator-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 12px 0;
}

.calc-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.calc-input-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-light);
}

.calc-input-group input {
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--color-surface);
    color: var(--color-text);
}

[data-theme="dark"] .calc-input-group input {
    background: #0f172a;
    border-color: var(--color-border);
}

/* ===== What-If Panel ===== */
.whatif-panel {
    margin-top: 10px;
    padding: 10px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
}

[data-theme="dark"] .whatif-panel {
    background: #1e293b;
    border-color: #334155;
}

/* ===== Dashboard Tabs ===== */
.dashboard-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
}

.dashboard-tabs .tab-btn {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    cursor: pointer;
    font-size: 0.85rem;
    font-family: inherit;
    color: var(--color-text);
    transition: all var(--transition);
}

.dashboard-tabs .tab-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

[data-theme="dark"] .dashboard-tabs .tab-btn {
    background: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-text);
}

[data-theme="dark"] .dashboard-tabs .tab-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* ===== Quiz Styles ===== */
.quiz-option {
    text-align: left;
    margin-bottom: 6px;
    transition: all 0.2s ease;
}

.quiz-option:hover:not(:disabled) {
    border-color: var(--color-primary);
    background: #eff6ff;
}

[data-theme="dark"] .quiz-option:hover:not(:disabled) {
    background: #1e293b;
}

.quiz-feedback-correct {
    background: #dcfce7 !important;
    border-color: #16a34a !important;
    color: #166534 !important;
}

.quiz-feedback-wrong {
    background: #fee2e2 !important;
    border-color: #dc2626 !important;
    color: #991b1b !important;
}

[data-theme="dark"] .quiz-feedback-correct {
    background: #14532d !important;
    border-color: #16a34a !important;
    color: #86efac !important;
}

[data-theme="dark"] .quiz-feedback-wrong {
    background: #450a0a !important;
    border-color: #dc2626 !important;
    color: #fca5a5 !important;
}

/* ===== Responsive Components ===== */
@media (max-width: 768px) {
    .profession-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .dream-grid {
        grid-template-columns: 1fr;
    }

    .notification {
        left: 16px;
        right: 16px;
        max-width: none;
    }

    .calculator-form {
        grid-template-columns: 1fr;
    }

    .dashboard-tabs {
        flex-wrap: wrap;
    }
}
