/* ============================================================
   DormFlow - Modern Dormitory Management System
   Complete UI Redesign - Professional SaaS Dashboard
   ============================================================ */

/* 1. Design System Variables */
:root {
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-300: #a5b4fc;
    --primary-400: #818cf8;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;
    --primary-800: #3730a3;
    --primary-900: #312e81;
    --primary-950: #1e1b4b;

    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    --success-50: #ecfdf5; --success-500: #10b981; --success-600: #059669; --success-700: #047857;
    --warning-50: #fffbeb; --warning-500: #f59e0b; --warning-600: #d97706; --warning-700: #b45309;
    --danger-50: #fef2f2; --danger-500: #ef4444; --danger-600: #dc2626; --danger-700: #b91c1c;
    --info-50: #eff6ff; --info-500: #3b82f6; --info-600: #2563eb; --info-700: #1d4ed8;

    --sidebar-width: 272px;
    --sidebar-collapsed: 80px;
    --header-height: 64px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* 2. Reset & Base */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Prompt', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    font-size: 14.5px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}
a { color: var(--primary-600); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--primary-700); }
img { max-width: 100%; height: auto; }
hr { border: none; border-top: 1px solid var(--gray-200); margin: 24px 0; }
::selection { background: var(--primary-100); color: var(--primary-900); }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* 3. Layout */
.wrapper { display: flex; min-height: 100vh; }

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-950) 0%, var(--gray-900) 100%);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: width var(--transition-slow), transform var(--transition-slow);
    overflow: hidden;
}
.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    min-height: 72px;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}
.sidebar-brand-icon {
    width: 52px; height: 52px;
    background: transparent;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: white;
    flex-shrink: 0;
}
.sidebar-brand-text h2 {
    color: white;
    font-size: 1.15rem;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: -0.02em;
}
.sidebar-brand-text span {
    color: var(--gray-400);
    font-size: 0.72rem;
    white-space: nowrap;
    display: block;
    margin-top: -2px;
}
.sidebar-toggle {
    width: 28px; height: 28px;
    border: none;
    background: rgba(255,255,255,0.08);
    border-radius: var(--radius-sm);
    color: var(--gray-400);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    flex-shrink: 0;
    font-size: 0.75rem;
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.15); color: white; }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 0;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

.nav-section { padding: 20px 20px 8px; }
.nav-section-title {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gray-500);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-menu { list-style: none; padding: 0 8px; }
.sidebar-menu li { margin: 2px 0; }
.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--gray-400);
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    white-space: nowrap;
    font-size: 0.9rem;
    font-weight: 400;
    position: relative;
}
.sidebar-menu a i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
    transition: var(--transition-fast);
}
.sidebar-menu a span { overflow: hidden; text-overflow: ellipsis; }
.sidebar-menu a:hover {
    background: rgba(255,255,255,0.08);
    color: var(--gray-200);
}
.sidebar-menu a.active {
    background: rgba(79, 70, 229, 0.25);
    color: white;
    font-weight: 500;
}
.sidebar-menu a.active i { color: var(--primary-400); }
.sidebar-menu a.active::before {
    content: '';
    position: absolute;
    left: -8px; top: 6px; bottom: 6px;
    width: 3px;
    background: var(--primary-400);
    border-radius: 0 3px 3px 0;
}
.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--gray-400);
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    font-size: 0.9rem;
}
.sidebar-footer a:hover { background: rgba(239,68,68,0.15); color: var(--danger-500); }
.sidebar-footer a i { width: 20px; text-align: center; font-size: 1rem; flex-shrink: 0; }

/* Sidebar collapsed state */
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .sidebar-menu a span,
.sidebar.collapsed .sidebar-footer a span { opacity: 0; width: 0; overflow: hidden; }
.sidebar.collapsed .sidebar-footer .sidebar-label-show { display: none; }
.sidebar.collapsed .sidebar-footer > div { padding: 10px 0; display: flex; justify-content: center; }
.sidebar.collapsed .sidebar-footer > div > div:first-child { justify-content: center; }
.sidebar.collapsed .sidebar-footer > div > div:last-child { display: none; }
.sidebar.collapsed .sidebar-menu a { justify-content: center; padding: 12px; }
.sidebar.collapsed .sidebar-menu a i { margin: 0; font-size: 1.15rem; }
.sidebar.collapsed .sidebar-menu a::before { left: -8px; }
.sidebar.collapsed .sidebar-footer a { justify-content: center; padding: 12px; }
.sidebar.collapsed .sidebar-header { justify-content: center; padding: 20px 10px; }
.sidebar.collapsed .sidebar-brand { justify-content: center; }
.sidebar.collapsed .sidebar-toggle i { transform: rotate(180deg); }
.sidebar.collapsed .nav-section { padding: 12px 0; text-align: center; }
.sidebar.collapsed + .main-content { margin-left: var(--sidebar-collapsed); }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-base);
}
.sidebar-overlay.active { opacity: 1; visibility: visible; }

/* --- Main Content --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition-slow);
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: 100vw;
    overflow-x: hidden;
}

/* --- Top Header --- */
.top-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-height);
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}
.header-left { display: flex; align-items: center; gap: 16px; }
.header-toggle {
    width: 36px; height: 36px;
    border: none;
    background: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--gray-600);
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}
.header-toggle:hover { background: var(--gray-100); color: var(--gray-800); }
.page-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--gray-900);
    letter-spacing: -0.01em;
}
.header-right { display: flex; align-items: center; gap: 8px; }
.header-action-btn {
    width: 38px; height: 38px;
    border: none;
    background: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--gray-500);
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: var(--transition-fast);
}
.header-action-btn:hover { background: var(--gray-100); color: var(--gray-700); }
.notification-badge {
    position: absolute;
    top: 4px; right: 4px;
    width: 18px; height: 18px;
    background: var(--danger-500);
    color: white;
    border-radius: 50%;
    font-size: 0.65rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}
.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-fast);
    margin-left: 4px;
}
.header-user:hover { background: var(--gray-100); }
.header-user-avatar {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.85rem;
}
.header-user-info { display: flex; flex-direction: column; line-height: 1.3; }
.header-user-name { font-size: 0.85rem; font-weight: 600; color: var(--gray-800); }
.header-user-role { font-size: 0.7rem; color: var(--gray-500); }

/* Content area */
.content-area { padding: 24px; flex: 1; max-width: 100%; overflow-x: hidden; min-width: 0; }

/* 4. Cards */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    border: 1px solid var(--gray-100);
    overflow: hidden;
    transition: box-shadow var(--transition-fast);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
}
.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-title i { color: var(--gray-400); font-size: 0.9rem; }
.card-body { padding: 20px; }
.card-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50);
}

/* 5. Statistics Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition-fast);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: white;
    flex-shrink: 0;
}
.stat-icon.blue { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.stat-icon.green { background: linear-gradient(135deg, #10b981, #059669); }
.stat-icon.orange { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-icon.red { background: linear-gradient(135deg, #ef4444, #dc2626); }
.stat-icon.purple { background: linear-gradient(135deg, #6366f1, #4338ca); }
.stat-info h3 {
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
    letter-spacing: -0.02em;
}
.stat-info p {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 2px;
    font-weight: 400;
}

/* 6. Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    font-family: inherit;
    line-height: 1.5;
    white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn i { font-size: 0.85rem; }
.btn-primary { background: var(--primary-600); color: white; }
.btn-primary:hover { background: var(--primary-700); color: white; box-shadow: 0 4px 12px rgba(79,70,229,0.3); }
.btn-success { background: var(--success-500); color: white; }
.btn-success:hover { background: var(--success-600); color: white; box-shadow: 0 4px 12px rgba(16,185,129,0.3); }
.btn-warning { background: var(--warning-500); color: white; }
.btn-warning:hover { background: var(--warning-600); color: white; }
.btn-danger { background: var(--danger-500); color: white; }
.btn-danger:hover { background: var(--danger-600); color: white; }
.btn-secondary { background: white; color: var(--gray-700); border-color: var(--gray-300); }
.btn-secondary:hover { background: var(--gray-50); border-color: var(--gray-400); }
.btn-info { background: var(--info-500); color: white; }
.btn-info:hover { background: var(--info-600); color: white; }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; border-radius: var(--radius-sm); }
.btn-sm i { font-size: 0.75rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; border-radius: var(--radius-md); }
.btn-tenant { background: var(--success-500); color: white; }
.btn-tenant:hover { background: var(--success-600); color: white; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* 7. Tables */
.table-responsive { overflow-x: auto; border-radius: var(--radius-md); }
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.table th, .table td {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.85rem;
}
.table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-600);
    white-space: nowrap;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.table td { border-bottom: 1px solid var(--gray-100); color: var(--gray-700); vertical-align: middle; }
.table tbody tr { transition: background var(--transition-fast); }
.table tbody tr:hover { background: var(--primary-50); }
.table tbody tr:last-child td { border-bottom: none; }
.table .actions { display: flex; gap: 6px; align-items: center; }

/* 8. Forms */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--gray-700);
    font-size: 0.85rem;
}
.form-label.required::after {
    content: ' *';
    color: var(--danger-500);
    font-weight: 400;
}
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--gray-800);
    background: white;
    transition: all var(--transition-fast);
    line-height: 1.5;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}
.form-control::placeholder { color: var(--gray-400); }
.form-select {
    width: 100%;
    padding: 10px 40px 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--gray-800);
    background-color: #fff;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px 12px;
    line-height: 1.5;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.form-select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}
.form-select option {
    padding: 10px 14px;
    font-size: 0.9rem;
    color: var(--gray-800);
    background: #fff;
}
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}
.form-text {
    font-size: 0.78rem;
    color: var(--gray-500);
    margin-top: 4px;
}
textarea.form-control { min-height: 80px; resize: vertical; }

/* 9. Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}
.badge-success { background: var(--success-50); color: var(--success-700); }
.badge-warning { background: var(--warning-50); color: var(--warning-700); }
.badge-danger { background: var(--danger-50); color: var(--danger-700); }
.badge-info { background: var(--info-50); color: var(--info-700); }
.badge-secondary { background: var(--gray-100); color: var(--gray-600); }
.badge-primary { background: var(--primary-50); color: var(--primary-700); }
.status-available { background: var(--success-50); color: var(--success-700); }
.status-occupied { background: var(--info-50); color: var(--info-700); }
.status-reserved { background: var(--warning-50); color: var(--warning-700); }
.status-maintenance { background: var(--gray-100); color: var(--gray-600); }

/* 10. Room Grid */
.room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}
.room-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 16px;
    text-align: center;
    border: 1.5px solid var(--gray-200);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}
.room-card:hover { border-color: var(--primary-300); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.room-card.selected { border-color: var(--primary-500); background: var(--primary-50); box-shadow: 0 0 0 3px var(--primary-100); }
.room-card .room-number { font-size: 1.35rem; font-weight: 700; color: var(--gray-900); }
.room-card .room-floor { font-size: 0.78rem; color: var(--gray-500); margin: 2px 0 8px; }
.room-card .room-price { font-size: 0.9rem; color: var(--primary-600); font-weight: 600; margin-bottom: 8px; }
.room-card.available { border-left: 4px solid var(--success-500); }
.room-card.occupied { border-left: 4px solid var(--info-500); }
.room-card.reserved { border-left: 4px solid var(--warning-500); }
.room-card.maintenance { border-left: 4px solid var(--gray-400); }

/* 11. Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
    padding: 20px;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
    background: white;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(-10px) scale(0.98);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-xl);
}
.modal-overlay.active .modal { transform: translateY(0) scale(1); }
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.modal-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 8px;
}
.modal-header h3 i { color: var(--primary-500); }
.modal-close {
    width: 32px; height: 32px;
    border: none; background: var(--gray-100);
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}
.modal-close:hover { background: var(--gray-200); color: var(--gray-800); }
.modal-close.glass-close {
    background: rgba(255,255,255,0.18);
    color: #fff;
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.2);
}
.modal-close.glass-close:hover {
    background: rgba(255,255,255,0.32);
    color: #fff;
}
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    position: sticky;
    bottom: 0;
    background: var(--gray-50);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* 12. Alerts */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    border: 1px solid;
    animation: alertSlide 0.3s ease-out;
}
@keyframes alertSlide {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.alert-success { background: var(--success-50); color: var(--success-700); border-color: rgba(16,185,129,0.2); }
.alert-danger { background: var(--danger-50); color: var(--danger-700); border-color: rgba(239,68,68,0.2); }
.alert-warning { background: var(--warning-50); color: var(--warning-700); border-color: rgba(245,158,11,0.2); }
.alert-info { background: var(--info-50); color: var(--info-700); border-color: rgba(59,130,246,0.2); }

/* 13. Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px; right: 24px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
}
.toast {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    background: white;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.88rem;
    border-left: 4px solid;
    animation: toastIn 0.35s ease-out;
    position: relative;
    overflow: hidden;
}
.toast.toast-out { animation: toastOut 0.3s ease-in forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(100%); } }
.toast-success { border-color: var(--success-500); }
.toast-success i { color: var(--success-500); }
.toast-error { border-color: var(--danger-500); }
.toast-error i { color: var(--danger-500); }
.toast-warning { border-color: var(--warning-500); }
.toast-warning i { color: var(--warning-500); }
.toast-info { border-color: var(--info-500); }
.toast-info i { color: var(--info-500); }
.toast-progress {
    position: absolute;
    bottom: 0; left: 0;
    height: 3px;
    background: var(--gray-300);
    animation: toastProgress 4s linear forwards;
}
@keyframes toastProgress { from { width: 100%; } to { width: 0; } }

/* 14. Loading */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-base);
}
.loading-overlay.active { opacity: 1; visibility: visible; }
.loading-spinner {
    width: 40px; height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary-600);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 15. Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-950) 0%, var(--primary-800) 50%, var(--primary-600) 100%);
    position: relative;
    overflow: hidden;
}
.login-container::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(99,102,241,0.3) 0%, transparent 70%);
    top: -200px; right: -200px;
    border-radius: 50%;
}
.login-container::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(16,185,129,0.2) 0%, transparent 70%);
    bottom: -100px; left: -100px;
    border-radius: 50%;
}
.login-box {
    background: white;
    padding: 40px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}
.login-logo {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo i {
    font-size: 2.5rem;
    color: var(--primary-600);
    margin-bottom: 12px;
    display: block;
}
.login-logo h1 {
    font-size: 1.4rem;
    color: var(--gray-900);
    font-weight: 700;
}

/* 16. Bills & Receipts */
.bill-box, .receipt-box {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 24px;
}
.bill-header, .receipt-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px dashed var(--gray-200);
}
.bill-header h2, .receipt-header h2 { font-size: 1.2rem; color: var(--gray-900); font-weight: 700; }
.bill-info { margin-bottom: 16px; }
.bill-info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dotted var(--gray-200);
    font-size: 0.88rem;
}
.bill-info-row:last-child { border-bottom: none; }
.bill-items { margin: 16px 0; }
.bill-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 0.88rem;
}
.bill-total {
    background: var(--gray-50);
    padding: 16px;
    border-radius: var(--radius-md);
    margin-top: 16px;
    border: 1px solid var(--gray-100);
}
.bill-total .total-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary-600);
}

/* 17. Tabs */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.tab {
    padding: 8px 18px;
    background: white;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
    transition: all var(--transition-fast);
    font-size: 0.88rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.tab:hover { background: var(--gray-50); border-color: var(--gray-300); color: var(--gray-700); }
.tab.active { background: var(--primary-600); color: white; border-color: var(--primary-600); }
.tab .badge { margin-left: 4px; }

/* 18. Photos */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 10px;
}
.photo-gallery img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid var(--gray-200);
}
.photo-gallery img:hover { transform: scale(1.03); box-shadow: var(--shadow-md); }

/* 19. Tenant special */
.room-badge {
    background: linear-gradient(135deg, var(--success-500), var(--success-600));
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.tenant-badge {
    background: var(--success-500);
    color: white;
    padding: 4px 14px;
    border-radius: 16px;
    font-size: 0.8rem;
    display: inline-block;
    margin-bottom: 16px;
}

/* 20. Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.py-4 { padding-top: 2rem; padding-bottom: 2rem; }
.text-success { color: var(--success-600) !important; }
.text-danger { color: var(--danger-600) !important; }
.text-warning { color: var(--warning-600) !important; }
.text-info { color: var(--info-600) !important; }
.text-muted { color: var(--gray-500) !important; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.d-mobile { display: none; }
.border-primary { border-color: var(--primary-500) !important; }

/* Grid helper */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* Page transition */
/* fadeIn removed for performance */

/* 21. Print */
@media print {
    .sidebar, .sidebar-overlay, .top-header, .btn, .no-print, .toast-container { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .content-area { padding: 0; }
    .card { box-shadow: none; border: 1px solid var(--gray-300); break-inside: avoid; }
    body { font-size: 12px; background: white; }
}

/* 22. Responsive - Tablet */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1001;
    }
    .sidebar.mobile-open { transform: translateX(0); }
    .sidebar.collapsed { width: var(--sidebar-width); }
    .main-content { margin-left: 0 !important; }
    .d-mobile { display: flex; }
    .content-area { padding: 16px; }
    .grid-2 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
    .header-user-info { display: none; }
}

/* 23. Responsive - Mobile */
@media (max-width: 640px) {
    body { font-size: 14px; }
    .content-area { padding: 12px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 14px; gap: 12px; }
    .stat-icon { width: 40px; height: 40px; font-size: 1rem; }
    .stat-info h3 { font-size: 1.25rem; }
    .card-header { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
    .card-body { padding: 12px 16px; }
    .form-row { grid-template-columns: 1fr; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .modal { margin: 0; border-radius: var(--radius-lg); max-height: 90vh; }
    .modal-overlay { padding: 10px; }
    .modal-body { padding: 16px; }
    .modal-header { padding: 16px; }
    .table th, .table td { padding: 10px 12px; font-size: 0.8rem; }
    .room-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
    .room-card { padding: 12px; }
    .btn { padding: 10px 16px; }
    .btn-sm { padding: 6px 10px; }
    .page-title { font-size: 1rem; }
    .top-header { padding: 0 12px; }
    .login-box { padding: 28px 20px; margin: 16px; }
    .bill-box, .receipt-box { padding: 16px; }
    .toast-container { right: 12px; bottom: 12px; left: 12px; max-width: 100%; }
    .tabs { gap: 6px; }
    .tab { padding: 6px 12px; font-size: 0.82rem; }
    .header-user { padding: 6px; }
    .header-user .fa-chevron-down { display: none; }
}

@media (max-width: 380px) {
    .stats-grid { grid-template-columns: 1fr; }
}
