/* site.css */

:root {
    /* Luxury Light Theme / Glassmorphism Colors */
    --primary-color: #a855f7; /* Neon Purple */
    --primary-hover: #9333ea;
    --secondary-color: #06b6d4; /* Neon Blue / Cyan */
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    
    --bg-color: #f8fafc; /* Slate 50 (Very light gray-blue) */
    --surface-color: rgba(255, 255, 255, 0.7); /* Translucent White Glass */
    --text-primary: #0f172a; /* Slate 900 */
    --text-secondary: #64748b; /* Slate 500 */
    --border-color: rgba(15, 23, 42, 0.08); /* Transparent subtle dark border */
    
    /* Sidebar / Mobile Nav Navigation Colors */
    --sidebar-bg: rgba(255, 255, 255, 0.8);
    --sidebar-header-bg: rgba(248, 250, 252, 0.9);
    --sidebar-text: #0f172a;
    --sidebar-text-muted: #64748b;
    --sidebar-hover: rgba(15, 23, 42, 0.04);
    --sidebar-border: rgba(15, 23, 42, 0.08);
    --sidebar-active-bg: linear-gradient(135deg, #a855f7, #06b6d4);
    
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 8px 32px 0 rgba(31, 38, 135, 0.06);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.08);
    --radius-md: 16px;
    --radius-lg: 24px;
    --transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;

    /* Adaptive backgrounds and frame details */
    --body-desktop-bg: radial-gradient(circle at top right, #e2e8f0, #cbd5e1);
    --phone-frame-border: #cbd5e1;
    --phone-frame-bg: #ffffff;
    --more-drawer-bg: rgba(255, 255, 255, 0.95);
    --more-drawer-border: rgba(15, 23, 42, 0.08);
    --drawer-handle-color: rgba(0, 0, 0, 0.15);
    --drawer-item-bg: rgba(0, 0, 0, 0.02);
    --drawer-item-border: rgba(0, 0, 0, 0.04);
    --input-bg: rgba(255, 255, 255, 0.9);
    --input-border: #cbd5e1;
    --floating-btn-border: #ffffff;
    --phone-indicator-color: rgba(0, 0, 0, 0.2);
    --scrollbar-thumb: rgba(0, 0, 0, 0.15);
}


* {
    font-family: 'Cairo', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    transition: var(--transition);
    overflow-x: hidden;
}

/* Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-left: 1px solid var(--sidebar-border); /* RTL */
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: fixed;
    height: 100vh;
    z-index: 1000;
    right: 0;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--sidebar-border);
    background-color: var(--sidebar-header-bg);
}

.sidebar-header h3 {
    margin: 0;
    font-weight: 800;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.sidebar-menu {
    padding: 16px;
    list-style: none;
    margin: 0;
    overflow-y: auto;
    flex: 1;
}

.sidebar-menu::-webkit-scrollbar {
    width: 6px;
}

.sidebar-menu::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 10px;
}

.sidebar-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.sidebar-menu li {
    margin-bottom: 8px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: var(--transition);
    font-weight: 600;
}

.sidebar-menu a i {
    margin-left: 12px; /* RTL */
    font-size: 1.2rem;
    width: 20px;
    text-align: center;
}

.sidebar-menu a:hover, .sidebar-menu a.active {
    background: var(--sidebar-active-bg);
    color: #ffffff !important;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
    transform: translateX(-5px); /* RTL */
}

/* Main Content */
.main-content {
    flex: 1;
    margin-right: 260px; /* RTL */
    padding: 24px 32px;
    transition: var(--transition);
    min-height: 100vh;
}

/* Topbar */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding: 16px 24px;
    background-color: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.topbar-title h2 {
    margin: 0;
    font-weight: 700;
    color: var(--text-primary);
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.theme-toggle:hover {
    transform: scale(1.1);
    color: var(--primary-color);
}

/* Cards */
.card-custom {
    background-color: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 24px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    margin-bottom: 24px;
}

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

/* Buttons */
.btn-primary-custom {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 4px 10px rgba(67, 97, 238, 0.3);
}

.btn-primary-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(67, 97, 238, 0.4);
    color: white;
}

/* Tables */
.table-custom {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    color: var(--text-primary);
}

.table-custom th {
    background-color: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 12px 16px;
    border-bottom: 2px solid var(--border-color);
}

.table-custom tbody tr {
    background-color: var(--surface-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.table-custom tbody tr:hover {
    transform: scale(1.01);
    box-shadow: var(--shadow-md);
    z-index: 2;
    position: relative;
}

.table-custom td {
    padding: 16px;
    vertical-align: middle;
    color: var(--text-primary);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.table-custom td:first-child {
    border-right: 1px solid var(--border-color);
    border-top-right-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
}

.table-custom td:last-child {
    border-left: 1px solid var(--border-color);
    border-top-left-radius: var(--radius-md);
    border-bottom-left-radius: var(--radius-md);
}

/* Inputs */
.form-control-custom {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    transition: var(--transition);
}

.form-control-custom:focus {
    background-color: var(--surface-color);
    border-color: var(--primary-color);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
    outline: none;
}

/* Select */
.form-select.form-control-custom {
    background-color: var(--bg-color);
    color: var(--text-primary);
}

/* Modal override */
.modal-content {
    background-color: var(--surface-color);
    color: var(--text-primary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}
.modal-header, .modal-footer {
    border-color: var(--border-color);
}
.text-danger { color: var(--danger-color) !important; }
.text-success { color: var(--success-color) !important; }
.text-warning { color: var(--warning-color) !important; }/* Sidebar Collapse */
.sidebar.collapsed { width: 80px; }
.sidebar.collapsed .sidebar-header h3 span { display: none; }
.sidebar.collapsed .sidebar-header { justify-content: center; }
.sidebar.collapsed .sidebar-header i { margin: 0; font-size: 1.8rem; }
.sidebar.collapsed .sidebar-menu a span { display: none; }
.sidebar.collapsed .sidebar-menu a i.fa-chevron-down { display: none; }
.sidebar.collapsed .sidebar-menu a { justify-content: center; padding: 12px 0; }
.sidebar.collapsed .sidebar-menu a i:first-child { margin: 0; font-size: 1.4rem; }
.sidebar.collapsed .sidebar-menu ul.collapse { display: none !important; }

.main-content.expanded { margin-right: 80px; } /* RTL */

/* Hover fix for sidebar submenu items */
.sidebar-menu a:hover, .sidebar-menu a.active {
    background: var(--sidebar-active-bg);
    color: white !important;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
    transform: translateX(-5px); /* RTL */
}

.sidebar-menu a.text-secondary:hover,
.sidebar-menu a.text-primary:hover,
.sidebar-menu a.active.text-secondary,
.sidebar-menu a.active.text-primary {
    color: white !important;
}


/* Mobile Responsive Tables -> Cards */
@media (max-width: 991.98px) {
    .table-responsive {
        border: none !important;
        background: transparent !important;
    }
    .table-custom thead {
        display: none !important;
    }
    .table-custom tbody tr {
        display: flex;
        flex-direction: column;
        background-color: var(--surface-color);
        margin-bottom: 15px;
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-sm);
        border: 1px solid var(--border-color);
        padding: 8px;
    }
    .table-custom tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 8px;
        border-bottom: 1px dashed var(--border-color);
        text-align: right;
        font-size: 0.95rem;
    }
    .table-custom tbody td:last-child {
        border-bottom: none;
    }
    .table-custom tbody td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--text-secondary);
        text-align: right;
        flex-shrink: 0;
        margin-left: 15px;
    }
    .table-custom tbody td[data-label="إجراءات"], .table-custom tbody td[data-label="الموقع (GPS)"] {
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px;
        background-color: rgba(0,0,0,0.02);
        border-radius: 8px;
        margin-top: 5px;
        padding: 10px 8px;
    }
    .table-custom tbody td[data-label="إجراءات"]::before, .table-custom tbody td[data-label="الموقع (GPS)"]::before {
        display: none;
    }
}


/* Glassmorphism Classes for Cards and UI */
.topbar {
    background: var(--surface-color) !important;
    backdrop-filter: blur(20px) saturate(190%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(190%) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--shadow-md) !important;
}

.card-custom {
    background: var(--surface-color) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--shadow-md) !important;
}

.table-custom tbody tr {
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid var(--border-color) !important;
}

/* Mobile Bottom Navigation Bar (Glassmorphic) */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--sidebar-bg) !important;
    backdrop-filter: blur(24px) saturate(190%) !important;
    -webkit-backdrop-filter: blur(24px) saturate(190%) !important;
    border-top: 1px solid var(--border-color) !important;
    box-shadow: var(--shadow-md) !important;
    z-index: 1030;
    padding-bottom: env(safe-area-inset-bottom);
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
}

.mobile-bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    padding: 8px 12px;
    border-radius: 16px;
    position: relative;
}

.mobile-bottom-nav a.active {
    color: #ffffff !important;
}

.mobile-bottom-nav a.active i {
    color: var(--primary-color) !important;
    text-shadow: 0 0 12px rgba(168, 85, 247, 0.6);
    transform: translateY(-2px);
}

.mobile-bottom-nav a i {
    font-size: 1.4rem;
    margin-bottom: 4px;
    transition: var(--transition);
}

.mobile-bottom-nav a span {
    font-size: 0.72rem;
    font-weight: 700;
}

/* Middle floating action button */
.mobile-bottom-nav .floating-btn {
    top: -24px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)) !important;
    border: 4px solid var(--floating-btn-border) !important;
    box-shadow: 0 8px 20px rgba(168, 85, 247, 0.4) !important;
    width: 58px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50% !important;
    color: #ffffff !important;
    transition: var(--transition);
}
.mobile-bottom-nav .floating-btn:active {
    transform: scale(0.9) translateY(-18px) !important;
}

/* slide-up more drawer for mobile */
.mobile-more-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 80vh;
    background: var(--more-drawer-bg);
    backdrop-filter: blur(30px) saturate(200%);
    -webkit-backdrop-filter: blur(30px) saturate(200%);
    border-top: 1px solid var(--more-drawer-border);
    border-top-left-radius: 32px;
    border-top-right-radius: 32px;
    z-index: 1040;
    box-shadow: var(--shadow-lg);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
    padding: 24px 20px 40px 20px;
}

.mobile-more-drawer.open {
    transform: translateY(0);
}

.drawer-handle {
    width: 40px;
    height: 5px;
    background: var(--drawer-handle-color);
    border-radius: 10px;
    margin: -10px auto 20px auto;
}

.drawer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 10px;
}

.drawer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 8px;
    background: var(--drawer-item-bg);
    border: 1px solid var(--drawer-item-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
}

.drawer-item:active {
    background: rgba(255, 255, 255, 0.08);
    transform: scale(0.95);
}

.drawer-item i {
    font-size: 1.6rem;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.drawer-item span {
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
}

/* Sidebar Backdrop */
.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1035; /* Just below the drawer (1040) but above content */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.sidebar-backdrop.show {
    opacity: 1;
    visibility: visible;
}

/* Custom buttons and interactive element haptics */
.btn, .btn-primary-custom, .nav-link, .drawer-item, .mobile-bottom-nav a {
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.btn:active, .btn-primary-custom:active, .nav-link:active, .drawer-item:active, .mobile-bottom-nav a:active {
    transform: scale(0.96) !important;
}

/* Form Custom Styling */
.form-control-custom {
    background-color: var(--input-bg) !important;
    border: 1px solid var(--input-border) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-md) !important;
}

.form-control-custom:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.25) !important;
    background-color: var(--surface-color) !important;
}

.btn-primary-custom {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)) !important;
    border: none !important;
    border-radius: var(--radius-md) !important;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3) !important;
}
.btn-primary-custom:hover {
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.45) !important;
}

/* Smooth Tap Ripple Effect */
.ripple {
    position: absolute;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: scale(0);
    animation: ripple-effect 0.6s ease-out;
    pointer-events: none;
}
@keyframes ripple-effect {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Hide bottom navigation and drawer on desktop */
@media (min-width: 992px) {
    .mobile-bottom-nav, .mobile-more-drawer {
        display: none !important;
    }
}

/* Mobile Responsive Adjustments */
@media (max-width: 991.98px) {
    .dashboard-container {
        width: 100% !important;
        display: block !important;
    }
    .sidebar {
        display: none !important; /* Hide sidebar entirely since we use bottom nav and drawer */
    }
    .main-content {
        width: 100% !important;
        margin-right: 0 !important;
        padding: 16px 16px 95px 16px !important; /* Extra padding bottom for bottom nav */
        min-height: 100vh;
    }
    .topbar {
        margin-bottom: 20px !important;
        padding: 12px 16px !important;
    }
    /* Hide topbar sidebar toggler on mobile */
    #sidebarToggle {
        display: none !important;
    }
}

/* Print Rules */
@media print {
    .sidebar { display: none !important; }
    .topbar { display: none !important; }
    .main-content { margin-right: 0 !important; width: 100% !important; padding: 0 !important; }
    .d-print-none { display: none !important; }
    body { background-color: white !important; color: black !important; }
    .card-custom { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* Page Animations */
.fade-in {
    animation: pageFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes pageFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

