/* BOS - Bed Occupancy System Styles */

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

:root {
    --bg: #f1f5f9;
    --card: #ffffff;
    --primary: #4f73e9;
    --primary-light: #eff6ff;
    --success: #16a34a;
    --success-light: #f0fdf4;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --warning: #ca8a04;
    --warning-light: #fefce8;
    --text: #334155;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
    --female: #be185d;
    --male: #1d4ed8;
}

body {
    font-family: 'Heebo', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

.dashboard {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.25rem;
}

/* ============================================
   HEADER - Blue Style
   ============================================ */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--primary);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.25rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 1.5rem;
}

.logo h1 {
    font-size: 1.2rem;
    font-weight: 600;
    color: inherit;
}

.logo span {
    font-size: 0.8rem;
    opacity: 0.85;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.live-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

.datetime {
    text-align: left;
}

.time {
    font-size: 1.25rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.date {
    font-size: 0.75rem;
    opacity: 0.85;
}

/* ============================================
   STATS GRID
   ============================================ */
.stats-grid,
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    background: var(--card);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    border-right: 4px solid var(--primary);
    box-shadow: var(--shadow);
}

.stat-card.total { border-right-color: var(--primary); }
.stat-card.available { border-right-color: var(--success); }
.stat-card.occupied { border-right-color: var(--danger); }
.stat-card.rate { border-right-color: var(--warning); }
.stat-card.female { border-right-color: var(--female); }
.stat-card.male { border-right-color: var(--male); }

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin: 0.25rem 0;
    line-height: 1;
}

.stat-card.total .stat-value { color: var(--primary); }
.stat-card.available .stat-value { color: var(--success); }
.stat-card.occupied .stat-value { color: var(--danger); }
.stat-card.rate .stat-value { color: var(--warning); }
.stat-card.female .stat-value { color: var(--female); }
.stat-card.male .stat-value { color: var(--male); }

.stat-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ============================================
   MAIN CONTENT LAYOUT
   ============================================ */
.content {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.25rem;
}

/* ============================================
   SECTION CARD
   ============================================ */
.section-card {
    background: var(--card);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.section-title {
    font-size: 0.95rem;
    font-weight: 600;
}

/* ============================================
   FILTER TABS
   ============================================ */
.filter-tabs {
    display: flex;
    gap: 0.25rem;
}

.filter-tab {
    padding: 0.4rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* ============================================
   DEPARTMENTS LIST (Dashboard)
   ============================================ */
.departments-list,
.departments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.875rem;
    padding: 1rem;
}

.dept-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.dept-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
}

.dept-card.critical {
    border-color: var(--danger);
    background: var(--danger-light);
}

.dept-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.dept-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.dept-badge,
.status-badge {
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.dept-badge.good,
.status-badge.good {
    background: var(--success-light);
    color: var(--success);
}

.dept-badge.warning,
.status-badge.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.dept-badge.critical,
.status-badge.critical {
    background: var(--danger-light);
    color: var(--danger);
}

.dept-stats {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 0.75rem;
}

.dept-stat {
    text-align: center;
}

.dept-stat-num,
.dept-num {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.dept-stat-num.available { color: var(--success); }
.dept-stat-num.occupied { color: var(--danger); }

.dept-stat-label,
.dept-num-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Subtle colored dot */
.dept-stat.available .dept-num::before {
    content: '●';
    font-size: 0.5rem;
    color: var(--success);
    margin-left: 0.25rem;
    vertical-align: middle;
}

.dept-stat.occupied .dept-num::before {
    content: '●';
    font-size: 0.5rem;
    color: var(--danger);
    margin-left: 0.25rem;
    vertical-align: middle;
}

.dept-gender {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.gender-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.gender-f,
.female { color: var(--female); }
.gender-m,
.male { color: var(--male); }

/* ============================================
   ROOMS GRID (Index - Room Management)
   ============================================ */
.rooms-grid {
    padding: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.room-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    transition: all 0.2s;
    background: var(--card);
}

.room-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
}

.room-card.critical {
    border-color: var(--danger);
    background: var(--danger-light);
}

.room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.room-number {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--primary);
}

.room-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.room-badge.female {
    background: #fdf2f8;
    color: var(--female);
}

.room-badge.male {
    background: var(--primary-light);
    color: var(--male);
}

.room-badge.mixed {
    background: #f3e5f5;
    color: #7c3aed;
}

.room-stats {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.75rem;
}

.room-stat {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
}

.room-stat-num {
    font-size: 1.5rem;
    font-weight: 700;
}

.room-stat-num.available { color: var(--success); }
.room-stat-num.occupied { color: var(--danger); }

.room-stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-bar {
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}

.progress-fill.good { background: var(--success); }
.progress-fill.warning { background: var(--warning); }
.progress-fill.critical { background: var(--danger); }

/* ============================================
   BEDS LIST
   ============================================ */
.beds-list {
    display: grid;
    gap: 0.5rem;
}

.bed-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: var(--bg);
    border-radius: 6px;
    border: 1px solid var(--border);
    transition: all 0.2s;
    cursor: pointer;
}

.bed-item:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.bed-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.bed-label {
    flex: 1;
    font-size: 0.85rem;
    cursor: pointer;
    user-select: none;
}

.bed-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.bed-status.occupied {
    background: var(--danger-light);
    color: var(--danger);
}

.bed-status.available {
    background: var(--success-light);
    color: var(--success);
}

/* ============================================
   ASSIGNMENT BUTTONS
   ============================================ */
.assignment-section {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.assignment-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.assignment-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.btn-assign {
    padding: 0.5rem 1rem;
    border: 2px solid;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    font-family: inherit;
    transition: all 0.2s;
}

.btn-female {
    border-color: var(--female);
    color: var(--female);
    background: white;
}

.btn-female.active {
    background: var(--female);
    color: white;
}

.btn-female:hover:not(.active) {
    background: #fdf2f8;
}

.btn-male {
    border-color: var(--male);
    color: var(--male);
    background: white;
}

.btn-male.active {
    background: var(--male);
    color: white;
}

.btn-male:hover:not(.active) {
    background: var(--primary-light);
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sidebar .section-card,
.sidebar-card {
    background: var(--card);
    border-radius: 10px;
    padding: 1rem;
}

.sidebar .section-title,
.sidebar-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.875rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

/* ============================================
   GENDER STATS
   ============================================ */
.gender-stats,
.gender-row {
    display: flex;
    justify-content: space-around;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.gender-box {
    flex: 1;
    text-align: center;
    padding: 0.875rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.gender-box.female {
    border-color: #fbcfe8;
    background: #fdf2f8;
}

.gender-box.male {
    border-color: #bfdbfe;
    background: var(--primary-light);
}

.gender-circle,
.gender-num {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.5rem;
    font-size: 1.75rem;
    font-weight: 700;
}

.gender-circle.female {
    background: #fdf2f8;
    border: 2px solid var(--female);
    color: var(--female);
}

.gender-circle.male {
    background: var(--primary-light);
    border: 2px solid var(--male);
    color: var(--male);
}

.gender-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ============================================
   REPORTS / SPECIAL ROOMS
   ============================================ */
.report-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.report-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

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

.report-value {
    font-weight: 600;
    color: var(--primary);
}

/* ============================================
   ALERTS
   ============================================ */
.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 280px;
    overflow-y: auto;
}

.alert-item {
    display: flex;
    gap: 0.6rem;
    padding: 0.6rem;
    background: var(--bg);
    border-radius: 6px;
    font-size: 0.8rem;
    border-right: 3px solid;
}

.alert-item.critical { border-right-color: var(--danger); }
.alert-item.warning { border-right-color: var(--warning); }
.alert-item.info { border-right-color: var(--primary); }

.alert-icon { font-size: 1rem; }
.alert-content { flex: 1; }
.alert-title { font-weight: 500; margin-bottom: 0.2rem; }
.alert-desc { color: var(--text-secondary); font-size: 0.75rem; }
.alert-time { font-size: 0.7rem; color: var(--text-secondary); }

/* ============================================
   ACTION BUTTONS
   ============================================ */
.actions-grid,
.actions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: white;
    color: var(--text);
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

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

.action-btn.primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.action-btn.primary:hover {
    background: #3d5fd4;
}

.action-btn.success {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.action-btn.success:hover {
    background: #15803d;
}

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

.action-btn.danger:hover {
    background: #b91c1c;
}

.action-btn.full {
    grid-column: span 2;
}

/* ============================================
   FAB (Floating Action Button)
   ============================================ */
.fab {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    transition: all 0.2s;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.fab.nav {
    left: auto;
    right: 1.5rem;
    background: var(--success);
}

/* ============================================
   MENU OVERLAY
   ============================================ */
.menu-overlay {
    position: fixed;
    inset: 0;
    background: white;
    z-index: 200;
    display: none;
    overflow-y: auto;
}

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

.menu-content {
    max-width: 400px;
    margin: 0 auto;
    padding: 1.5rem;
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border);
}

.menu-header h2 {
    font-weight: 600;
    font-size: 1.25rem;
}

.menu-close {
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.menu-close:hover {
    background: var(--bg);
}

.menu-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: 12px;
}

.menu-stat-card {
    text-align: center;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.menu-stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.menu-stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.menu-title {
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.rooms-menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.room-menu-btn {
    padding: 0.75rem;
    border: 2px solid var(--primary);
    background: white;
    color: var(--primary);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    font-family: inherit;
    transition: all 0.2s;
}

.room-menu-btn:hover {
    background: var(--primary-light);
}

.room-menu-btn.active {
    background: var(--primary);
    color: white;
}

/* ============================================
   NOTIFICATION
   ============================================ */
.notification {
    position: fixed;
    bottom: 1.5rem;
    right: 50%;
    transform: translateX(50%);
    background: var(--text);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(50%) translateY(0);
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1100px) {
    .content {
        grid-template-columns: 1fr;
    }

    .sidebar {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .sidebar .section-card,
    .sidebar-card {
        flex: 1;
        min-width: 250px;
    }
}

@media (max-width: 768px) {
    .stats-grid,
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .header {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }

    .header-info {
        width: 100%;
        justify-content: space-between;
    }

    .departments-list,
    .departments-grid,
    .rooms-grid {
        grid-template-columns: 1fr;
    }

    .fab {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
        bottom: 1rem;
        left: 1rem;
    }

    .fab.nav {
        right: 1rem;
    }
}

/* ============================================
   PRINT
   ============================================ */
@media print {
    body { background: white; }
    .action-btn, .filter-tabs, .fab { display: none; }
    .header { background: var(--text); }
}
