/* ============================================================
   GameZone Admin Dashboard - Custom Styles
   Color Scheme:
   Primary: #4361ee | Secondary: #3f37c9 | Success: #4caf50
   Danger: #f44336 | Warning: #ff9800 | Info: #00bcd4
   ============================================================ */

:root {
    --primary: #4361ee;
    --primary-dark: #3a56d4;
    --secondary: #3f37c9;
    --success: #4caf50;
    --danger: #f44336;
    --warning: #ff9800;
    --info: #00bcd4;
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --navbar-height: 60px;
    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #6c757d;
    --border-color: #e0e0e0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-bs-theme="dark"] {
    --bg-body: #0f0f23;
    --bg-card: #1a1a2e;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0b0;
    --border-color: #2a2a3e;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
}

/* ---- Global ---- */
* { box-sizing: border-box; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* ---- Navbar ---- */
.bg-primary-custom {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%) !important;
    height: var(--navbar-height);
    box-shadow: var(--shadow-md);
    z-index: 1040;
}
.navbar-brand { font-size: 1.1rem; letter-spacing: 0.5px; }
.sidebar-toggle { border: none; font-size: 1.2rem; }

/* ---- Sidebar ---- */
.sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--navbar-height));
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    z-index: 1030;
    transition: var(--transition);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}
.sidebar-inner::-webkit-scrollbar { width: 4px; }
.sidebar-inner::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

.sidebar-header { border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar.collapsed .sidebar-header { padding: 10px 0; }
.sidebar.collapsed .sidebar-header h6, .sidebar.collapsed .sidebar-header small { display: none; }
.avatar-circle {
    width: 64px; height: 64px; border-radius: 50%;
    background: rgba(255,255,255,0.18);
    border: 2.5px solid rgba(255,255,255,0.35);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto;
    color: #fff;
}
.sidebar.collapsed .avatar-circle { width: 36px; height: 36px; }
.sidebar.collapsed .avatar-circle i { font-size: 1rem !important; }

/* ---- Sidebar Nav ---- */
.sidebar-nav {
    list-style: none; padding: 8px 0; margin: 0; flex: 1;
}
.sidebar-nav .nav-item { margin: 2px 8px; }
.sidebar-nav .nav-link {
    display: flex; align-items: center; padding: 10px 14px;
    color: rgba(255,255,255,0.7); text-decoration: none;
    border-radius: 8px; transition: var(--transition);
    white-space: nowrap; position: relative;
}
.sidebar-nav .nav-link:hover {
    color: #fff; background: rgba(255,255,255,0.1);
}
.sidebar-nav .nav-item.active .nav-link {
    color: #fff; background: var(--primary);
    box-shadow: 0 2px 8px rgba(67,97,238,0.4);
}
.nav-icon { width: 22px; text-align: center; margin-right: 12px; font-size: 1rem; }
.nav-text { font-size: 0.9rem; font-weight: 500; }
.shortcut-badge {
    margin-left: auto; font-size: 0.65rem;
    background: rgba(255,255,255,0.1); padding: 2px 6px;
    border-radius: 4px; color: rgba(255,255,255,0.4);
}
.sidebar.collapsed .nav-text,
.sidebar.collapsed .shortcut-badge { display: none; }
.sidebar.collapsed .nav-icon { margin-right: 0; font-size: 1.2rem; }
.sidebar.collapsed .nav-link { justify-content: center; padding: 12px; }

.sidebar-footer { border-top: 1px solid rgba(255,255,255,0.1); margin-top: auto; }
.sidebar.collapsed .sidebar-footer small span { display: none; }

/* ---- Main Content ---- */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--navbar-height);
    padding: 24px;
    min-height: calc(100vh - var(--navbar-height));
    transition: var(--transition);
}
.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-collapsed); }

/* ---- Cards ---- */
.metric-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.metric-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.metric-card .metric-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
}
.metric-card .metric-value { font-size: 1.8rem; font-weight: 700; line-height: 1.2; }
.metric-card .metric-label { font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.metric-card .metric-trend { font-size: 0.75rem; font-weight: 600; }

.bg-primary-light { background: rgba(67,97,238,0.12); color: var(--primary); }
.bg-success-light { background: rgba(76,175,80,0.12); color: var(--success); }
.bg-info-light { background: rgba(0,188,212,0.12); color: var(--info); }
.bg-warning-light { background: rgba(255,152,0,0.12); color: var(--warning); }
.bg-danger-light { background: rgba(244,67,54,0.12); color: var(--danger); }
.bg-secondary-light { background: rgba(63,55,201,0.12); color: var(--secondary); }

/* ---- Chart Cards ---- */
.chart-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    height: 100%;
}
.chart-card .chart-title {
    font-size: 0.95rem; font-weight: 600; margin-bottom: 16px;
    display: flex; align-items: center; justify-content: space-between;
}

/* ---- Tables ---- */
.table-card {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}
.table-card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    display: flex; align-items: center; justify-content: space-between;
}
.table-card .card-header h5 { margin: 0; font-size: 1rem; font-weight: 600; }
.table-card .card-body { padding: 16px 20px; }

.table > thead > tr > th {
    font-size: 0.78rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.5px; color: var(--text-secondary);
    border-bottom-width: 1px;
}
.table > tbody > tr > td { vertical-align: middle; font-size: 0.88rem; }

/* ---- Badges/Status ---- */
.badge-status {
    padding: 4px 10px; border-radius: 6px; font-size: 0.75rem; font-weight: 600;
}
.badge-paid { background: rgba(76,175,80,0.15); color: #2e7d32; }
.badge-unpaid { background: rgba(244,67,54,0.15); color: #c62828; }
.badge-pending { background: rgba(255,152,0,0.15); color: #e65100; }
.badge-checked-in { background: rgba(0,188,212,0.15); color: #00838f; }
.badge-checked-out { background: rgba(108,117,125,0.15); color: #495057; }
.badge-overtime { background: rgba(244,67,54,0.15); color: #c62828; }
.badge-online { background: rgba(76,175,80,0.15); color: #2e7d32; }
.badge-offline { background: rgba(108,117,125,0.15); color: #495057; }

/* ---- Activity Feed ---- */
.activity-feed { max-height: 400px; overflow-y: auto; }
.activity-item {
    display: flex; align-items: flex-start; padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
    width: 8px; height: 8px; border-radius: 50%;
    margin-top: 6px; margin-right: 12px; flex-shrink: 0;
}
.activity-dot.checkin { background: var(--success); }
.activity-dot.checkout { background: var(--info); }
.activity-dot.billing { background: var(--warning); }
.activity-dot.login { background: var(--primary); }
.activity-content { flex: 1; }
.activity-text { font-size: 0.85rem; margin-bottom: 2px; }
.activity-time { font-size: 0.7rem; color: var(--text-secondary); }

/* ---- Loading Overlay ---- */
.loading-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3); z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(2px);
}

/* ---- Toast Customization ---- */
.toast { border-radius: 8px; box-shadow: var(--shadow-md); }
.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-info { border-left: 4px solid var(--info); }

/* ---- Pulse Animation ---- */
.pulse { animation: pulse 2s infinite; }
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ---- Timer Display ---- */
.timer-display { font-family: 'Courier New', monospace; font-weight: 700; font-size: 1.1rem; }
.timer-display.overtime { color: var(--danger); }
.timer-display.normal { color: var(--success); }

/* ---- Quick Action Buttons ---- */
.btn-action {
    border-radius: 8px; padding: 6px 14px; font-size: 0.8rem;
    font-weight: 500; transition: var(--transition);
}
.btn-action:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }

/* ---- Search Autocomplete ---- */
.autocomplete-dropdown {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 0 0 8px 8px; max-height: 300px; overflow-y: auto;
    z-index: 1050; box-shadow: var(--shadow-md); display: none;
}
.autocomplete-item {
    padding: 8px 14px; cursor: pointer; font-size: 0.88rem;
    border-bottom: 1px solid var(--border-color);
}
.autocomplete-item:hover { background: rgba(67,97,238,0.08); }
.autocomplete-item:last-child { border-bottom: none; }

/* ---- Misc ---- */
.page-header { margin-bottom: 24px; }
.page-header h4 { font-weight: 700; margin-bottom: 4px; }
.page-header .breadcrumb { font-size: 0.8rem; margin-bottom: 0; }

.modal-header { border-bottom: 1px solid var(--border-color); }
.modal-footer { border-top: 1px solid var(--border-color); }

.stat-mini { font-size: 0.75rem; color: var(--text-secondary); }
.fw-600 { font-weight: 600; }
.text-primary-custom { color: var(--primary) !important; }

.empty-state {
    text-align: center; padding: 40px 20px; color: var(--text-secondary);
}
.empty-state i { font-size: 3rem; margin-bottom: 12px; opacity: 0.3; }

.skeleton {
    background: linear-gradient(90deg, var(--border-color) 25%, transparent 50%, var(--border-color) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px; height: 20px;
}
@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---- Responsive ---- */
@media (max-width: 992px) {
    .sidebar { left: calc(-1 * var(--sidebar-width)); }
    .sidebar.mobile-open { left: 0; }
    .main-content { margin-left: 0 !important; }
    .metric-card .metric-value { font-size: 1.4rem; }
}

@media (max-width: 576px) {
    .main-content { padding: 16px 12px; }
    .metric-card { padding: 14px; }
}

/* ---- Login Page ---- */
.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}
.login-card {
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%; max-width: 420px;
    padding: 40px;
}
.login-card .login-logo {
    font-size: 2.5rem; color: var(--primary);
    margin-bottom: 10px;
}
.login-card h3 { font-weight: 700; margin-bottom: 6px; }
.login-card .form-control {
    border-radius: 8px; padding: 10px 14px;
    border: 1px solid var(--border-color);
}
.login-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67,97,238,0.15);
}
.login-card .btn-primary {
    background: var(--primary); border: none;
    border-radius: 8px; padding: 10px;
    font-weight: 600;
}
.login-card .btn-primary:hover { background: var(--primary-dark); }

/* ---- Print Styles ---- */
@media print {
    .sidebar, .navbar, .sidebar-toggle, #toastContainer, .btn, .loading-overlay { display: none !important; }
    .main-content { margin: 0 !important; padding: 20px !important; }
    .metric-card, .chart-card, .table-card { box-shadow: none; border: 1px solid #ddd; }
}
