:root {
    --primary: #c4a559;
    --primary-hover: #b09148;
    --on-primary: #1a1a1a;
    --bg-color: #0f1012;
    --surface: #1a1b1e;
    --surface-glass: rgba(26, 27, 30, 0.8);
    --border: rgba(196, 165, 89, 0.2);
    --on-surface: #f0f0f5;
    --text-muted: #a0a1b0;
    --danger: #cd3c33;
    --success: #2d5e3c;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

.light-theme {
    --bg-color: #fbfaf8;
    --surface: #ffffff;
    --surface-glass: rgba(255, 255, 255, 0.9);
    --border: rgba(196, 165, 89, 0.15);
    --on-surface: #1c1d1e;
    --text-muted: #757684;
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--on-surface);
    line-height: 1.5;
    transition: background 0.3s ease;
    overflow-x: hidden;
}

.glass-panel {
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* Auth Container */
.auth-container {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 40px;
}

.auth-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
}

.auth-logo {
    height: 100px;
    margin-bottom: 20px;
}

.auth-header h1 {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 2.2rem;
    color: var(--primary);
    text-align: center;
    letter-spacing: -1.5px;
}

.auth-header p {
    text-align: center;
    color: var(--text-muted);
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
    margin-left: 4px;
}

input, select {
    width: 100%;
    height: 44px !important;
    padding: 0 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--on-surface);
    font-family: inherit;
    font-size: 15px;
    outline: none;
    transition: 0.2s;
    line-height: normal !important;
    -webkit-appearance: none;
    appearance: none;
}

input[type="date"]::-webkit-date-and-time-value,
input[type="time"]::-webkit-date-and-time-value {
    margin: 0;
    min-height: 1em;
}

textarea {
    width: 100%;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--on-surface);
    font-family: inherit;
    font-size: 15px;
    outline: none;
    transition: 0.2s;
}

input[type="date"], input[type="time"] {
    min-height: 44px !important;
    display: block;
}

.light-theme input, .light-theme textarea, .light-theme select {
    background: rgba(0, 0, 0, 0.03);
}

input:focus, textarea:focus, select:focus {
    border-color: var(--primary);
    background: rgba(107, 76, 255, 0.05);
}

.primary-btn {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: var(--on-primary);
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(107, 76, 255, 0.3);
}

.auth-toggle {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-muted);
}

#toggle-auth-mode {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 700;
    cursor: pointer;
    margin-left: 5px;
}

/* Dashboard Container */
.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 30px;
    margin-bottom: 24px;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -1px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo img {
    height: 40px;
    width: auto;
}

.user-actions {
    display: flex;
    gap: 12px;
}

.icon-btn {
    width: 40px; height: 40px;
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
    border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
}

.secondary-btn {
    padding: 8px 16px;
    background: rgba(255,255,255,0.05);
    color: var(--on-surface);
    border: none;
    border-radius: 10px;
    cursor: pointer; font-weight: 600;
}

/* Main Layout */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
}

.form-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.calendar-section {
    padding: 30px;
}

.calendar-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-bottom: 30px;
}

.calendar-controls h2 {
    font-size: 1.5rem;
    min-width: 200px;
    text-align: center;
}

.nav-btn {
    background: rgba(255,255,255,0.05);
    border: none;
    color: var(--on-surface);
    width: 40px; height: 40px; border-radius: 12px;
    font-size: 1.2rem; cursor: pointer;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 12px;
    text-align: center;
}

.calendar-weekdays span {
    color: var(--primary);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
    position: relative;
    border: 1px solid transparent;
}

.calendar-day:hover {
    background: rgba(255,255,255,0.05);
}

.calendar-day.today {
    background: rgba(107, 76, 255, 0.1);
    color: var(--primary);
    border-color: rgba(107, 76, 255, 0.2);
}

.calendar-day.selected {
    background: var(--primary);
    color: var(--on-primary);
}

.calendar-day.other-month {
    opacity: 0.1;
    cursor: default;
}

.calendar-day .event-dot {
    width: 4px; height: 4px;
    border-radius: 50%;
    background: var(--primary);
    position: absolute;
    bottom: 8px;
}

.selected .event-dot {
    background: white;
}

/* Day Details Section */
.day-details-section {
    padding: 30px;
    display: flex; flex-direction: column;
}

.section-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 24px;
}

.add-btn {
    padding: 6px 16px;
    background: var(--primary);
    color: white; border-radius: 12px;
}

.events-list {
    flex: 1;
    overflow-y: auto;
}

.event-item {
    background: rgba(255,255,255,0.03);
    padding: 16px;
    border-radius: 16px;
    margin-bottom: 12px;
    display: flex; flex-direction: column; gap: 4px;
    border-left: 4px solid var(--primary);
    cursor: pointer;
}

.event-item:hover { background: rgba(255,255,255,0.06); }

.ev-header { display: flex; justify-content: space-between; align-items: baseline; }
.ev-title { font-weight: 700; font-size: 16px; }
.ev-time { font-size: 12px; color: var(--text-muted); }
.ev-desc { font-size: 14px; color: var(--text-muted); }

/* Quick Pick Section */
.quick-pick {
    display: flex;
    gap: 5px;
    margin-top: 8px;
}

.quick-pick button {
    flex: 1;
    padding: 6px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--on-surface);
    font-size: 11px;
    font-weight: 600;
}

/* Modal */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    display: none; align-items: center; justify-content: center;
    z-index: 1000; padding: 20px;
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch;
}

.modal.active { display: flex; }

.modal-content {
    width: 100%;
    max-width: 500px;
    padding: 30px;
    position: relative;
    margin: auto;
    animation: slideUp 0.3s ease;
}

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

.close-modal {
    position: absolute; top: 20px; right: 24px;
    background: none; border: none; color: var(--text-muted); font-size: 24px;
}

.form-row { display: flex; gap: 12px; margin-top: 15px; }
.form-row .form-group { flex: 1; width: 100%; }

/* Responsive adjustments */
@media (max-width: 900px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
    .top-bar { margin-bottom: 12px; }
    .auth-card { padding: 30px; }
}

@media (max-width: 600px) {
    body { padding: 10px; }
    .dashboard-container { padding: 8px; }
    .main-layout { gap: 16px; }
    .calendar-section { padding: 15px; }
    .calendar-grid { gap: 6px; }
    .calendar-day { border-radius: 12px; font-size: 14px; }
    .form-row { flex-direction: column; gap: 15px; }
    .section-header h3 { font-size: 1.2rem; }
    .modal-content { padding: 20px; }
    .form-group input, .form-group select { height: 44px !important; line-height: normal !important; padding: 0 12px; font-size: 14px; }
    .form-group textarea { padding: 10px; font-size: 14px; }
    input[type="date"], input[type="time"] { min-height: 44px !important; }
}

.danger-btn {
    width: 100%;
    padding: 16px;
    background: rgba(255, 71, 87, 0.1);
    color: var(--danger);
    border: 1px solid rgba(255, 71, 87, 0.2);
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
}

.danger-btn:hover {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.3);
}

.error-msg {
    color: var(--danger);
    font-size: 13px;
    margin-bottom: 15px;
    text-align: center;
}

.loader-overlay {
    position: fixed; top:0; left:0; width:100%; height:100%;
    background: var(--bg-color);
    z-index: 2000; display: flex; align-items: center; justify-content: center;
}

.loader {
    width: 48px; height: 48px;
    border: 5px solid var(--primary);
    border-bottom-color: transparent;
    border-radius: 50%;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
