/* ==========================================================================
   1. CORE VARIABLES & BASE STYLES
   ========================================================================== */
:root {
    --primary: #f55f17;
    --primary-dark: #c24b12;
    --bg-gray: #f3f4f6;
    --bg-card: #ffffff;
    --border: #d1d5db;
    --border-light: #e5e7eb;
    --border-dark: #929599;
    --text-main: #111827;
    --text-muted: #6b7280;
    --disabled: #d1d5db;
}

html {
    scrollbar-gutter: stable;
    overflow-y: scroll;
}

body, .ek-body { 
    margin: 0; 
    padding: 0; 
    background-color: var(--bg-gray); 
    color: var(--text-main); 
    font-family: sans-serif; 
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
}

.ek-app-wrapper { min-height: 100vh; }
.ek-container { width: 100%; max-width: 1024px; margin: 0 auto; padding: 0 1rem; box-sizing: border-box; }

/* DISPLAYS */
.inline-flex { display: inline-flex; }
.hidden { display: none; }

/* POSITION */
.relative { position: relative; }

/* ==========================================================================
   2. LAYOUT COMPONENTS (Mobile First)
   ========================================================================== */
.ek-header-bar { background: #ffffff; border-bottom: 1px solid var(--border-light); padding: 1.5rem 0; margin-bottom: 2rem; }
.ek-main-content { padding-top: 1rem; padding-bottom: 3rem; }
.ek-page-wrapper { padding: 1rem 0; }
.ek-divider { border: 0; border-top: 1px solid var(--border-light); margin: 1.5rem 0; }
.ek-text-success { color: #059669; font-weight: 500; }

/* Grid Systems */
.ek-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; width: 100%; }

/* Dashboard Grids */
.ek-dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.ek-stat-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.ek-dashboard-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

/* Cards */
.ek-card { background: var(--bg-card); border-radius: 0.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.08); margin-bottom: 1.25rem; border: 1px solid var(--border-light); }
.ek-card-body { padding: 1.25rem; }
.ek-room-border { border-left: 4px solid var(--primary); }

.ek-stat-card {
    padding: 1.25rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-light);
}

.ek-stat-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.ek-schedule-item {
    padding: 1rem;
    background-color: #f9fafb;
    border: 1px solid var(--border-light);
    border-radius: 0.5rem;
    transition: background-color 0.2s;
}
.ek-schedule-item:hover {
    background-color: #f3f4f6;
}

/* Images & Icons */
.ek-icon-check { color: #10b981; font-weight: bold; margin-right: 0.5rem; }

/* ==========================================================================
   3. FORM ELEMENTS & BUTTONS
   ========================================================================== */
.ek-form-group { margin-bottom: 1.25rem; }
.ek-label { display: block; font-size: 0.875rem; font-weight: 600; color: #374151; margin-bottom: 0.5rem; }
.ek-label-caps { display: block; font-size: 0.875rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }

.ek-input { 
    display: block; width: 100%; height: 48px; padding: 0.75rem; 
    border: 1px solid var(--border); border-radius: 0.375rem; 
    font-size: 16px; box-sizing: border-box; background-color: white; appearance: none;
}
.ek-input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(245, 95, 23, 0.15); }
textarea.ek-input { height: auto; min-height: 100px; }
.ek-input-readonly { background-color: #f9f9f9; cursor: not-allowed; }

/* Checkboxes */
.ek-checkbox-row { display: flex; flex-direction: column; gap: 1rem; background: #fdfdfd; padding: 1rem; border-radius: 0.375rem; }
.ek-checkbox-label { display: flex; align-items: center; cursor: pointer; font-size: 0.875rem; color: #374151; }
.ek-checkbox { width: 24px; height: 24px; margin-right: 0.75rem; border: 1px solid var(--border); border-radius: 4px; }

/* Buttons */
.ek-btn-primary { 
    width: 100%; 
    background: var(--primary); 
    color: #fff; 
    padding: 0.75rem 1.5rem; 
    border-radius: 0.375rem; 
    font-weight: 700; 
    border: none; 
    cursor: pointer; 
    font-size: 0.95rem; 
    transition: background 0.2s; 
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}
.ek-btn-primary:hover { background: var(--primary-dark); }

.ek-btn-primary-disabled { 
    width: 100%; 
    background: var(--disabled); 
    color: #fff; 
    padding: 0.75rem 1.5rem; 
    border-radius: 0.375rem; 
    font-weight: 700; 
    border: none; 
    cursor: not-allowed; 
    opacity: 0.5; 
    font-size: 0.95rem; 
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.ek-btn-secondary { 
    display: inline-flex; 
    align-items: center;
    justify-content: center;
    background: #fff; 
    padding: 0.5rem 1rem; 
    border: 1px solid var(--border); 
    border-radius: 0.375rem; 
    text-decoration: none; 
    font-size: 0.875rem; 
    font-weight: 600; 
    color: #374151; 
    cursor: pointer;
    transition: background 0.15s ease-in-out;
}
.ek-btn-secondary:hover { background: #f9fafb; }
.ek-btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }

.ek-btn-tertiary { 
    display: inline-block; 
    background: #8a8a8a; 
    padding: 0.5rem 1rem; 
    border: 1px solid var(--border); 
    border-radius: 0.375rem; 
    text-decoration: none; 
    font-size: 0.875rem; 
    font-weight: 600; 
    color: #ffffff; 
}
.ek-btn-tertiary:hover { background: black; }

.ek-btn-sm { width: auto; padding: 0.4rem 0.75rem; font-size: 0.8125rem; }
.ek-btn-header { width: auto; padding: 0.625rem 1.25rem; font-size: 0.875rem; white-space: nowrap; }

.ek-btn-outline {
    background: transparent !important;
    border: 2px solid var(--primary) !important;
    color: var(--primary) !important;
}
.ek-btn-outline:hover {
    background: #fff8f1 !important;
}

.ek-btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background-color: #dc2626;
    border: 1px solid transparent;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.75rem;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 150ms ease-in-out;
}
.ek-btn-danger:hover { background-color: #ef4444; }
.ek-btn-danger:active { background-color: #b91c1c; }
.ek-btn-danger:focus { outline: none; box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #dc2626; }
.ek-btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }

.ek-btn-outline-danger {
    background-color: #fff;
    color: #dc2626;
    border: 1px solid #dc2626;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.ek-btn-outline-danger:hover {
    background-color: #dc2626;
    color: #ffffff;
}

.ek-btn-dash { width: 100%; padding: 1.25rem; border: 2px dashed #93c5fd; background: #eff6ff; color: var(--primary); border-radius: 0.5rem; font-weight: 600; cursor: pointer; }

/* ==========================================================================
   4. NAVIGATION (Mobile First)
   ========================================================================== */
.ek-nav { background: #fff; border-bottom: 1px solid var(--border-light); position: sticky; top: 0; z-index: 100; }
.ek-nav-wrapper { display: flex; justify-content: space-between; align-items: center; height: 64px; }
.ek-nav-left { display: flex; }
.ek-logo { display: flex; align-items: center; }
.ek-logo-img { display: flex; height: 36px; width: auto; color: #333; }

.desktop-only { display: none; }
.mobile-only { display: block; }

.ek-hamburger { padding: 0.5rem; border: none; background: transparent; color: #9ca3af; cursor: pointer; }

.ek-icon-md { height: 24px; width: 24px; }
.ek-icon-xs { height: 16px; width: 16px; margin-left: 4px; }

/* Mobile Menu Dropdown */
.ek-mobile-menu { background: #fff; border-top: 1px solid var(--border-light); padding-bottom: 1rem; }
.ek-mobile-link { 
    display: block; padding: 0.75rem 1rem; text-decoration: none; 
    color: #4b5563; font-weight: 500; font-size: 1rem; border-left: 4px solid transparent;
}
.ek-mobile-link.active { background: #eff6ff; color: var(--primary); border-left-color: var(--primary); }
.ek-w-full { width: 100%; text-align: left; background: none; border: none; }

.ek-mobile-user-section { border-top: 1px solid var(--border-light); margin-top: 0.5rem; padding-top: 1rem; }
.ek-user-info { padding: 0 1rem; margin-bottom: 0.5rem; }
.ek-user-name { font-weight: 600; color: var(--text-main); }
.ek-user-email { font-size: 0.875rem; color: var(--text-muted); }

/* ==========================================================================
   5. TABLES & STATUS BADGES
   ========================================================================== */
.ek-table-responsive { width: 100%; overflow-x: auto; }
.ek-table { width: 100%; border-collapse: collapse; text-align: left; }
.ek-table th { 
    background: #f9fafb; 
    padding: 0.75rem 0.5rem; 
    font-size: 0.75rem; 
    text-transform: uppercase; 
    color: #6b7280; 
    border-bottom: 1px solid var(--border-light); 
}
.ek-table td { 
    padding: 0.75rem 0.5rem; 
    border-bottom: 1px solid var(--border-light); 
    vertical-align: middle; 
}
.ek-table-row-clickable { cursor: pointer; transition: background 0.2s; }
.ek-table-row-clickable:hover { background: #f3f4f6; }
.ek-table-empty { padding: 3rem 1rem; text-align: center; color: #9ca3af; }

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}
.status-active { background-color: #ecfdf5; color: #065f46; }
.status-pending { background-color: #fefce8; color: #854d0e; }
.status-complete { background-color: #eff6ff; color: #1e40af; }

/* ==========================================================================
   6. SIDE DRAWER MODAL & BACKDROP (Hardware Accelerated)
   ========================================================================== */
.ek-side-pane-modal,
.ek-side-pane {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    background: #ffffff;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
    z-index: 1050;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ek-side-pane-modal.is-open,
.ek-side-pane.is-open {
    transform: translateX(0);
}

.ek-backdrop {
    position: fixed; 
    inset: 0; 
    background: rgba(0, 0, 0, 0.4);
    z-index: 1040; 
    display: none; 
    opacity: 0; 
    transition: opacity 0.3s ease;
}
.ek-backdrop.is-visible { 
    display: block; 
    opacity: 1; 
}

/* ==========================================================================
   7. DESKTOP & TABLET ENHANCEMENTS
   ========================================================================== */
@media (min-width: 640px) {
    .ek-stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .ek-table th, 
    .ek-table td {
        padding: 1rem 0.75rem;
    }
}

@media (min-width: 768px) {
    /* Layout */
    .ek-main-content { padding-top: 2rem; }
    .ek-page-wrapper { padding: 2rem 0; }
    .ek-grid-2 { grid-template-columns: repeat(2, 1fr); }
    .ek-grid-3 { grid-template-columns: repeat(3, 1fr); }
    
    /* Nav */
    .desktop-only { display: flex; }
    .mobile-only { display: none; }
    .ek-nav-links { margin-left: 2.5rem; gap: 2rem; }
    .ek-link { 
        text-decoration: none; color: var(--text-muted); font-size: 0.875rem; 
        font-weight: 500; align-self: center; border-bottom: 2px solid transparent; transition: 0.2s;
    }
    .ek-link:hover, .ek-link.active { color: var(--text-main); }
    .ek-link.active { border-bottom-color: var(--primary); }

    /* Dropdown */
    .ek-user-btn { display: flex; align-items: center; background: none; border: none; color: var(--text-muted); font-size: 0.875rem; font-weight: 500; cursor: pointer; }
    .ek-dropdown-menu { position: absolute; right: 0; top: 100%; width: 12rem; background: #fff; border: 1px solid var(--border-light); border-radius: 0.375rem; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); padding: 0.5rem 0; }
    .ek-dropdown-link { display: block; padding: 0.5rem 1rem; text-decoration: none; color: #4b5563; font-size: 0.875rem; }
    .ek-dropdown-link:hover { background: #f9fafb; }

    /* Forms */
    .ek-checkbox-row { flex-direction: row; gap: 2rem; }

    /* Drawer Size on Desktop */
    .ek-side-pane-modal,
    .ek-side-pane {
        max-width: 680px;
    }
}

@media (min-width: 1024px) {
    .ek-stat-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
        margin-bottom: 2rem;
    }
    .ek-dashboard-layout {
        grid-template-columns: 2fr 1fr;
    }
}

/* ==========================================================================
   8. EXTRA UTILITIES & ALERTS
   ========================================================================== */
.ek-badge { background: #dbeafe; color: #1e40af; border-radius: 99px; padding: 2px 8px; margin-right: 8px; font-size: 0.875rem; }
.ek-badge-count { background: var(--primary); color: white; padding: 2px 10px; border-radius: 99px; font-weight: 700; font-size: 0.8rem; }
.ek-text-red { color: #dc2626; background: none; border: none; cursor: pointer; font-weight: 600; }
.ek-text-muted { color: #6b7280; }
.ek-font-bold { font-weight: 700; color: var(--text-main); }
.ek-flex-between { display: flex; justify-content: space-between; align-items: center; }

/* Spacing */
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-8 { margin-top: 2rem; }

/* Alerts */
.ek-alert-error { background: #fef2f2; border-left: 4px solid #ef4444; padding: 1rem; border-radius: 4px; margin-bottom: 1.5rem; }
.ek-alert-error ul { margin: 5px 0 0; padding-left: 20px; color: #b91c1c; font-size: 0.875rem; }
.ek-alert-success { background: #ecfdf5; border-left: 4px solid #10b981; color: #065f46; padding: 1rem; border-radius: 4px; margin-bottom: 1.5rem; }

/* Upload Box */
.ek-upload-box {
    border: 2px dashed var(--border);
    border-radius: 0.5rem;
    padding: 2rem;
    background-color: #fafafa;
    transition: border-color 0.2s;
}
.ek-upload-box:hover { border-color: var(--primary); }
.ek-upload-content { text-align: center; }
.ek-upload-icon { width: 3rem; height: 3rem; color: var(--text-muted); margin: 0 auto 1rem; }
.ek-upload-label { cursor: pointer; font-weight: 600; color: var(--primary); text-decoration: underline; }

.ek-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}