:root {
    /* Color Palette - Premium Dark Theme */
    --bg-base: #0f1115;
    --bg-surface: rgba(25, 28, 36, 0.4);
    --bg-surface-hover: rgba(40, 44, 56, 0.6);
    --bg-glass: rgba(25, 28, 36, 0.65);
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --accent: #8b5cf6;
    
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.12);
    
    --danger: #ef4444;
    --danger-hover: #dc2626;

    --success: #10b981;
    
    /* Layout */
    --sidebar-width: 280px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    
    /* Shadows & Effects */
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --blur-glass: blur(16px);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body.dark-theme {
    background-color: var(--bg-base);
    color: var(--text-main);
    min-height: 100vh;
    overflow: hidden;
    /* Subtle mesh gradient background */
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
}

.hidden {
    display: none !important;
}

.glass-effect {
    background: var(--bg-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-glass);
}

/* App Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    border-right: 1px solid var(--border-color);
    background: rgba(15, 17, 21, 0.5);
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.brand h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #fff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* User & Auth */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
}

.user-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#user-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

/* Navigation */
.nav-section h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 600;
}

.side-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.side-nav li {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    font-size: 0.95rem;
}

.side-nav li:hover {
    background: var(--bg-surface-hover);
    color: var(--text-main);
}

.side-nav li.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}

.sidebar-bottom {
    margin-top: auto;
}

.mimestream-info {
    padding: 16px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.mimestream-info i {
    color: var(--success);
    font-size: 1.2rem;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px;
    gap: 24px;
    min-width: 0; /* Important for flex child */
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-radius: var(--radius-lg);
}

.date-display h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.date-display p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

.actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.calendar-wrapper {
    flex: 1;
    border-radius: var(--radius-lg);
    padding: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* FullCalendar Overrides for Dark/Premium Theme */
#calendar {
    flex: 1;
    min-height: 0;
}
.fc-theme-standard td, .fc-theme-standard th {
    border-color: var(--border-color);
}
.fc-theme-standard .fc-scrollgrid {
    border-color: var(--border-color);
}
.fc-col-header-cell-cushion {
    color: var(--text-main);
    font-weight: 600;
    padding: 12px !important;
}
.fc-daygrid-day-number {
    color: var(--text-main);
    padding: 8px !important;
    font-weight: 500;
}
.fc-day-today {
    background: rgba(99, 102, 241, 0.1) !important;
}
.fc-h-event {
    background-color: var(--primary);
    border: none;
    border-radius: 4px;
    padding: 2px 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: var(--transition);
}
.fc-h-event:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}
.fc-event-title {
    font-weight: 500;
    font-family: 'Plus Jakarta Sans', sans-serif;
}
.fc-event-time {
    font-weight: 600;
}
.fc-toolbar {
    display: none !important; /* Hide default toolbar as we have custom */
}


/* Buttons */
.btn {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    font-family: inherit;
}

.primary-btn {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.icon-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    background: var(--bg-surface);
    color: var(--text-main);
    border: 1px solid var(--border-light);
}

.icon-btn:hover {
    background: var(--bg-surface-hover);
    color: white;
}

.text-btn {
    background: transparent;
    color: var(--text-muted);
}
.text-btn:hover {
    color: var(--text-main);
}

.danger-btn {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.danger-btn:hover {
    background: var(--danger);
    color: white;
}


/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal {
    width: 100%;
    max-width: 480px;
    padding: 32px;
    border-radius: var(--radius-lg);
    transform: translateY(0) scale(1);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.hidden .modal {
    transform: translateY(20px) scale(0.95);
}

.modal h3 {
    font-size: 1.25rem;
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-row {
    display: flex;
    gap: 16px;
}
.form-row .form-group {
    flex: 1;
}

label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

input, textarea, select {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    color: var(--text-main);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
    appearance: none;
    -webkit-appearance: none;
}

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

select {
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23e2e8f0%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 16px top 50%;
    background-size: 10px auto;
}
select option {
    background: var(--bg-base);
    color: var(--text-main);
}

/* Fix datetime picker picker icon color in webkit */
::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 32px;
}
