/* Oasis Petroleum Limited ERP Stylesheet */
:root {
    --oasis-primary: #0b2545;
    --oasis-primary-dark: #07192f;
    --oasis-primary-light: #133b6b;
    --oasis-accent: #f59e0b;
    --oasis-accent-hover: #d97706;
    --oasis-bg: #f8fafc;
    --oasis-surface: #ffffff;
    --oasis-border: #e2e8f0;
    --oasis-text: #1e293b;
    --oasis-muted: #64748b;
    --oasis-success: #10b981;
    --oasis-danger: #ef4444;
    --oasis-info: #0284c7;
    --sidebar-width: 270px;
}

body {
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--oasis-bg);
    color: var(--oasis-text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Base Wrapper */
#wrapper {
    position: relative;
    width: 100%;
}

/* Sidebar Styling */
#sidebar-wrapper {
    min-height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #07192f 0%, #0b2545 100%);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), margin-left 0.3s ease;
    z-index: 1045;
    flex-shrink: 0;
}

.brand-section {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-logo-badge {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

.sidebar-heading {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    padding: 0.85rem 1.25rem 0.35rem;
    font-weight: 700;
}

.sidebar-nav .nav-link {
    color: #cbd5e1;
    font-size: 0.92rem;
    font-weight: 500;
    padding: 0.7rem 1.25rem;
    margin: 2px 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

.sidebar-nav .nav-link i {
    width: 24px;
    font-size: 1.1rem;
    margin-right: 10px;
    color: #94a3b8;
    transition: all 0.2s ease;
}

.sidebar-nav .nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-nav .nav-link:hover i {
    color: var(--oasis-accent);
}

.sidebar-nav .nav-link.active {
    color: #ffffff;
    background: linear-gradient(90deg, #133b6b 0%, #1e4f8a 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-weight: 600;
}

.sidebar-nav .nav-link.active i {
    color: var(--oasis-accent);
}

/* Page content wrapper */
#page-content-wrapper {
    flex: 1;
    min-width: 0;
    transition: all 0.3s ease;
}

/* Top Navbar */
.top-navbar {
    background: #ffffff;
    border-bottom: 1px solid var(--oasis-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    padding: 0.65rem 1.25rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

/* Branch Context Banner */
.branch-context-alert {
    background: linear-gradient(90deg, #eff6ff 0%, #f0fdf4 100%);
    border-left: 4px solid var(--oasis-info);
    border-radius: 8px;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Modern Card Styling */
.card-stat {
    border-radius: 14px;
    border: 1px solid var(--oasis-border);
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.card-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.stat-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.stat-icon-primary { background: #e0f2fe; color: #0284c7; }
.stat-icon-success { background: #dcfce7; color: #16a34a; }
.stat-icon-warning { background: #fef3c7; color: #d97706; }
.stat-icon-danger { background: #fee2e2; color: #dc2626; }
.stat-icon-purple { background: #f3e8ff; color: #9333ea; }

/* Custom Tables */
.table-custom {
    border-collapse: separate;
    border-spacing: 0;
}

.table-custom thead th {
    background-color: #f8fafc;
    color: #475569;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--oasis-border);
    white-space: nowrap;
}

.table-custom tbody td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9rem;
}

.table-custom tbody tr:hover {
    background-color: #f8fafc;
}

/* Role Badges */
.badge-role-super_admin { background: #7c3aed; color: #fff; }
.badge-role-dealer_admin { background: #0284c7; color: #fff; }
.badge-role-rsm { background: #d97706; color: #fff; }
.badge-role-area_manager { background: #0d9488; color: #fff; }
.badge-role-sr { background: #e11d48; color: #fff; }

/* =========================================================================
   MOBILE RESPONSIVE & APP-LIKE OPTIMIZATIONS
   ========================================================================= */

/* Backdrop overlay when mobile drawer is open */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-backdrop.show {
    display: block;
    opacity: 1;
}

/* Mobile Bottom Navigation Bar (Phone App style) */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 62px;
    background: #ffffff;
    border-top: 1px solid var(--oasis-border);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
    z-index: 1025;
    justify-content: space-around;
    align-items: center;
    padding: 0 6px;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--oasis-muted);
    text-decoration: none;
    font-size: 0.68rem;
    font-weight: 500;
    flex: 1;
    height: 100%;
    padding: 4px 0;
    transition: color 0.15s ease;
}

.mobile-nav-item i {
    font-size: 1.25rem;
    margin-bottom: 2px;
}

.mobile-nav-item.active {
    color: var(--oasis-primary);
    font-weight: 700;
}

.mobile-nav-item.active i {
    color: var(--oasis-accent);
}

.mobile-nav-action-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff !important;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    margin-top: -16px;
    transition: transform 0.2s ease;
}

.mobile-nav-action-btn:hover {
    transform: scale(1.05);
}

.mobile-nav-action-btn i {
    font-size: 1.3rem;
    margin-bottom: 0 !important;
}

/* Responsive Breakpoints */
@media (max-width: 991.98px) {
    #sidebar-wrapper {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
        box-shadow: none;
    }

    #sidebar-wrapper.mobile-show {
        transform: translateX(0);
        box-shadow: 8px 0 25px rgba(0, 0, 0, 0.25);
    }

    /* Padding bottom on main content so sticky mobile nav doesn't cover content */
    main {
        padding-bottom: 80px !important;
    }

    .mobile-bottom-nav {
        display: flex;
    }

    .top-navbar {
        padding: 0.5rem 0.75rem;
    }

    .top-navbar h5 {
        font-size: 1.05rem;
    }

    /* Larger touch targets for mobile buttons */
    .btn {
        min-height: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .btn-sm {
        min-height: 32px;
    }

    .table-custom tbody td, .table-custom thead th {
        padding: 0.65rem 0.65rem;
        font-size: 0.85rem;
    }

    .card-body {
        padding: 1rem;
    }

    .stat-icon-wrapper {
        width: 42px;
        height: 42px;
        font-size: 1.2rem;
    }
}

@media (max-width: 575.98px) {
    .container-fluid {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .card-stat h4, .card-stat h3 {
        font-size: 1.25rem;
    }

    .branch-context-alert {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    /* Mobile Quick action buttons */
    .btn-group .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* Printable document styling */
@media print {
    #sidebar-wrapper, .top-navbar, .no-print, .btn, .flash-message, .branch-context-alert, .mobile-bottom-nav, .sidebar-backdrop {
        display: none !important;
    }
    #page-content-wrapper {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    body {
        background-color: #fff !important;
        font-size: 11pt;
    }
    .print-box {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
}

/* Attendance Selfie & Camera Styles */
.selfie-thumbnail {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--oasis-info);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}
.selfie-thumbnail:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
}
.hover-scale {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.hover-scale:hover {
    transform: scale(1.12);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18) !important;
}
.cursor-pointer {
    cursor: pointer !important;
}
.selfie-preview-wrapper {
    position: relative;
    display: inline-block;
}
.selfie-camera-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    border: 2px dashed rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    width: 210px;
    height: 250px;
}

