/* Custom Styles */
body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--ma-bg);
    color: var(--ma-text);
    overflow-x: hidden;
}

/* Force white background for date/month inputs to match text fields */
input[type="date"], 
input[type="month"] {
    background-color: #ffffff !important;
}

.navbar-custom {
    background-color: #343a40;
    color: white;
    font-weight: 500;
}

.container {
    margin-top: 20px;
    font-size: 16px;
    line-height: 1.6;
}

/* Theme-Aware Surfaces */
.card, .modal-content, .dropdown-menu {
    background-color: var(--ma-card-bg) !important;
    color: var(--ma-text) !important;
    border-color: var(--ma-border) !important;
}

.table {
    color: var(--ma-text) !important;
}

.text-muted {
    color: var(--ma-text-muted) !important;
}

.bg-white {
    background-color: var(--ma-card-bg) !important;
}

.bg-light {
    background-color: var(--ma-bg) !important;
}

.border {
    border-color: var(--ma-border) !important;
}

/* Common Form Stylings */
.form-label {
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}
.form-control, .form-select {
    font-size: 0.85rem;
}
.form-control::placeholder {
    color: #adb5bd;
    opacity: 0.5;
}
/* Nav hover */
.dropdown:hover .dropdown-menu {
    display: block;
    margin-top: 0; /* Align with parent */
}

/* Table Styling */
.table {
    font-size: 1rem;
}

.table thead {
    background-color: #343a40;
    color: white;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: #f8f9fa;
}

/* Search Box Styling */
#search-box {
    padding: 10px;
    font-size: 1rem;
    border-radius: 5px;
    border: 1px solid #ccc;
}

/* Pagination Styling */
.btn-outline-primary {
    border-radius: 5px;
}

/* Email field error border, send verificatio email error */
.error-border {
    border: 2px solid red !important;
    box-shadow: 0 0 5px red !important;
}


/* Style for the active tab */
.active-tab {
    background-color: var(--ma-primary-color) !important;
    color: white !important;
}


/* Passport suggestions dropdown */
#passport-suggestions.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;      /* .show => block */
    z-index: 2000;
    max-height: 240px;
    overflow-y: auto;
}
#passport-suggestions.dropdown-menu.show { display: block; }

/* Always-visible custom typeahead menu (no Bootstrap dropdown needed) */
.typeahead-menu{
    position:absolute; top:100%; left:0; right:0;
    background:#fff; border:1px solid rgba(0,0,0,.125);
    border-radius:.375rem; box-shadow:0 .5rem 1rem rgba(0,0,0,.15);
    z-index:3000; display:none; max-height:260px; overflow-y:auto;
    }
    .typeahead-menu.show{ display:block; }
    .typeahead-item{ padding:.5rem .75rem; cursor:pointer; }
    .typeahead-item:hover,.typeahead-item.active{
    background: var(--bs-primary, var(--ma-primary-color)); color:#fff;
}

.typeahead-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1050;
    background: #fff;
    border: 1px solid #ced4da;
    border-top: none;
    max-height: 250px;
    overflow-y: auto;
    display: none;
}

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

.typeahead-item {
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.typeahead-item:hover,
.typeahead-item.active {
    background-color: var(--ma-primary-color);
    color: #fff;
}



/* Unified input size */
.payroll-input {
    height: 36px;
    padding: 6px 10px;
    font-size: 0.9rem;
    border-radius: 6px;
}

/* Highlight loan if active */
.loan-active {
    border-color: var(--ma-danger-color);
    background-color: #fff5f5;
}

/* Global Focus Utilities */
.payroll-input:focus {
    box-shadow: 0 0 0 0.1rem rgba(var(--ma-primary-rgb), 0.15);
}

/* ==========================================================================
   GLOBAL FORM COMPONENTS (Unified Design System)
   ========================================================================== */

/* Standard Inputs & Selects */
.form-control, .form-select {
    height: 48px !important;
    border-radius: 10px !important;
    border: 1px solid #e0e6ed;
    padding: 0.6rem 1rem;
    transition: all 0.2s ease-in-out;
    background-color: #fff;
    color: #333;
}

/* Focused State */
.form-control:focus, .form-select:focus {
    box-shadow: 0 0 0 4px rgba(var(--ma-primary-rgb), 0.08) !important; /* Soft Indigo Glow */
    border-color: var(--ma-primary-color) !important;
    background-color: #fcfdfe;
    outline: none;
}

/* Primary Button Standardization */
.btn-primary {
    height: 48px;
    border-radius: 10px !important;
    font-weight: 500 !important;
    font-size: 0.95rem;
    padding: 0 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    background-color: var(--ma-primary-color) !important;
    border-color: var(--ma-primary-color) !important;
    color: #fff !important;
}

.btn-primary:hover {
    background-color: var(--ma-primary-hover) !important;
    border-color: var(--ma-primary-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--ma-primary-rgb), 0.2);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Smaller Buttons for specific contexts */
.btn-primary.btn-sm {
    height: 38px;
    padding: 0 1rem;
    font-size: 0.85rem;
}

/* Global Placeholder Styling */
::placeholder {
    font-size: 0.85rem !important;
    opacity: 0.25 !important;
    font-weight: 400 !important;
    color: #333 !important;
}

/* Browser-specific overrides */
::-webkit-input-placeholder { font-size: 0.85rem !important; opacity: 0.25 !important; }
::-moz-placeholder { font-size: 0.85rem !important; opacity: 0.25 !important; }
:-ms-input-placeholder { font-size: 0.85rem !important; opacity: 0.25 !important; }

/* ==========================================================================
   SIDEBAR NAVIGATION (Tabs & Filter Buttons)
   ========================================================================== */

.nav-item .option-btn, 
.nav-item .btn-sidebar {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border-radius: 10px !important;
    border: none !important;
    text-align: left !important;
    padding: 0.7rem 1rem !important;
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}

.nav-item .option-btn:hover,
.nav-item .btn-sidebar:hover {
    transform: translateX(5px) !important;
    background-color: #f1f5f9 !important;
    color: var(--ma-primary-color) !important;
}

.nav-item .option-btn.active,
.nav-item .btn-sidebar.active,
.nav-item .btn-primary.active, /* For those using direct Bootstrap classes */
.nav-item a.btn-primary {
    background-color: var(--ma-primary-color) !important; /* Indigo primary */
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(var(--ma-primary-rgb), 0.25) !important;
}

.nav-item .option-btn.active i,
.nav-item .btn-sidebar.active i {
    color: #ffffff !important;
    opacity: 1 !important;
}

.nav-item .option-btn i.bi-chevron-right,
.nav-item .btn-sidebar i.bi-chevron-right {
    font-size: 0.75rem;
    opacity: 0.5;
    transition: transform 0.2s ease;
}

.nav-item .option-btn:hover i.bi-chevron-right,
.nav-item .btn-sidebar:hover i.bi-chevron-right {
    transform: translateX(2px);
    opacity: 1;
}


/* ==========================================================================
   OPERATIONAL STATUS BUTTONS (Clean Box-styled Actions)
   ========================================================================== */

.btn-status {
    min-width: 75px !important;
    border-radius: 6px !important; 
    font-size: 0.725rem !important;
    font-weight: 500 !important;
    padding: 4px 10px !important;
    letter-spacing: 0.3px;
    border: 1px solid transparent !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    text-transform: uppercase; 
}

.btn-status-in { 
    background-color: #ecfdf5 !important; 
    border: 1px solid var(--ma-success-color) !important; 
    color: var(--ma-success-color) !important; 
}
.btn-status-out { 
    background-color: #fffbeb !important; 
    border: 1px solid var(--ma-warning-color) !important; 
    color: var(--ma-warning-color) !important; 
}
.btn-status-complete { 
    background-color: #eef2ff !important; 
    border: 1px solid var(--ma-primary-color) !important; 
    color: var(--ma-primary-hover) !important; 
}
.btn-status-delete { 
    background-color: #fef2f2 !important; 
    border: 1px solid var(--ma-danger-color) !important; 
    color: var(--ma-danger-color) !important; 
}

.btn-status:hover {
    transform: translateY(-1px) !important;
    color: #ffffff !important;
    border-color: transparent !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1) !important;
}

.btn-status-in:hover { background-color: var(--ma-success-color) !important; }
.btn-status-out:hover { background-color: var(--ma-warning-color) !important; }
.btn-status-complete:hover { background-color: var(--ma-primary-color) !important; }
.btn-status-delete:hover { background-color: var(--ma-danger-color) !important; }

.btn-status:active {
    transform: translateY(0) !important;
}


/* ==========================================================================
   DATE / MONTH INPUT — Placeholder vs. Selected colour
   Applied globally so all date & month inputs across the app behave the same.
   ========================================================================== */

/* Empty / placeholder state: soft, muted hint colour */
input[type="date"]::-webkit-datetime-edit,
input[type="month"]::-webkit-datetime-edit,
input[type="date"]::-webkit-datetime-edit-placeholder,
input[type="month"]::-webkit-datetime-edit-placeholder {
    color: rgba(71, 85, 105, 0.35);
    font-size: 0.82rem;
    font-weight: 400;
}

/* Once a value is chosen (.has-value toggled by scripts.js), use clean text colour */
input[type="date"].has-value::-webkit-datetime-edit,
input[type="month"].has-value::-webkit-datetime-edit {
    color: #334155;
}


/* ==========================================================================
   FILTER BAR UTILITIES
   Shared by Dashboard (History Tracking) and Transactions List pages.
   ========================================================================== */

.filter-label {
    font-size: .72rem;
    font-weight: 700;
    color: var(--ma-primary-color);
    text-transform: uppercase;
    margin-bottom: .4rem;
    display: block;
}

.filter-input {
    border-radius: 8px;
    font-size: .85rem;
    border: 1px solid #e5e7eb;
    padding: .5rem .75rem;
    background: #fdfdff;
}

.filter-input:focus {
    border-color: var(--ma-primary-color);
    box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}

.rounded-8 {
    border-radius: 8px !important;
}


/* Utility to remove background from status buttons initially (while allowing hover fill) */
.btn-status.no-bg:not(:hover) {
    background-color: transparent !important;
}
/* Custom Layout Utility for 20/80 Split */
@media (min-width: 992px) {
    .col-custom-sidebar {
        flex: 0 0 20% !important;
        max-width: 20% !important;
    }
    .col-custom-content {
        flex: 0 0 80% !important;
        max-width: 80% !important;
    }
}

/* Fallback for smaller screens to match Bootstrap MD (3/9) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .col-custom-sidebar {
        flex: 0 0 25% !important;
        max-width: 25% !important;
    }
    .col-custom-content {
        flex: 0 0 75% !important;
        max-width: 75% !important;
    }
}

/* ─── SEAMLESS UI ENHANCEMENTS ─── */

/* 1. Global Page/Content Transitions */
@keyframes contentFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-content, .modern-table-container, .page-container {
    animation: contentFadeIn 0.35s ease-out forwards;
}

/* 2. Micro-Interactions: Sidebar Active Indicator */
.option-btn {
    position: relative;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.option-btn:hover {
    transform: translateX(4px);
    background-color: rgba(var(--ma-primary-rgb), 0.05) !important;
}

.option-btn.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 3px;
    background: #fff; /* Match text color on primary bg */
    border-radius: 0 4px 4px 0;
    animation: indicatorIn 0.3s ease-out;
}

.option-btn:not(.active).btn-light:hover {
    background-color: #f3f4f6 !important;
}

@keyframes indicatorIn {
    from { height: 0; opacity: 0; }
    to { height: 60%; opacity: 1; }
}

/* 3. Glassmorphism for Top Navbar */
.darwish-navbar {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* 4. Smart Hover Effects for Cards */
.card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.03) !important;
}

/* ==========================================================================
   MOBILE-SPECIFIC OVERRIDES (< 768px)
   ========================================================================== */

@media (max-width: 767.98px) {
    /* 1. Sidebar to Horizontal Scroller */
    .col-custom-sidebar {
        padding-bottom: 1rem;
    }
    
    .col-custom-sidebar .nav {
        flex-direction: row !important;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 5px;
        gap: 8px !important;
    }

    .col-custom-sidebar .nav-item {
        flex: 0 0 auto;
        width: auto !important;
    }

    .col-custom-sidebar .option-btn {
        width: max-content !important;
        padding: 0.5rem 1rem !important;
        font-size: 0.75rem !important;
    }

    /* Hide chevron and active indicators on mobile to save space */
    .col-custom-sidebar .option-btn i.bi-chevron-right,
    .col-custom-sidebar .option-btn::before {
        display: none !important;
    }

    /* 2. Compact Containers */
    .container-fluid {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    /* 3. Responsive Tables with Smaller Text */
    .table th, .table td {
        font-size: 0.75rem !important;
        padding: 8px 4px !important;
    }

    .table thead th {
        font-size: 0.7rem !important;
    }

    /* 4. Responsive Modals */
    .modal-dialog {
        margin: 0.5rem !important;
    }

    /* 5. Utility hiding */
    .mobile-hide {
        display: none !important;
    }

    /* 6. Form Adjustments */
    .form-control, .form-select, .btn-primary {
        height: 42px !important;
        font-size: 0.85rem !important;
    }

    /* 7. Employee Update Strips (Payroll) */
    .employee-strip .row > [class^="col-lg-"] {
        margin-bottom: 1rem;
        border-left: none !important;
        padding-left: 12px !important;
    }
    .employee-strip .row > [class^="col-lg-"]:last-child {
        margin-bottom: 0;
    }
}
