:root {
    /* Brand Colors */
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #eff6ff;
    --accent: #6366f1;
    
    /* Neutral */
    --bg-body: #f1f5f9;
    --surface: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    
    /* State */
    --danger: #ef4444;
    --success: #22c55e;
    
    /* Dimensions */
    --sidebar-width: 260px;
    --header-height: 60px;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
}

a { text-decoration: none; color: inherit; }

/* --- Login Page Upgrade --- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, #e0e7ff, transparent 40%),
                radial-gradient(circle at bottom left, #dbeafe, transparent 40%),
                #f8fafc;
    padding: 1rem;
}

.login-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    width: 100%;
    max-width: 420px;
    padding: 3rem 2.5rem;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.5);
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.login-card:hover { transform: translateY(-2px); }

.login-header { text-align: center; margin-bottom: 2.5rem; }
.brand-logo {
    width: 56px; height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    font-weight: 800;
    font-size: 1.25rem;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.3);
}

.login-header h2 { font-size: 1.75rem; font-weight: 700; color: var(--text-main); letter-spacing: -0.025em; }
.login-header p { color: var(--text-muted); font-size: 0.95rem; margin-top: 0.5rem; }

/* Floating Label Inputs */
.input-group { position: relative; margin-bottom: 1.5rem; }
.input-group input {
    width: 100%;
    padding: 1rem 1rem 1rem 1rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: white;
    font-size: 1rem;
    transition: all 0.2s;
    outline: none;
    color: var(--text-main);
}

.input-group label {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    padding: 0 4px;
    color: var(--text-muted);
    font-size: 1rem;
    transition: all 0.2s;
    pointer-events: none;
}

.input-group input:focus,
.input-group input:not(:placeholder-shown) {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.input-group input:focus ~ label,
.input-group input:not(:placeholder-shown) ~ label {
    top: 0;
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
}

.btn-lg {
    padding: 1rem;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.1);
}
.btn-lg .arrow { transition: transform 0.2s; }
.btn-lg:hover .arrow { transform: translateX(4px); }

.login-footer {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.7;
}

.alert-error {
    background: #fef2f2;
    color: var(--danger);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid #fee2e2;
}

/* --- App Utils --- */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-size: 0.95rem;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { border: 1px solid var(--border); background: white; color: var(--text-main); }
.btn-outline:hover { background: var(--bg-body); }
.btn-block { width: 100%; display: flex; }

.card {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid var(--border);
    overflow: hidden;
}

.p-4 { padding: 1.5rem; }
.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.form-group { margin-bottom: 1rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
textarea.form-control { resize: vertical; }

/* --- App Layout --- */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0; top: 0; z-index: 10;
}
.brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
    border-bottom: 1px solid var(--border);
}
.brand-icon {
    background: var(--primary); color: white;
    width: 28px; height: 28px;
    display: grid; place-items: center;
    border-radius: 6px; margin-right: 10px; font-size: 0.8rem;
}
.nav-menu { flex: 1; padding: 1.5rem 1rem; }
.nav-item {
    display: flex; align-items: center;
    padding: 0.75rem 1rem; color: var(--text-muted);
    border-radius: 8px; margin-bottom: 0.5rem;
    font-weight: 500; transition: all 0.2s;
}
.nav-item:hover, .nav-item.active { background: var(--primary-light); color: var(--primary); }
.nav-item .icon { margin-right: 10px; }
.nav-divider {
    font-size: 0.75rem; text-transform: uppercase;
    color: var(--text-muted); margin: 1.5rem 0 0.5rem 1rem;
    letter-spacing: 0.05em; font-weight: 600;
}
.user-profile {
    padding: 1rem; border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px;
}
.avatar {
    width: 36px; height: 36px;
    background: var(--text-main); color: white;
    border-radius: 50%; display: grid; place-items: center;
    font-weight: 600;
}
.user-info { flex: 1; line-height: 1.2; font-size: 0.9rem; }
.user-info small { color: var(--text-muted); font-size: 0.8rem; }
.logout-btn { color: var(--text-muted); padding: 5px; border-radius: 4px; }
.logout-btn:hover { background: #fef2f2; color: var(--danger); }

/* Main Content */
.main-content {
    flex: 1; margin-left: var(--sidebar-width);
    padding: 2rem; max-width: 1600px;
}
.section { margin-bottom: 3rem; scroll-margin-top: 2rem; }
.section-header {
    display: flex; justify-content: space-between;
    align-items: center; margin-bottom: 1.5rem;
}
.header-title h1 { font-size: 1.75rem; color: var(--text-main); font-weight: 700; }
.header-title p { color: var(--text-muted); }

/* Calendar */
.calendar-grid {
    display: grid; grid-template-columns: repeat(7, 1fr);
    background: var(--border); gap: 1px;
    border-bottom: 1px solid var(--border);
}
.cal-head {
    background: var(--bg-body); padding: 1rem;
    text-align: center; font-weight: 600;
    color: var(--text-muted); font-size: 0.9rem;
}
.cal-cell {
    background: white; min-height: 140px;
    padding: 0.5rem; position: relative;
}
.cal-cell.empty { background: #fcfcfc; }
.cal-cell.today { background: #fffbeb; }
.day-number {
    font-size: 0.85rem; font-weight: 600;
    color: var(--text-muted); margin-bottom: 0.5rem; display: block;
}
.cal-cell.today .day-number { color: var(--primary); }
.events-stack { display: flex; flex-direction: column; gap: 4px; }
.event-chip {
    background: var(--primary-light); color: var(--primary-dark);
    padding: 4px 8px; border-radius: 4px;
    font-size: 0.8rem; font-weight: 500;
    cursor: pointer; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
    border-left: 3px solid var(--primary);
    transition: transform 0.2s;
}
.event-chip:hover { transform: translateX(2px); }
.event-chip.has-img { border-left-color: var(--success); }

/* Search & List */
.event-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem; margin-top: 1rem;
}
.search-card {
    border: 1px solid var(--border); border-radius: 8px;
    overflow: hidden; cursor: pointer; transition: all 0.2s;
}
.search-card:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.search-img { height: 120px; background-size: cover; background-position: center; }
.search-info { padding: 1rem; }
.search-info h4 { margin-bottom: 0.25rem; font-size: 1rem; }
.search-info small { color: var(--text-muted); }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.events-list-simple { max-height: 400px; overflow-y: auto; }
.list-item {
    display: flex; justify-content: space-between;
    align-items: center; padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-content { cursor: pointer; flex: 1; }
.list-content strong { display: block; font-size: 0.95rem; }
.list-content .text-muted { font-size: 0.8rem; }
.btn-icon.delete { font-size: 1.1rem; padding: 0.5rem; border-radius: 6px; }
.btn-icon.delete:hover { background: #fef2f2; }

/* Modal */
.modal {
    display: none; position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 100;
    justify-content: center; align-items: center;
    backdrop-filter: blur(4px);
}
.modal-content {
    background: white; width: 90%; max-width: 500px;
    border-radius: 12px; overflow: hidden; position: relative;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    animation: slideUp 0.3s ease-out;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.close-modal {
    position: absolute; top: 10px; right: 15px;
    font-size: 24px; color: white; cursor: pointer;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5); z-index: 2;
}
.modal-cover {
    height: 200px; background-color: var(--primary);
    background-size: cover; background-position: center;
}
.modal-body { padding: 1.5rem; }
.modal-meta { margin-bottom: 1rem; }
.badge {
    background: var(--bg-body); color: var(--text-muted);
    padding: 4px 10px; border-radius: 20px;
    font-size: 0.85rem; font-weight: 500;
}

@media (max-width: 900px) {
    .sidebar { width: 70px; }
    .nav-item span:not(.icon), .brand span, .user-info, .nav-divider { display: none; }
    .brand-icon { margin-right: 0; }
    .nav-item { justify-content: center; padding: 1rem 0.5rem; }
    .nav-item .icon { margin: 0; font-size: 1.2rem; }
    .main-content { margin-left: 70px; padding: 1rem; }
    .admin-grid { grid-template-columns: 1fr; }
    .calendar-grid { overflow-x: auto; }
    .cal-cell { min-height: 100px; }
}