/* =====================================================
   LEAD CRM GLOBAL STYLES & MOBILE RESPONSIVE SYSTEM
   ===================================================== */

html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    margin-bottom: 60px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Focus outline glow */
.btn:focus, 
.btn:active:focus, 
.btn-link.nav-link:focus, 
.form-control:focus, 
.form-select:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem #090d16, 0 0 0 0.25rem #6366f1 !important;
}

/* =====================================================
   CUSTOM DROPDOWN ARROW & SELECT STYLING
   ===================================================== */

select,
.form-select,
.dark-form-select {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23818cf8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    background-size: 18px 18px !important;
    padding-right: 44px !important;
    cursor: pointer !important;
}

/* High-contrast dropdown option items */
select option,
.form-select option,
.dark-form-select option {
    background-color: #0f172a !important;
    color: #ffffff !important;
    padding: 12px 16px !important;
    font-size: 14.5px !important;
}

/* =====================================================
   LIGHT FORM INPUTS (AddLead, AssignLead, etc.)
   ===================================================== */

.add-lead-container .form-control,
.add-lead-container .form-select,
.assign-lead-container .form-control,
.assign-lead-container .form-select,
.light-form-card .form-control,
.light-form-card .form-select {
    background-color: #ffffff !important;
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
    border: 1.5px solid #cbd5e1 !important;
    font-weight: 600 !important;
}

.add-lead-container .form-control::placeholder,
.assign-lead-container .form-control::placeholder,
.light-form-card .form-control::placeholder {
    color: #64748b !important;
    opacity: 1 !important;
}

/* =====================================================
   DARK FORM INPUTS (Login, ForgotPassword, AddManager)
   ===================================================== */

.login-card .form-control,
.forgot-card .form-control,
.glass-form-card .form-control,
.dark-form-card .form-control,
input.dark-form-input,
textarea.dark-form-input,
select.dark-form-select {
    background-color: rgba(15, 23, 42, 0.75) !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    border: 1.5px solid rgba(255, 255, 255, 0.16) !important;
    font-weight: 600 !important;
}

.login-card .form-control::placeholder,
.forgot-card .form-control::placeholder,
.glass-form-card .form-control::placeholder,
input.dark-form-input::placeholder {
    color: rgba(203, 213, 225, 0.75) !important;
    opacity: 1 !important;
}

/* =====================================================
   AUTOFILL OVERRIDES FOR LIGHT & DARK CONTAINERS
   ===================================================== */

.login-card input:-webkit-autofill,
.forgot-card input:-webkit-autofill,
.glass-form-card input:-webkit-autofill {
    -webkit-text-fill-color: #ffffff !important;
    -webkit-box-shadow: 0 0 0px 1000px #0f172a inset !important;
    transition: background-color 5000s ease-in-out 0s;
}

.add-lead-container input:-webkit-autofill,
.assign-lead-container input:-webkit-autofill {
    -webkit-text-fill-color: #0f172a !important;
    -webkit-box-shadow: 0 0 0px 1000px #ffffff inset !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Validation summary fixes */
.alert-danger:empty,
.validation-summary-valid,
.validation-summary-valid * {
    display: none !important;
}

/* =====================================================
   TABLE RESPONSIVENESS & MOBILE OVERFLOW SCROLL
   ===================================================== */

.table-responsive,
.glass-table-wrapper {
    width: 100%;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    border-radius: 14px;
}

/* Custom sleek scrollbars for responsive tables */
.table-responsive::-webkit-scrollbar,
.glass-table-wrapper::-webkit-scrollbar {
    height: 6px;
    width: 6px;
}

.table-responsive::-webkit-scrollbar-track,
.glass-table-wrapper::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 10px;
}

.table-responsive::-webkit-scrollbar-thumb,
.glass-table-wrapper::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.5);
    border-radius: 10px;
}

.table-responsive::-webkit-scrollbar-thumb:hover,
.glass-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.8);
}

/* =====================================================
   NO-SCROLL MOBILE STACKED CARD TABLES (@media max-width 767px)
   ===================================================== */

@media (max-width: 767px) {
    .table.mobile-card-view thead {
        display: none !important;
    }

    .table.mobile-card-view tbody,
    .table.mobile-card-view tr {
        display: block !important;
        width: 100% !important;
    }

    .table.mobile-card-view tr {
        background: rgba(15, 23, 42, 0.75) !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        border-radius: 16px !important;
        margin-bottom: 14px !important;
        padding: 16px !important;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3) !important;
    }

    .table.mobile-card-view td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 8px 0 !important;
        border-bottom: 1px dashed rgba(255, 255, 255, 0.08) !important;
        font-size: 14px !important;
        color: #ffffff !important;
        text-align: right !important;
    }

    .table.mobile-card-view td:last-child {
        border-bottom: none !important;
        padding-top: 12px !important;
        justify-content: flex-start !important;
    }

    .table.mobile-card-view td[data-label]::before {
        content: attr(data-label);
        font-weight: 700;
        text-transform: uppercase;
        font-size: 11px;
        letter-spacing: 0.05em;
        color: #94a3b8;
        margin-right: 12px;
        text-align: left;
    }

    /* Prevent iOS auto-zoom on input focus */
    input, 
    select, 
    textarea,
    .form-control,
    .form-select,
    .dark-form-input,
    .dark-form-select {
        font-size: 16px !important;
    }

    /* Container padding adjustments */
    .container, 
    .container-fluid, 
    .form-container, 
    .add-lead-container, 
    .assign-lead-container,
    .forgot-container, 
    .login-container {
        padding-left: 14px !important;
        padding-right: 14px !important;
    }

    /* Stack header contents vertically on small screens */
    .dashboard-header, 
    .glass-form-header,
    .glass-card-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }

    /* Action buttons expand to full width on mobile */
    .form-actions {
        flex-direction: column !important;
        width: 100% !important;
    }

    .form-actions button,
    .form-actions a,
    .btn-login-submit,
    .btn-submit,
    .btn-create-lead,
    .btn-submit-assign,
    .btn-cancel-lead,
    .btn-cancel-assign,
    .btn-save-employee {
        width: 100% !important;
        justify-content: center !important;
    }
}