/* 
   Safa 2.0 Enterprise Design System 
   Theme: Aqua-Elite (Modern Glassmorphism)
   Optimized for All Devices
*/

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #0061ff;
    --primary-gradient: linear-gradient(135deg, #0061ff 0%, #60efff 100%);
    --deep-blue: #0f172a;
    --sidebar-bg: #1e293b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --card-radius: 24px;
}

/* Global Reset & Typography */
* {
    box-sizing: border-box;
}

body {
    background: #f8fafc;
    background-image: radial-gradient(at 0% 0%, rgba(0, 97, 255, 0.05) 0, transparent 50%),
                      radial-gradient(at 50% 0%, rgba(96, 239, 255, 0.05) 0, transparent 50%);
    color: #1e293b;
    font-family: 'Outfit', sans-serif;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    line-height: 1.5;
}

/* --- LAYOUTS --- */

.admin-body {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
}

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

/* --- SIDEBAR --- */

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: white;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 2050;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 10px 0 30px rgba(0,0,0,0.1);
}

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

.sidebar.collapsed .sidebar-header span,
.sidebar.collapsed .menu-label,
.sidebar.collapsed .sidebar-menu a span {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 20px 0;
}

.sidebar.collapsed .sidebar-menu a {
    justify-content: center;
    margin: 0 10px 8px 10px;
}

.sidebar.collapsed .sidebar-menu a i {
    margin: 0;
    font-size: 1.4rem;
}

.sidebar-header {
    padding: 30px 24px;
    font-size: 1.25rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
}

.sidebar-header i {
    font-size: 1.5rem;
    filter: drop-shadow(0 0 8px rgba(0, 97, 255, 0.5));
}

.sidebar-menu {
    padding: 10px 15px;
}

.menu-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #64748b;
    margin: 24px 0 12px 15px;
    font-weight: 700;
    letter-spacing: 2px;
}

.sidebar-menu a {
    color: #94a3b8;
    text-decoration: none;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 16px;
    margin-bottom: 4px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.sidebar-menu a i {
    font-size: 1.25rem;
}

.sidebar-menu a:hover {
    color: white;
    background: rgba(255,255,255,0.05);
}

.sidebar-menu a.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 10px 20px -5px rgba(0, 97, 255, 0.4);
}

/* --- SAFA 2.0: MODERN KPI GRADIENTS --- */
.bg-purple-gradient { background: linear-gradient(135deg, #818cf8 0%, #a78bfa 100%) !important; }
.bg-green-gradient  { background: linear-gradient(135deg, #34d399 0%, #059669 100%) !important; }
.bg-cyan-gradient   { background: linear-gradient(135deg, #22d3ee 0%, #0891b2 100%) !important; }
.bg-orange-gradient { background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%) !important; }
.bg-pink-gradient   { background: linear-gradient(135deg, #f472b6 0%, #db2777 100%) !important; }
.bg-violet-gradient { background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%) !important; }

/* --- CARDS & PANELS --- */

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--card-radius);
    box-shadow: var(--glass-shadow);
    padding: 24px;
    margin-bottom: 24px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.08);
}

/* --- TOP NAVBAR --- */

.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    margin-bottom: 30px;
    position: sticky;
    top: 20px;
    z-index: 1000;
}

.btn-drawer-toggle {
    background: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--deep-blue);
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-drawer-toggle:hover {
    background: #f1f5f9;
}

/* --- COMPONENTS --- */

.avatar-initials {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    background: var(--primary-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 97, 255, 0.2);
}

.kpi-card {
    position: relative;
    overflow: hidden;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 800;
    margin: 10px 0;
    background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.kpi-icon {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    opacity: 0.8;
}

/* --- TABLES --- */

.table-glass {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.table-glass thead th {
    background: transparent;
    padding: 12px 20px;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    border: none;
}

.table-glass tbody td {
    padding: 16px 20px;
    background: white;
    border: none;
    vertical-align: middle;
}

.table-glass tbody tr td:first-child {
    border-radius: 16px 0 0 16px;
}

.table-glass tbody tr td:last-child {
    border-radius: 0 16px 16px 0;
}

.table-glass tbody tr {
    transition: transform 0.2s ease;
}

.table-glass tbody tr:hover {
    transform: scale(1.005);
    z-index: 10;
}

/* --- FORMS --- */

.form-control-elite {
    background: #f1f5f9;
    border: 2px solid transparent;
    border-radius: 16px;
    padding: 12px 20px;
    transition: all 0.3s ease;
    font-weight: 400;
}

.form-control-elite:focus {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 97, 255, 0.1);
    outline: none;
}

/* --- RESPONSIVENESS --- */

@media (max-width: 991px) {
    .sidebar {
        left: calc(-1 * var(--sidebar-width));
        border-radius: 0 32px 32px 0;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .main-content {
        margin-left: 0;
        padding: 15px;
        padding-top: 5px; /* Compact for top-nav shadow */
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(15, 23, 42, 0.6);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        z-index: 2000;
        display: none;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .sidebar.active ~ .sidebar-overlay,
    .sidebar.active + .sidebar-overlay {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }
    
    .top-nav {
        top: 10px;
        margin-bottom: 20px;
        border-radius: 18px;
    }

    .kpi-card {
        padding: 20px;
    }

    .table-glass thead {
        display: none; /* Hide header on mobile if needed, but we keep it for scrolling */
    }

    .table-glass {
        min-width: 800px; /* Ensure table has enough room to scroll horizontally */
    }
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

/* --- ANIMATIONS --- */

.fade-in {
    animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* --- LOGIN PAGE --- */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-glass-card {
    width: 100%;
    max-width: 450px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    padding: 40px;
    animation: fadeIn 0.8s ease-out;
}

.user-type-group {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.user-type-btn {
    flex: 1;
    background: #f1f5f9;
    border: 2px solid transparent;
    padding: 15px 10px;
    border-radius: 20px;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #64748b;
}

.user-type-btn:hover {
    background: #e2e8f0;
}

.user-type-btn.active {
    background: white;
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 10px 15px -3px rgba(0, 97, 255, 0.1);
    transform: translateY(-2px);
}

.user-type-btn i {
    display: block;
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.user-type-btn span {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.login-logo {
    font-size: 3rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.mobile-bottom-nav {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    height: 70px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 2000;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.mobile-bottom-nav a {
    color: #94a3b8;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 600;
    gap: 4px;
}

.mobile-bottom-nav a.active {
    color: white;
}

.mobile-bottom-nav a i {
    font-size: 1.5rem;
}

/* --- SAFA 2.0: HIGH CONTRAST UTILITIES --- */

.bg-deep-blue {
    background-color: var(--deep-blue) !important;
}

.bg-primary-gradient {
    background: var(--primary-gradient) !important;
}

.bg-danger-gradient {
    background: linear-gradient(135deg, #ef4444 0%, #991b1b 100%) !important;
}

.bg-success-gradient {
    background: linear-gradient(135deg, #10b981 0%, #064e3b 100%) !important;
}

.bg-white-10 {
    background-color: rgba(255, 255, 255, 0.15) !important; /* Slightly more visible */
}

.text-white-50 {
    color: rgba(255, 255, 255, 0.8) !important; /* Increased for visibility */
}

/* Force visibility for muted text inside glass cards */
.glass-card .text-muted,
.glass-card .extra-small.text-muted {
    color: #475569 !important;
    opacity: 1 !important; /* Kill dangerous opacity-50 */
}

.text-deep-blue {
    color: var(--deep-blue) !important;
}

/* Ensure white text is always white when intended */
.text-white {
    color: #ffffff !important;
}

/* Badge Contrast Fixes */
.badge.bg-light {
    background-color: #e2e8f0 !important; /* Darker than standard bg-light */
}

.badge.bg-light.text-primary {
    color: var(--primary) !important;
}

.badge.bg-light.text-deep-blue {
    color: var(--deep-blue) !important;
}

.badge.bg-primary-soft {
    background-color: rgba(0, 97, 255, 0.15) !important;
    color: var(--primary) !important;
}

/* KPI Contrast Fixes */
.kpi-value {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

/* Sidebar Active/Overlay Logic Fix */
@media (max-width: 991px) {
    .sidebar-overlay.active {
        display: block !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
}

.ls-1 { letter-spacing: 1px; }
.fw-900 { font-weight: 900; }
.fw-800 { font-weight: 800; }
.extra-small { font-size: 0.72rem; }
.ls-sm { letter-spacing: 0.5px; }

/* Force show opacity-50 if I specifically need it but want it visible */
.glass-card .opacity-50 {
    opacity: 0.75 !important;
}

/* Pulse Indicator Accessibility */
.pulse-indicator {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}

/* --- MOBILE-FIRST SPACING & CONTRAST --- */

@media (max-width: 575px) {
    .glass-card {
        padding: 18px !important;
        margin-bottom: 16px !important;
        border-radius: 20px !important;
    }
    
    .top-nav {
        padding: 12px 15px !important;
        margin-bottom: 15px !important;
    }
}

/* Fix for invisible placeholders in glass cards */
::placeholder {
    color: #64748b !important;
    opacity: 1 !important;
}

.form-control-elite::placeholder {
    color: #475569 !important;
}

/* Sidebar Specificity Hardening */
.sidebar.active {
    left: 0 !important;
    box-shadow: 20px 0 50px rgba(0,0,0,0.4) !important;
}

.sidebar-overlay.active {
    z-index: 2045 !important;
}

/* --- RESPONSIVE UTILITIES --- */
@media (max-width: 575px) {
    .w-100-sm {
        width: 100% !important;
    }
}

.shadow-primary {
    box-shadow: 0 10px 15px -3px rgba(0, 97, 255, 0.2) !important;
}

.btn-group-sm .btn {
    padding: 0.25rem 0.5rem;
}

.btn-elite-secondary {
    background-color: #f1f5f9 !important;
    color: var(--deep-blue) !important;
    font-weight: 800 !important;
    border: 1px solid #e2e8f0 !important;
    transition: all 0.3s ease !important;
}

.btn-elite-secondary:hover {
    background-color: #e2e8f0 !important;
    color: var(--primary) !important;
    border-color: var(--primary) !important;
}

/* Global High-Contrast Modal Actions */
[data-bs-dismiss="modal"].btn-light,
[data-bs-dismiss="modal"].btn-light-secondary,
[data-bs-dismiss="modal"].btn-dark.text-muted {
    background-color: #f1f5f9 !important;
    color: var(--deep-blue) !important;
    font-weight: 800 !important;
    border: 1px solid #e2e8f0 !important;
    transition: all 0.3s ease !important;
}

[data-bs-dismiss="modal"].btn-light:hover,
[data-bs-dismiss="modal"].btn-light-secondary:hover,
[data-bs-dismiss="modal"].btn-dark.text-muted:hover {
    background-color: #e2e8f0 !important;
    color: var(--primary) !important;
    border-color: var(--primary) !important;
}




/* --- SAFA 2.0: FLOATING ACTION BUTTONS --- */
.floating-whatsapp {
    position: fixed;
    bottom: 110px;
    right: 25px;
    width: 60px;
    height: 60px;
    background: #25d366;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 10px 25px rgba(37, 211, 102, 0.4);
    z-index: 1900;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-decoration: none;
}

.floating-whatsapp:hover {
    transform: scale(1.1) rotate(10deg);
    color: white;
    box-shadow: 0 15px 30px rgba(37, 211, 102, 0.5);
}

.floating-whatsapp::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #25d366;
    z-index: -1;
    animation: pulse-whatsapp 2s infinite;
}

@keyframes pulse-whatsapp {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* --- NOTIFICATION ENHANCEMENTS --- */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.bell-icon-container {
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.bell-icon-container:hover {
    transform: scale(1.1);
}
