/* ============================================================
   RESET & BASE
   ============================================================ */

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

body {
    font-family: 'Noto Sans Lao', 'Saysettha OT', 'Phetsarath OT', Arial, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    line-height: 1.6;
    color: var(--text-color);
}

input, textarea, select, button {
    font-family: inherit;
}

/* Font Awesome icons must never inherit the Lao font */
i.fa, i.fas, i.far, i.fab, i.fa-solid, i.fa-regular, i.fa-brands {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands" !important;
    font-style: normal;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
}

i.fas, i.fa-solid { font-weight: 900 !important; }
i.far, i.fa-regular { font-weight: 400 !important; }
i.fab, i.fa-brands { font-family: "Font Awesome 6 Brands" !important; font-weight: 400 !important; }

@media print {
    * { font-family: 'Noto Sans Lao', 'Saysettha OT', 'Phetsarath OT', Arial, sans-serif; }
}


/* ============================================================
   DESIGN TOKENS
   (per-theme overrides live in themes.css via [data-theme="..."])
   ============================================================ */

:root {
    --primary-color: #2563eb;
    --primary-light: #60a5fa;
    --primary-dark: #1d4ed8;
    --success-color: #16a34a;
    --warning-color: #f59e0b;
    --danger-color: #dc2626;
    --info-color: #0891b2;
    --light-color: #f8fafc;
    --dark-color: #1e293b;
    --white: #ffffff;
    --bg-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --text-color: #1e293b;
    --text-light: #64748b;
    --border-color: #e2e8f0;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 44px -12px rgba(15, 23, 42, 0.25);

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --border-radius: 10px;

    --transition: all 0.2s ease;
    --sidebar-width: 272px;
    --sidebar-collapsed-width: 72px;
}

* {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}


/* ============================================================
   APP LAYOUT
   ============================================================ */

.app-container {
    display: flex;
    min-height: 100vh;
    overflow: hidden;
}


/* ---- Sidebar ---- */

.sidebar {
    width: var(--sidebar-width);
    background: var(--white);
    box-shadow: 1px 0 0 var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    transition: width 0.25s ease, transform 0.3s ease;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .theme-header span,
.sidebar.collapsed .user-info,
.sidebar.collapsed .btn span {
    display: none;
}

.sidebar.collapsed .nav-link {
    gap: 0;
    justify-content: center;
    padding: 12px 10px;
}

.sidebar.collapsed .nav-link i {
    width: auto;
}

.sidebar.collapsed .theme-selector {
    padding: 10px 5px;
}

.sidebar.collapsed .theme-colors {
    flex-direction: column;
    gap: 6px;
    align-items: center;
}

.sidebar.collapsed .theme-color {
    width: 22px;
    height: 22px;
}

.sidebar.collapsed .nav-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    transform: scale(0.8);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 17px;
    font-weight: 700;
    color: var(--primary-color);
}

.logo i {
    font-size: 22px;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: var(--text-light);
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: var(--light-color);
    color: var(--primary-color);
}


/* ---- Theme Selector ---- */

.theme-selector {
    padding: 14px 15px;
    border-bottom: 1px solid var(--border-color);
}

.theme-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--text-light);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.theme-header i {
    font-size: 12px;
}

.theme-colors {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.theme-color {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
    position: relative;
}

.theme-color:hover {
    transform: scale(1.12);
    box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--primary-color);
}

.theme-color.active {
    box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--primary-color);
    transform: scale(1.05);
}

.theme-color.active::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 10px;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}


/* ---- Sidebar Navigation ---- */

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 8px;
}

.nav-menu {
    list-style: none;
}

.nav-item {
    margin-bottom: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 11px 14px;
    color: var(--text-color);
    text-decoration: none;
    transition: var(--transition);
    position: relative;
    border-radius: var(--radius-sm);
    min-height: 44px;
}

.nav-link:hover {
    background: var(--light-color);
    color: var(--primary-color);
}

.nav-item.active .nav-link {
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    color: var(--white);
    box-shadow: 0 4px 12px -2px rgba(37, 99, 235, 0.4);
}

.nav-link i {
    font-size: 15px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    display: inline-block;
}

.nav-link span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
    font-weight: 500;
}

.nav-badge {
    background: var(--danger-color);
    color: var(--white);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
    min-width: 16px;
    text-align: center;
    font-weight: 700;
    flex-shrink: 0;
}

.nav-walkin-badge {
    margin-left: auto;
    font-size: 10px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
    flex-shrink: 0;
}

.nav-item.active .nav-walkin-badge {
    background: rgba(255, 255, 255, 0.28);
}


/* ---- Sidebar Footer ---- */

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    background: var(--light-color);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 15px;
    flex-shrink: 0;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-color);
}

.user-role {
    font-size: 12px;
    color: var(--text-light);
}

.btn-logout {
    width: 100%;
    background: var(--white);
    color: var(--danger-color);
    border: 1.5px solid var(--border-color);
    padding: 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
}

.btn-logout:hover {
    background: var(--danger-color);
    border-color: var(--danger-color);
    color: var(--white);
}


/* ---- Main Content ---- */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.25s ease;
    background: #f1f5f9;
}

.sidebar.collapsed + .main-content {
    margin-left: var(--sidebar-collapsed-width);
}


/* ---- Top Header ---- */

.top-header {
    background: var(--white);
    padding: 14px 28px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 16px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-color);
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    flex-shrink: 0;
}

.menu-toggle:hover {
    background: var(--light-color);
    color: var(--primary-color);
}

.page-title {
    font-size: 21px;
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}


/* ---- Clock ---- */

.clock {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--light-color);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
    color: var(--text-color);
}


/* ---- Quick Actions ---- */

.quick-actions {
    display: flex;
    gap: 8px;
}


/* ---- Notifications ---- */

.notifications {
    position: relative;
}

.notification-btn {
    background: none;
    border: none;
    font-size: 17px;
    cursor: pointer;
    color: var(--text-color);
    padding: 9px;
    border-radius: 50%;
    position: relative;
    transition: var(--transition);
}

.notification-btn:hover {
    background: var(--light-color);
    color: var(--primary-color);
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--danger-color);
    color: var(--white);
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
    font-weight: 700;
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
}

.notification-dropdown.show {
    display: block;
    animation: slideIn 0.2s ease;
}

.notification-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-header h4 {
    margin: 0;
    font-size: 15px;
    color: var(--text-color);
}

.notification-header button {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.notification-list {
    max-height: 300px;
    overflow-y: auto;
}

.no-notifications {
    padding: 30px;
    text-align: center;
    color: var(--text-light);
    font-size: 13px;
}

.notification-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.notification-item:hover {
    background: var(--light-color);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 13px;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-color);
    margin-bottom: 2px;
}

.notification-message {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 2px;
}

.notification-time {
    font-size: 11px;
    color: var(--text-light);
}


/* ============================================================
   CONTENT AREA
   ============================================================ */

.content-area {
    flex: 1;
    padding: 26px 28px;
    overflow-y: auto;
}

.tab-content {
    display: none;
    animation: fadeIn 0.25s ease;
}

.tab-content.active {
    display: block;
}


/* ---- Stats Grid ---- */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 26px;
}

.stat-card {
    background: var(--white);
    padding: 22px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 18px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
    position: relative;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-card.success { border-left: 4px solid var(--success-color); }
.stat-card.danger { border-left: 4px solid var(--danger-color); }
.stat-card.warning { border-left: 4px solid var(--warning-color); }
.stat-card.info { border-left: 4px solid var(--info-color); }

.stat-icon {
    width: 54px;
    height: 54px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--white);
    flex-shrink: 0;
}

.stat-card.success .stat-icon { background: linear-gradient(135deg, var(--success-color), #22c55e); }
.stat-card.danger .stat-icon { background: linear-gradient(135deg, var(--danger-color), #f87171); }
.stat-card.warning .stat-icon { background: linear-gradient(135deg, var(--warning-color), #fbbf24); }
.stat-card.info .stat-icon { background: linear-gradient(135deg, var(--info-color), #38bdf8); }

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-number {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-color);
    margin-bottom: 3px;
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 500;
}

.stat-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(15, 23, 42, 0.06);
}

.progress-bar {
    height: 100%;
    background: var(--primary-color);
    transition: width 1s ease;
}


/* ---- Card ---- */

.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    margin-bottom: 22px;
    overflow: hidden;
}

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.card-header h3 {
    margin: 0;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
}

.card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.card-body {
    padding: 22px;
}


/* ---- Dashboard Layout ---- */

.dashboard-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    margin-bottom: 22px;
}

.flex-1 {
    flex: 1;
}


/* ---- Room Grid ---- */

.room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.room-legend {
    display: flex;
    gap: 18px;
    margin-bottom: 18px;
    padding: 10px 14px;
    background: var(--light-color);
    border-radius: var(--radius-sm);
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-light);
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 4px;
}

.legend-color.available { background: var(--success-color); }
.legend-color.occupied { background: var(--danger-color); }
.legend-color.reserved { background: var(--warning-color); }
.legend-color.maintenance { background: #6b7280; }

.room-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 18px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1.5px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.room-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--border-color);
}

.room-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.room-card.available::before { background: var(--success-color); }
.room-card.occupied::before { background: var(--danger-color); }
.room-card.reserved::before { background: var(--warning-color); }
.room-card.maintenance::before { background: #6b7280; }

.room-number {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--text-color);
}

.room-type {
    color: var(--text-light);
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
}

.room-price {
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 14px;
    font-size: 15px;
}

.room-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    display: inline-block;
    min-width: 60px;
    text-align: center;
    white-space: nowrap;
}

.status-available { background: #dcfce7; color: #15803d; }
.status-occupied { background: #fee2e2; color: #b91c1c; }
.status-reserved { background: #fef3c7; color: #b45309; }
.status-maintenance { background: #e5e7eb; color: #4b5563; }

.room-conflict-info {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    line-height: 1.4;
}

.room-conflict-info.info-ok { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.room-conflict-info.info-warn { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }


/* ---- Badges ---- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
}

.badge-primary { background: var(--primary-color); color: var(--white); }
.badge-success { background: var(--success-color); color: var(--white); }
.badge-info { background: var(--info-color); color: var(--white); }
.badge-warning { background: var(--warning-color); color: #422006; }
.badge-danger { background: var(--danger-color); color: var(--white); }


/* ---- Buttons ---- */

.btn {
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary { background: var(--primary-color); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); }

.btn-success { background: var(--success-color); color: var(--white); }
.btn-success:hover { background: #15803d; }

.btn-warning { background: var(--warning-color); color: #422006; }
.btn-warning:hover { background: #d97706; }

.btn-danger { background: var(--danger-color); color: var(--white); }
.btn-danger:hover { background: #b91c1c; }

.btn-info { background: var(--info-color); color: var(--white); }
.btn-info:hover { background: #0e7490; }

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.btn-group {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-group .btn {
    padding: 4px 8px;
    font-size: 11px;
}


/* ---- Sidebar Overlay for Mobile ---- */

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 999;
    display: none;
}

.sidebar-overlay.show {
    display: block;
}


/* ============================================================
   ANIMATIONS
   ============================================================ */

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

@keyframes slideIn {
    from { transform: translateY(-12px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.65; }
}


/* ============================================================
   LOGIN
   ============================================================ */

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--bg-gradient);
    padding: 20px;
}

.login-card {
    background: var(--white);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    animation: slideIn 0.4s ease;
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.logo-icon {
    font-size: 46px;
    color: var(--primary-color);
    margin-bottom: 14px;
    display: block;
}

.login-header h2 {
    color: var(--dark-color);
    margin-bottom: 8px;
    font-size: 22px;
}

.login-header p {
    color: var(--text-light);
    font-size: 14px;
}

.demo-info {
    margin-top: 20px;
    padding: 14px;
    background: var(--light-color);
    border-radius: var(--radius-sm);
    font-size: 12px;
    text-align: center;
    color: var(--text-light);
    line-height: 1.8;
}


/* ============================================================
   FORMS
   ============================================================ */

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 7px;
    font-weight: 600;
    font-size: 13px;
    color: var(--dark-color);
}

.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: var(--transition);
    background: var(--white);
    color: var(--text-color);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-control:hover {
    border-color: #cbd5e1;
}

.error-message {
    color: var(--danger-color);
    font-size: 13px;
    margin-top: 10px;
    display: none;
}


/* ============================================================
   LOADING / TOASTS
   ============================================================ */

.loading-spinner {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    gap: 14px;
}

.spinner {
    width: 38px;
    height: 38px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    background: var(--white);
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    margin-bottom: 10px;
    border-left: 4px solid var(--success-color);
    animation: slideInRight 0.25s ease;
    max-width: 300px;
    font-size: 13px;
}

.toast.error { border-left-color: var(--danger-color); }
.toast.warning { border-left-color: var(--warning-color); }
.toast.info { border-left-color: var(--info-color); }


/* ============================================================
   RECEIPT
   ============================================================ */

.receipt {
    background: white;
    padding: 28px;
    border: 2px solid var(--primary-color);
    border-radius: var(--radius);
    font-family: 'Courier New', monospace;
    color: var(--text-color);
}

.receipt-header {
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 15px;
}

.receipt-title {
    font-size: 22px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.receipt-info {
    margin-bottom: 20px;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    padding: 2px 0;
}

.receipt-total {
    border-top: 2px solid var(--primary-color);
    padding-top: 10px;
    font-weight: bold;
    font-size: 17px;
}

@media print {
    body * { visibility: hidden; }
    .receipt, .receipt * { visibility: visible; }
    .receipt {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: white !important;
        color: black !important;
        border: 1px solid #000 !important;
        font-size: 12px !important;
        padding: 20px !important;
    }
    .receipt-title { color: #000 !important; font-size: 18px !important; }
    .receipt-header { border-color: #000 !important; }
    .receipt-total { border-color: #000 !important; }
    .table { font-size: 10px !important; border-collapse: collapse !important; }
    .table th, .table td { border: 1px solid #000 !important; padding: 5px !important; }
    .btn, .btn-group { display: none !important; }
    .room-status { border: 1px solid #000 !important; color: #000 !important; background: white !important; }
}


/* ============================================================
   MODAL
   ============================================================ */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.55);
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--white);
    margin: 3% auto;
    padding: 0;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    position: relative;
    animation: modalSlideIn 0.25s ease;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.close {
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #94a3b8;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    border: none;
    background: none;
}

.close:hover {
    background: var(--danger-color);
    color: var(--white);
}

.modal form {
    padding: 22px;
}


/* ============================================================
   USER PERMISSIONS UI
   ============================================================ */

.perm-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 7px 0;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-light);
    border-bottom: 1px solid #f1f5f9;
}

.perm-row:last-child { border-bottom: none; }

.perm-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.perm-row:hover {
    background: var(--light-color);
    border-radius: var(--radius-sm);
}

.perm-row span {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

#permBlock label.perm-row span small {
    font-size: 10px;
}

.perm-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 700;
    margin: 1px 3px 2px 0;
}

.perm-chip.perm-ok, .perm-ok { background: #dcfce7; color: #15803d; }
.perm-chip.perm-no, .perm-no { background: #fee2e2; color: #b91c1c; }

.perm-chip.perm-admin, .perm-admin {
    background: linear-gradient(135deg, var(--warning-color), #f97316);
    color: #fff;
    font-weight: 700;
}


/* ============================================================
   TABLE
   ============================================================ */

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: var(--white);
}

.table th,
.table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    word-wrap: break-word;
}

.table th {
    background: var(--light-color);
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.4px;
    white-space: nowrap;
}

.table td {
    color: #334155;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background: rgba(37, 99, 235, 0.04);
}

.table .col-id { width: 80px; }
.table .col-name { width: 150px; }
.table .col-phone { width: 120px; }
.table .col-room { width: 100px; }
.table .col-date { width: 100px; }
.table .col-amount { width: 120px; text-align: right; }
.table .col-status { width: 100px; text-align: center; }
.table .col-actions { width: 150px; text-align: center; }


/* ============================================================
   MISC COMPONENTS
   ============================================================ */

.sales-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sales-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.sales-label { font-size: 13px; color: var(--text-light); }
.sales-value { font-weight: 700; color: var(--primary-color); }

.reservation-item {
    background: var(--white);
    border: 1px solid var(--border-color);
    padding: 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    border-left: 3px solid var(--primary-color);
}

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

.guest-name { font-weight: 700; font-size: 14px; color: var(--text-color); }
.room-info { color: var(--text-light); font-size: 13px; margin-top: 2px; }
.date-range { color: var(--primary-color); font-size: 12px; font-weight: 600; }

.empty-state {
    text-align: center;
    color: var(--text-light);
    padding: 40px 20px;
    background: var(--light-color);
    border-radius: var(--radius);
    border: 2px dashed var(--border-color);
    font-size: 13px;
}

.text-muted { color: var(--text-light) !important; font-size: 11px; }

.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 150px;
}

.currency { font-family: 'Courier New', monospace; font-weight: bold; color: var(--success-color); }
.date-format { font-family: 'Courier New', monospace; font-size: 12px; }


/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }
    .sidebar.show {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }
    .main-content {
        margin-left: 0;
    }
    .menu-toggle {
        display: block;
    }
    .dashboard-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .content-area {
        padding: 18px 16px;
    }
    .top-header {
        padding: 12px 16px;
    }
    .header-right {
        gap: 8px;
    }
    .clock span {
        display: none;
    }
    .quick-actions .btn span {
        display: none;
    }
    .quick-actions .btn {
        padding: 8px 10px;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }
    .stat-card {
        padding: 16px;
        gap: 12px;
    }
    .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    .stat-number {
        font-size: 24px;
    }
    .page-title {
        font-size: 17px;
    }
    .room-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
    .room-legend {
        justify-content: center;
    }
    .table th, .table td {
        padding: 9px 6px;
        font-size: 12px;
    }
    .btn-group .btn {
        padding: 3px 6px;
        font-size: 10px;
    }
    .room-status {
        font-size: 10px;
        padding: 3px 8px;
    }
    .modal-content {
        width: 95%;
        margin: 5% auto;
    }
    .modal form {
        padding: 18px;
    }
    .modal-header {
        padding: 15px 18px;
    }
    .card-header {
        padding: 15px 16px;
    }
    .card-body {
        padding: 16px;
    }
    .theme-colors {
        gap: 6px;
    }
    .theme-color {
        width: 22px;
        height: 22px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 85vw;
        max-width: 320px;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .card-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .card-actions {
        justify-content: center;
    }
    .notification-dropdown {
        width: calc(100vw - 32px);
        right: -6px;
    }
    .login-card {
        padding: 28px 22px;
    }
}
