/* Simcha Budget Planner Styles */

:root {
    /* Emerald / Forest palette */
    --simcha-primary: #16a34a;
    --simcha-primary-light: #22c55e;
    --simcha-primary-dark: #166534;
    --simcha-gold: #fbbf24;
    --simcha-rose: #f43f5e;
    --simcha-teal: #0ea5e9;
    --simcha-green: #16a34a;
    --simcha-surface: #ffffff;
    --simcha-surface-muted: #f2f7f3;
    --simcha-border: #d7e4da;
    --simcha-ink: #0f172a;

    /* Legacy aliases for minimal code churn */
    --simcha-purple: var(--simcha-primary);
    --simcha-purple-light: var(--simcha-primary-light);
    --simcha-purple-dark: var(--simcha-primary-dark);
}

body.simcha-planner-page {
    background: linear-gradient(145deg, #f0fdf4 0%, #f8fafc 48%, #ecfdf3 100%);
    color: var(--simcha-ink);
}

/* Hero Section */
.simcha-hero {
    padding: 5rem 0 3.5rem;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #f0fdf4 0%, #e0f2e9 100%);
}

.simcha-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 15% 20%, rgba(22, 101, 52, 0.14) 0%, transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(34, 197, 94, 0.12) 0%, transparent 35%);
    z-index: 0;
}

.simcha-hero .container {
    position: relative;
    z-index: 1;
}

.hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border-radius: 999px;
    background: rgba(22, 101, 52, 0.1);
    color: var(--simcha-purple);
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

.simcha-hero h1 {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    line-height: 1.1;
    margin-bottom: 1rem;
    font-weight: 800;
    color: var(--simcha-primary); /* fallback */
    background: none;
}

@supports (-webkit-background-clip: text) {
    .simcha-hero h1 {
        background: linear-gradient(135deg, var(--simcha-primary) 0%, var(--simcha-primary-light) 100%);
        background-clip: text;
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        color: transparent;
    }
}

.simcha-hero p.lead {
    font-size: 1.2rem;
    color: var(--gray);
    max-width: 800px;
    line-height: 1.7;
    margin-bottom: 2rem;
}

.hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 2rem;
}

.stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    background: white;
    border: 2px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    font-weight: 600;
    color: var(--dark);
    transition: all 0.3s ease;
}

.stat-chip i {
    color: var(--simcha-primary);
    font-size: 1.2rem;
}

.stat-chip:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(22, 101, 52, 0.16);
    border-color: var(--simcha-primary);
}

/* Main Calculator Layout */
.calculator-shell {
    padding: 3rem 0 5rem;
}

.calculator-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 1200px) {
    .calculator-grid {
        grid-template-columns: 1fr;
    }

    .summary-sidebar {
        position: static !important;
        max-height: none !important;
    }
}

/* Main Input Panel */
.input-panel {
    background: var(--simcha-surface);
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.panel-header {
    background: linear-gradient(135deg, var(--simcha-primary) 0%, var(--simcha-primary-dark) 100%);
    color: white;
    padding: 2rem;
}

.panel-header h2 {
    color: white;
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
}

.panel-subtitle {
    color: rgba(255, 255, 255, 0.9);
    margin-top: 0.5rem;
    font-size: 0.95rem;
}

.panel-body {
    padding: 2rem;
}

/* Event Type Selector */
.event-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.event-type {
    padding: 1.2rem;
    border: 2px solid var(--simcha-border);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--simcha-surface);
}

.event-type i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
    color: var(--gray);
    transition: all 0.3s ease;
}

.event-type span {
    display: block;
    font-weight: 600;
    color: var(--dark);
    font-size: 0.9rem;
}

.event-type:hover {
    border-color: var(--simcha-purple);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(22, 101, 52, 0.18);
}

.event-type.active {
    border-color: var(--simcha-purple);
    background: linear-gradient(135deg, rgba(22, 101, 52, 0.12) 0%, rgba(34, 197, 94, 0.07) 100%);
}

.event-type.active i {
    color: var(--simcha-purple);
}

/* Budget Categories */
.budget-section {
    margin-bottom: 2.5rem;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid var(--simcha-border);
}

.section-title i {
    color: var(--simcha-purple);
    font-size: 1.3rem;
}

.section-title h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--dark);
}

.budget-items {
    display: grid;
    gap: 1rem;
}

.budget-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 1rem;
    align-items: start;
    padding: 1rem;
    background: var(--simcha-surface-muted);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.budget-item:hover {
    background: #e8f2ea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Single column layout for event details */
.budget-item.single-row {
    grid-template-columns: 1fr 1fr 1fr;
}

.field {
    display: flex;
    flex-direction: column;
}

.field label {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.field input,
.field select,
.field textarea {
    padding: 0.75rem;
    border: 2px solid var(--simcha-border);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--simcha-purple);
    box-shadow: 0 0 0 3px rgba(22, 101, 52, 0.12);
}

.field small {
    color: var(--gray);
    font-size: 0.85rem;
    margin-top: 0.3rem;
}

.price-range {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--gray);
    margin-top: 0.3rem;
}

.price-range i {
    color: var(--simcha-gold);
}

/* Summary Sidebar */
.summary-sidebar {
    position: sticky;
    top: 2rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

.summary-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.summary-header {
    background: linear-gradient(135deg, var(--simcha-primary) 0%, var(--simcha-primary-dark) 100%);
    color: white;
    padding: 1.5rem;
}

.summary-header h3 {
    color: white;
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
}

.summary-body {
    padding: 1.5rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--simcha-border);
}

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

.summary-row span:first-child {
    font-weight: 600;
    color: var(--dark);
}

.summary-row span:last-child {
    font-weight: 700;
    color: var(--simcha-primary);
    font-size: 1.1rem;
}

.summary-total {
    background: linear-gradient(135deg, rgba(22, 101, 52, 0.12) 0%, rgba(34, 197, 94, 0.06) 100%);
    padding: 1.2rem;
    margin: 1rem -1.5rem -1.5rem;
    border-top: 2px solid var(--simcha-primary);
}

.summary-total .total-label {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dark);
}

.summary-total .total-amount {
    font-size: 2rem;
    font-weight: 800;
    color: var(--simcha-purple);
}

/* Net Cost Indicator */
.net-cost-card {
    background: linear-gradient(135deg, var(--simcha-green) 0%, var(--simcha-teal) 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    margin-top: 1rem;
}

.net-cost-card h4 {
    color: white;
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 600;
}

.net-cost-card .amount {
    font-size: 2rem;
    font-weight: 800;
    margin: 0;
}

.net-cost-card .explanation {
    font-size: 0.85rem;
    margin-top: 0.5rem;
    opacity: 0.9;
}

/* Progress Bar */
.budget-progress {
    margin: 1.5rem 0;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.progress-bar {
    height: 12px;
    background: var(--simcha-border);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--simcha-primary) 0%, var(--simcha-primary-light) 100%);
    border-radius: 999px;
    transition: width 0.5s ease;
}

.progress-fill.over-budget {
    background: linear-gradient(90deg, var(--simcha-rose) 0%, #ef4444 100%);
}

/* Action Buttons */
.action-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.9rem 1.2rem;
    border-radius: 10px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-save {
    background: linear-gradient(135deg, var(--simcha-purple) 0%, var(--simcha-purple-light) 100%);
    color: white;
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.3);
}

.btn-load {
    background: white;
    color: var(--simcha-purple);
    border: 2px solid var(--simcha-purple);
}

.btn-load:hover {
    background: rgba(124, 58, 237, 0.05);
    transform: translateY(-2px);
}

.btn-export {
    background: linear-gradient(135deg, var(--simcha-gold) 0%, #f59e0b 100%);
    color: var(--dark);
}

.btn-export:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(251, 191, 36, 0.3);
}

.btn-reset {
    background: #f3f4f6;
    color: var(--dark);
    border: 2px solid #e5e7eb;
}

.btn-reset:hover {
    background: #e5e7eb;
    transform: translateY(-2px);
}

/* Gift Tracker */
.gift-tracker {
    margin-top: 2rem;
}

.gift-list {
    display: grid;
    gap: 0.8rem;
    margin-top: 1rem;
}

.gift-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1.5fr auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    background: var(--simcha-surface-muted);
    border-radius: 8px;
    border: 1px solid var(--simcha-border);
}

.gift-item input,
.gift-item textarea {
    padding: 0.6rem;
    border: 2px solid var(--simcha-border);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
}

.gift-item textarea {
    resize: vertical;
    min-height: 38px;
}

.btn-remove {
    background: #fee2e2;
    color: #dc2626;
    border: none;
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-remove:hover {
    background: #fecaca;
}

.btn-add-gift {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem;
    background: var(--simcha-surface);
    border: 2px dashed var(--simcha-purple);
    color: var(--simcha-purple);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    margin-top: 1rem;
    transition: all 0.3s ease;
}

.btn-add-gift:hover {
    background: rgba(22, 101, 52, 0.07);
    border-style: solid;
}

/* Alerts */
.alert {
    padding: 1rem 1.2rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: start;
    gap: 0.8rem;
}

.alert i {
    font-size: 1.2rem;
    margin-top: 0.1rem;
}

.alert-warning {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    color: #92400e;
}

.alert-warning i {
    color: #f59e0b;
}

.alert-success {
    background: #d1fae5;
    border-left: 4px solid var(--simcha-green);
    color: #065f46;
}

.alert-success i {
    color: var(--simcha-green);
}

.alert-info {
    background: #dbeafe;
    border-left: 4px solid #3b82f6;
    color: #1e40af;
}

.alert-info i {
    color: #3b82f6;
}

/* Responsive Design */
@media (max-width: 768px) {
    .simcha-hero {
        padding: 3rem 0 2rem;
    }

    .calculator-grid {
        gap: 1.5rem;
    }

    .event-selector {
        grid-template-columns: repeat(2, 1fr);
    }

    .budget-item,
    .budget-item.single-row {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .action-buttons {
        grid-template-columns: 1fr;
    }

    .gift-item {
        grid-template-columns: 1fr;
    }

    .summary-sidebar {
        position: static;
        max-height: none;
    }
}

/* Dark mode support (requires .dark-mode on body) */
body.simcha-planner-page.dark-mode {
    background: linear-gradient(145deg, #0b1510 0%, #0c1520 48%, #0d1a12 100%);
    color: #e5e7eb;
}

.simcha-planner-page.dark-mode .simcha-hero {
    background: linear-gradient(135deg, #0f2017 0%, #0b1519 100%);
}

.simcha-planner-page.dark-mode .simcha-hero::before {
    background:
        radial-gradient(circle at 15% 20%, rgba(34, 197, 94, 0.18) 0%, transparent 35%),
        radial-gradient(circle at 85% 80%, rgba(22, 163, 74, 0.16) 0%, transparent 32%);
}

.simcha-planner-page.dark-mode .hero-kicker {
    background: rgba(34, 197, 94, 0.14);
    color: #bbf7d0;
}

.simcha-planner-page.dark-mode .simcha-hero h1 {
    color: #bbf7d0; /* fallback */
    background: none;
}

@supports (-webkit-background-clip: text) {
    .simcha-planner-page.dark-mode .simcha-hero h1 {
        background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
        background-clip: text;
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        color: transparent;
    }
}

.simcha-planner-page.dark-mode .simcha-hero p.lead {
    color: #dbeafe;
}

.simcha-planner-page.dark-mode .input-panel,
.simcha-planner-page.dark-mode .summary-card {
    background: #0f1a15;
    border: 1px solid #1f2d27;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.simcha-planner-page.dark-mode .panel-header {
    background: linear-gradient(135deg, #166534 0%, #0b3d20 100%);
}

.simcha-planner-page.dark-mode .panel-subtitle {
    color: rgba(255, 255, 255, 0.85);
}

.simcha-planner-page.dark-mode .budget-item,
.simcha-planner-page.dark-mode .gift-item {
    background: #0f2417;
    border: 1px solid #1f2d27;
}

.simcha-planner-page.dark-mode .budget-item:hover {
    background: #112b1b;
}

.simcha-planner-page.dark-mode .field label {
    color: #e2e8f0;
}

.simcha-planner-page.dark-mode .field input,
.simcha-planner-page.dark-mode .field select,
.simcha-planner-page.dark-mode .field textarea {
    background: #0b1410;
    border-color: #1f2d27;
    color: #e5e7eb;
}

.simcha-planner-page.dark-mode .field small,
.simcha-planner-page.dark-mode .price-range {
    color: #94a3b8;
}

.simcha-planner-page.dark-mode .section-title {
    border-color: #1f2d27;
}

.simcha-planner-page.dark-mode .section-title i {
    color: var(--simcha-primary-light);
}

.simcha-planner-page.dark-mode .section-title h3 {
    color: #f8fafc;
}

.simcha-planner-page.dark-mode .event-type {
    background: #0f1a15;
    border-color: #1f2d27;
}

.simcha-planner-page.dark-mode .event-type span,
.simcha-planner-page.dark-mode .summary-row span:first-child {
    color: #e5e7eb;
}

.simcha-planner-page.dark-mode .event-type i {
    color: #9ca3af;
}

.simcha-planner-page.dark-mode .event-type.active {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.14) 0%, rgba(22, 163, 74, 0.12) 100%);
    border-color: var(--simcha-primary-light);
}

.simcha-planner-page.dark-mode .event-type.active i {
    color: var(--simcha-primary-light);
}

.simcha-planner-page.dark-mode .stat-chip {
    background: #0f1a15;
    border-color: #1f2d27;
    color: #e5e7eb;
    box-shadow: none;
}

.simcha-planner-page.dark-mode .stat-chip i {
    color: var(--simcha-primary-light);
}

.simcha-planner-page.dark-mode .summary-row {
    border-color: #1f2d27;
}

.simcha-planner-page.dark-mode .summary-total {
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.18) 0%, rgba(34, 197, 94, 0.12) 100%);
    border-top-color: var(--simcha-primary-light);
}

.simcha-planner-page.dark-mode .summary-total .total-amount {
    color: #f8fafc;
}

.simcha-planner-page.dark-mode .summary-total .total-label {
    color: #f8fafc;
}

.simcha-planner-page.dark-mode .progress-bar {
    background: #1f2d27;
}

.simcha-planner-page.dark-mode .btn-load {
    background: #0f1a15;
    color: var(--simcha-primary-light);
    border-color: var(--simcha-primary);
}

.simcha-planner-page.dark-mode .btn-reset {
    background: #111827;
    color: #e5e7eb;
    border: 2px solid #1f2d27;
}

.simcha-planner-page.dark-mode .btn-reset:hover {
    background: #0f172a;
}

.simcha-planner-page.dark-mode .btn-add-gift {
    background: #0f1a15;
}

.simcha-planner-page.dark-mode .alert {
    color: #e5e7eb;
}

/* Hidden utility */
.hidden {
    display: none !important;
}
