:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --secondary: #10B981;
    --secondary-hover: #059669;
    --bg-color: #F8FAFC;
    --card-bg: #FFFFFF;
    --text-main: #0F172A;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    
    --status-planned-bg: #F1F5F9;
    --status-planned-text: #475569;
    --status-almost-bg: #FEF3C7;
    --status-almost-text: #D97706;
    --status-invited-bg: #E0E7FF;
    --status-invited-text: #4338CA;
    --status-confirmed-bg: #DCFCE7;
    --status-confirmed-text: #15803D;
    --status-declined-bg: #FEE2E2;
    --status-declined-text: #B91C1C;

    --radius: 16px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --transition: all 0.2s ease-in-out;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
}

/* Icons */
.material-icons-outlined {
    font-size: 1.2rem;
}
.icon-align {
    vertical-align: middle;
    margin-right: 5px;
    margin-bottom: 2px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255,255,255,0.9);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s;
}
.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}
.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    padding: 25px 20px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    box-shadow: 2px 0 8px rgba(0,0,0,0.02);
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 30px;
    color: var(--primary);
    display: flex;
    align-items: center;
}

.nav-links {
    list-style: none;
    flex-grow: 1;
}

.nav-links li {
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.nav-links li:hover {
    background: #F1F5F9;
    color: var(--primary);
}

.nav-links li.active {
    background: var(--primary);
    color: white;
}
.nav-links li.active .material-icons-outlined { color: white; }

#export-btn { margin-top: auto; width: 100%; justify-content: center; display: flex; }

/* Main Content */
.content {
    margin-left: 260px;
    padding: 40px;
    width: calc(100% - 260px);
    max-width: 1200px;
}

.view {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}
.view.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

header { margin-bottom: 30px; }
header h1 { font-size: 2rem; margin-bottom: 5px; color: var(--text-main); }
header p { color: var(--text-muted); }

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    text-align: center;
}

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    margin-top: 10px;
}
.stat-breakdown {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border-color);
}
.stat-breakdown b { color: var(--text-main); }

.quick-status-filters {
    background: white;
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.status-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.status-tag {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
}
.status-planned { background: var(--status-planned-bg); color: var(--status-planned-text); }
.status-almost { background: var(--status-almost-bg); color: var(--status-almost-text); }
.status-invited { background: var(--status-invited-bg); color: var(--status-invited-text); }
.status-confirmed { background: var(--status-confirmed-bg); color: var(--status-confirmed-text); }
.status-declined { background: var(--status-declined-bg); color: var(--status-declined-text); }

/* Forms & Cards */
.card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.card h3 {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.form-group { margin-bottom: 15px; }

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
}

input[type="text"], input[type="number"], select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    transition: var(--transition);
    background: #F8FAFC;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.inline-form { display: flex; gap: 10px; align-items: center; }
.inline-form input { flex-grow: 1; }

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary { background: #E2E8F0; color: #475569; }
.btn-secondary:hover { background: #CBD5E1; }

.btn-success { background: #DCFCE7; color: #15803D; }
.btn-success:hover { background: #BBF7D0; }

.btn-small { padding: 6px 12px; font-size: 0.85rem; border-radius: 6px; border: none; font-weight:600; cursor:pointer;}
.btn-danger { background: #FEE2E2; color: #DC2626; }

.mt-20 { margin-top: 20px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* Counter Section (Form) */
.counter-section {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    background: #F8FAFC;
}
.box-invited { border-color: #E2E8F0; }
.box-confirmed { background: #F0FDF4; border-color: #BBF7D0; }
.box-confirmed .counter-header { color: #15803D; font-weight: 700;}

.counter-header {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.counters-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.counter-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px;
    text-align: center;
}
.counter-item label {
    margin-bottom: 10px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}
.counter-item label small { font-size: 0.7rem; color: #94A3B8; font-weight: 400; margin-top:2px;}
.counter-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.counter-controls button {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: #F1F5F9;
    color: var(--text-main);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
}
.counter-controls button:hover { background: #E2E8F0; }
.counter-controls span { font-weight: 700; font-size: 1.1rem; }
.max-note { font-size: 0.7rem; color: #94A3B8; margin-top: 5px; }

/* Dynamic Names inside Form */
.dynamic-names h4 { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 10px; }
.dynamic-person-row { display: flex; gap: 10px; margin-bottom: 10px; }
.dynamic-person-row input[type="text"] { flex: 2; }
.dynamic-person-row input[type="number"] { flex: 1; }

/* Radio Group (Status) */
.radio-group { display: flex; gap: 10px; flex-wrap: wrap; }
.radio-label {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition);
    background: white;
    color: var(--text-muted);
}
.radio-label input[type="radio"] { display: none; }
.radio-label .material-icons-outlined { font-size: 1.1rem; margin-right: 6px; }

/* Checked states */
.radio-label:has(input[value="planned"]:checked) { background: var(--status-planned-bg); color: var(--status-planned-text); border-color: var(--status-planned-text); }
.radio-label:has(input[value="almost"]:checked) { background: var(--status-almost-bg); color: var(--status-almost-text); border-color: var(--status-almost-text); }
.radio-label:has(input[value="invited"]:checked) { background: var(--status-invited-bg); color: var(--status-invited-text); border-color: var(--status-invited-text); }
.radio-label:has(input[value="confirmed"]:checked) { background: var(--status-confirmed-bg); color: var(--status-confirmed-text); border-color: var(--status-confirmed-text); }
.radio-label:has(input[value="declined"]:checked) { background: var(--status-declined-bg); color: var(--status-declined-text); border-color: var(--status-declined-text); }

/* Diet & Allergies */
.diet-panel {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    margin-top: 5px;
    margin-bottom: 15px;
    width: 100%;
}
.diet-tags-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}
.diet-pill {
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: white;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}
.diet-pill.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.diet-icon {
    font-size: 1rem;
    margin-right: 2px;
    vertical-align: middle;
}
.allergy-warning {
    color: #DC2626;
    cursor: help;
}

.form-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}
.modal-content {
    background: white;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Guests List */
.filters { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-btn {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--transition);
}
.filter-btn:hover { background: #F1F5F9; }
.filter-btn.active {
    background: var(--text-main);
    color: white;
    border-color: var(--text-main);
}

/* Guests Table */
.dashboard-table-section h2 { margin-bottom: 15px; font-size: 1.2rem;}
.table-responsive {
    overflow-x: auto;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}
.guests-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    min-width: 600px;
}
.guests-table th, .guests-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}
.guests-table th {
    background: #F8FAFC;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.guests-table tr:last-child td { border-bottom: none; }
.guests-table tr:hover td { background: #F8FAFC; }

.counts-cell { display: flex; gap: 8px; flex-wrap: wrap; }
.cnt-badge {
    background: #F1F5F9;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}
.cnt-badge.success { background: #DCFCE7; color: #15803D; }

.table-members-list { list-style: none; margin: 0; padding: 0; font-size: 0.85rem; }
.table-members-list li { margin-bottom: 3px; position: relative; padding-left: 10px; }
.table-members-list li::before { content: "•"; position: absolute; left: 0; color: var(--text-muted); }

.empty-state {
    padding: 30px;
    text-align: center;
    color: var(--text-muted);
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

/* Calculators */
.calculator-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}
.calc-card {
    background: white;
    padding: 25px;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}
.calc-card h3 { font-size: 1.2rem; margin-bottom: 10px; color: var(--text-main); display:flex; justify-content:center; align-items:center;}
.calc-card p { font-weight: 700; color: var(--primary); font-size: 1.2rem;}

/* Check Lists */
.check-list { list-style: none; }
.check-list li {
    display: flex;
    align-items: center;
    padding: 14px;
    background: white;
    margin-bottom: 10px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.check-list li input[type="checkbox"] { margin-right: 15px; width: 22px; height: 22px; cursor: pointer;}
.check-list li.done span { text-decoration: line-through; color: var(--text-muted); }
.check-list .delete-item { margin-left: auto; cursor: pointer; color: #DC2626; background:none; border:none; padding:5px; display:flex; align-items:center;}

/* Budget */
.budget-progress-container {
    background: white;
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}
.budget-info { display: flex; justify-content: space-between; margin-bottom: 15px; font-weight: 600; }
.progress-bar-bg { height: 24px; background: #F1F5F9; border-radius: 12px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--secondary); width: 0%; transition: width 0.5s ease-in-out; }
.progress-bar-fill.danger { background: #EF4444; }

.list-group { list-style: none; }
.list-group li {
    display: flex;
    justify-content: space-between;
    padding: 16px;
    background: white;
    border: 1px solid var(--border-color);
    margin-bottom: 8px;
    border-radius: 10px;
    align-items: center;
}

/* Responsive */
@media (max-width: 768px) {
    body { padding-bottom: 70px; }
    .sidebar {
        width: 100%; height: 65px; position: fixed; bottom: 0; left: 0; top: auto;
        flex-direction: row; align-items: center; padding: 0 10px; 
        border-right: none; border-top: 1px solid var(--border-color);
        z-index: 1000; justify-content: space-between;
    }
    .logo { display: none; }
    .nav-links { 
        display: flex; gap: 0; width: 100%; justify-content: space-around;
    }
    .nav-links li { 
        margin-bottom: 0; padding: 8px 5px; flex-direction: column; font-size: 0.7rem;
        border-radius: 8px; text-align: center;
    }
    .nav-links li .material-icons-outlined { margin-right: 0; margin-bottom: 4px; font-size: 1.3rem;}
    .content { margin-left: 0; width: 100%; padding: 15px; }
    #export-btn { display: none; }
    .counters-grid { grid-template-columns: 1fr; }
    
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .status-tags { justify-content: center; }
}
