/* ================================================================
   GLOBAL THEME — Multi-Domain Palette System
   ================================================================
   This project supports three distinct brand themes based on the domain:
   1. Essellent (Sapphire Blue) - Default
   2. Shreejee (Emerald Green)
   3. Anand (Modern Crimson)
   ================================================================ */

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

:root {
    /* ── DEFAULT THEME (Essellent - Sapphire Blue) ── */
    --color-primary: #0369a1;
    --color-primary-dark: #075985;
    --color-primary-light: #0284c7;
    --color-primary-rgb: 3, 105, 161;

    --color-bg-1: #f0f9ff;
    --color-bg-2: #e0f2fe;

    --color-sidebar-start: #0c4a6e;
    --color-sidebar-mid: #075985;
    --color-sidebar-end: #0369a1;

    /* ── Shared Constants ── */
    --color-surface: #ffffff;
    --color-surface-alt: #f8fafc;
    --color-border: rgba(var(--color-primary-rgb), 0.15);
    --color-border-input: rgba(var(--color-primary-rgb), 0.3);
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-text-faint: #94a3b8;

    /* ── Semantic ── */
    --color-success: #16a34a;
    --color-warning: #d97706;
    --color-danger: #ef4444;
    --color-teal: #0d9488;

    /* ── Accent Chips ── */
    --color-chip-blue-bg: #eff6ff;
    --color-chip-blue-fg: #2563eb;
    --color-chip-teal-bg: #f0fdfa;
    --color-chip-teal-fg: #0d9488;
    --color-chip-green-bg: #f0fdf4;
    --color-chip-green-fg: #16a34a;
    --color-chip-amber-bg: #fffbeb;
    --color-chip-amber-fg: #d97706;
    --color-chip-red-bg: rgba(239, 68, 68, 0.08);
    --color-chip-red-fg: #ef4444;

    /* ── Shadows (Dynamic using RGB) ── */
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.04);
    --shadow-card-hover: 0 14px 30px -8px rgba(var(--color-primary-rgb), 0.15);
    --shadow-navbar: 0 1px 20px -5px rgba(var(--color-primary-rgb), 0.1);
    --shadow-sidebar: 6px 0 30px rgba(0, 0, 0, 0.15);
    --shadow-header: 0 8px 30px -5px rgba(var(--color-primary-rgb), 0.4);
    --shadow-button: 0 4px 12px rgba(var(--color-primary-rgb), 0.25);
    --shadow-button-hover: 0 8px 20px rgba(var(--color-primary-rgb), 0.35);

    /* ── System ── */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 18px;
    --radius-pill: 40px;
    --font-main: 'Outfit', sans-serif;
    --transition: 0.25s ease;
}

/* ── SHREEJEE HARDWARE (Emerald Forest) ── */
.theme-shreejee {
    --color-primary: #059669;
    --color-primary-dark: #065f46;
    --color-primary-light: #10b981;
    --color-primary-rgb: 5, 150, 105;

    --color-bg-1: #f0fdf4;
    --color-bg-2: #dcfce7;

    --color-sidebar-start: #064e3b;
    --color-sidebar-mid: #065f46;
    --color-sidebar-end: #059669;
}

/* ── ANAND ENTERPRISES (Modern Crimson) ── */
.theme-anand {
    --color-primary: #e11d48;
    --color-primary-dark: #9f1239;
    --color-primary-light: #fb7185;
    --color-primary-rgb: 225, 29, 72;

    --color-bg-1: #fef2f2;
    --color-bg-2: #fee2e2;

    --color-sidebar-start: #4c0519;
    --color-sidebar-mid: #881337;
    --color-sidebar-end: #e11d48;
}

/* ================================================================
   GLOBAL BASE STYLES
   ================================================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
}

body,
.content-wrapper,
.main-header,
.main-sidebar {
    font-family: var(--font-main) !important;
    color: var(--color-text);
}

.content-wrapper {
    background: linear-gradient(135deg, var(--color-bg-1) 0%, var(--color-bg-2) 100%) !important;
}

.form-control {
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-input);
    color: var(--color-text);
    font-family: var(--font-main);
    transition: border-color var(--transition), box-shadow var(--transition);
    background-color: rgba(255, 255, 255, 1);
}

.form-control:focus {
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.12);
}

/* Sidebar Custom Scrollbar for Sapphire Feel */
.main-sidebar .sidebar::-webkit-scrollbar {
    width: 6px;
}

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

.main-sidebar .sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

.main-sidebar .sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ── MODERN EBCO UI (v2) ──
   Used in dashboard.php and test_edit_estimate.php
   Scoped to .modern-v2 to prevent global leakage.
   ================================================================ */

.modern-v2 {
    font-family: var(--font-main) !important;
    background: linear-gradient(135deg, var(--color-bg-1) 0%, var(--color-bg-2) 100%) !important;
    color: var(--color-text);
    padding-top: 20px;
    min-height: 100vh;
}

.modern-v2 .container {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-border);
    padding: 30px !important;
    margin-bottom: 25px;
    max-width: 1350px !important;
}

/* ── HEADER ── */
.modern-v2 .parent-div {
    border-bottom: 2px solid var(--color-bg-2);
    margin-bottom: 25px;
    padding-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modern-v2 .heading {
    color: var(--color-primary);
    font-weight: 700;
    letter-spacing: -0.5px;
    margin: 0;
    font-size: 26px;
    text-transform: uppercase;
    text-align: center;
}

/* ── FORM ELEMENTS ── */
.modern-v2 .custDetail {
    background: rgba(var(--color-primary-rgb), 0.03);
    border-radius: var(--radius-md);
    padding: 25px;
    margin-top: 15px;
    border: 1px solid var(--color-border);
}

.modern-v2 .form-group label {
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 13px !important;
    margin-bottom: 8px !important;
    display: block !important;
}

.modern-v2 .form-control {
    border-radius: var(--radius-sm) !important;
    border: 1px solid var(--color-border-input) !important;
    padding: 10px 15px !important;
    background-color: var(--color-surface) !important;
    transition: all var(--transition);
    color: var(--color-text) !important;
    height: 42px !important;
}

.modern-v2 select.form-control {
    height: 42px !important;
}

.modern-v2 .form-control:focus {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.1) !important;
}

/* ── TABLES ── */
.modern-v2 table thead th {
    background: var(--color-primary) !important;
    color: white !important;
    border: none !important;
    padding: 15px 12px !important;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modern-v2 table tbody td {
    vertical-align: middle;
    padding: 15px 12px !important;
    border-color: var(--color-border) !important;
    color: var(--color-text);
}

/* ── BUTTONS ── */
.modern-v2 .btn-primary {
    background: var(--color-primary) !important;
    border: none !important;
    border-radius: var(--radius-sm) !important;
    padding: 10px 24px !important;
    font-weight: 600 !important;
    box-shadow: var(--shadow-button);
    transition: all var(--transition) !important;
}

.modern-v2 .btn-primary:hover {
    background: var(--color-primary-dark) !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-button-hover);
}

/* ── SUMMARY SECTION ── */
.modern-v2 .total {
    background: var(--color-surface-alt);
    border-radius: var(--radius-md);
    padding: 2.30px;
    border: 1px solid var(--color-border);
}

.modern-v2 .total input {
    border-radius: var(--radius-sm) !important;
    border: 1px solid var(--color-border-input) !important;
    padding: 8px 12px;
    font-weight: 700;
    color: var(--color-primary);
    background: white;
}

/* ── LOADER (Premium) ── */
#loader {
    background-color: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(4px);
}

.modern-v2 .spinner-border {
    color: var(--color-primary);
    width: 3rem;
    height: 3rem;
}

@media (max-width: 767px) {
    .modern-v2 .container {
        padding: 15px !important;
    }

    .modern-v2 .parent-div {
        flex-direction: column;
        text-align: center;
    }

    .modern-v2 .child-div {
        margin-bottom: 20px;
    }
}

/* ── UTILITIES ── */
.modern-v2 .checkbox-group-inline {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    flex-wrap: nowrap !important;
}

.modern-v2 .checkbox-group-inline .checkbox-options {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

.modern-v2 .checkbox-group-inline label {
    margin-bottom: 0 !important;
    white-space: nowrap !important;
}

.modern-v2 .checkbox-group-inline input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    cursor: pointer !important;
}



/* ================================================================
   SAPPHIRE NEXUS PRELOADER (v4)
   ================================================================ */

.preloader {
    background: radial-gradient(circle at center, var(--color-sidebar-mid) 0%, var(--color-sidebar-start) 100%) !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    overflow: hidden !important;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000 !important;
}

/* Background Particle Drift */
.preloader::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image:
        radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 50px 50px;
    background-position: 0 0, 25px 25px;
    animation: particleDrift 20s linear infinite;
    opacity: 0.3;
    pointer-events: none;
}

.nexus-container {
    position: relative;
    width: 500px;
    height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Orbital Rings */
.nexus-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(var(--color-primary-rgb), 0.2);
    animation: orbitalRotate 10s linear infinite;
}

.nexus-ring-1 {
    width: 440px;
    height: 440px;
    border-bottom: 2px solid var(--color-primary-light);
    animation-duration: 8s;
}

.nexus-ring-2 {
    width: 400px;
    height: 400px;
    border-top: 2px solid rgba(255, 255, 255, 0.2);
    animation-duration: 12s;
    animation-direction: reverse;
}

.nexus-ring-3 {
    width: 360px;
    height: 360px;
    border-right: 2px solid var(--color-primary);
    animation-duration: 6s;
}

.nexus-core {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: nexusPulse 4s ease-in-out infinite;
}

.modern-preloader-logo {
    max-width: 320px !important;
    height: auto;
    filter: drop-shadow(0 0 20px rgba(var(--color-primary-rgb), 0.4));
    position: relative;
    z-index: 11;
}

/* Glass Shine Sweep */
.nexus-core::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: translateX(-150%) skewX(-25deg);
    animation: nexusShine 4s infinite;
    z-index: 12;
    will-change: transform;
}

.nexus-text {
    margin-top: 30px;
    font-family: var(--font-main);
    color: white;
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 5px;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    animation: textBreathe 2s ease-in-out infinite;
}

.nexus-progress {
    margin-top: 20px;
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
}

.nexus-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 25%;
    /* Fixed width for better transform calc */
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary-light), white);
    box-shadow: 0 0 15px var(--color-primary-light);
    animation: nexusLoading 2.2s cubic-bezier(0.65, 0, 0.35, 1) infinite;
    will-change: transform;
}

@keyframes orbitalRotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes nexusPulse {

    0%,
    100% {
        transform: scale(1);
        filter: brightness(1);
    }

    50% {
        transform: scale(1.03);
        filter: brightness(1.1);
    }
}

@keyframes nexusShine {
    0% {
        transform: translateX(-150%) skewX(-25deg);
    }

    30%,
    100% {
        transform: translateX(150%) skewX(-25deg);
    }
}

@keyframes particleDrift {
    from {
        transform: translate(0, 0);
    }

    to {
        transform: translate(50px, 50px);
    }
}

@keyframes textBreathe {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(0.98);
    }

    50% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes nexusLoading {
    0% {
        transform: translateX(-120%);
    }

    50% {
        transform: translateX(150%) scaleX(1.5);
    }

    100% {
        transform: translateX(450%);
    }
}

.preloader .animation__shake {
    display: none !important;
}


/* ================================================================
   PROJECT-WIDE DATATABLES FIXES
   ================================================================ */

/* Fix: Page length selector overlap (Arrow vs Value) */
.dataTables_length select,
.dataTables_wrapper .dataTables_length select {
    padding-right: 1.75rem !important;
    padding-left: 0.75rem !important;
    min-width: 60px !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.6rem center !important;
    background-size: 10px 10px !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    border-radius: var(--radius-sm) !important;
    border: 1px solid var(--color-border-input) !important;
    color: var(--color-text) !important;
    background-color: var(--color-surface) !important;
    height: auto !important;
    vertical-align: middle !important;
}

/* Ensure consistent look even on hover/focus */
.dataTables_length select:focus {
    border-color: var(--color-primary-light) !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.1) !important;
}


/* ================================================================
   SELECT2 GLOBAL FIXES
   ================================================================ */
/* this is not needed on local because select 2 drop down is already working fine on the local but it's needed on the live beucase it's not wokring on live server after adding this css now it's working fine */
/* Fix: Select2 text overlap / vertical alignment and color */
body .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 32px !important;
    padding-left: 0px !important;
    color: var(--color-text) !important;
}