/* EcomSarthi CRM - Glassmorphism UI System v2.0 */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    /* --- GLASS THEME VARIABLES --- */
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --glass-blur: blur(12px);

    --sidebar-glass: rgba(255, 255, 255, 0.75);
    --header-glass: rgba(255, 255, 255, 0.85);

    /* --- BRAND COLORS --- */
    --primary-color: #6366f1;
    /* Indigo 500 */
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --text-main: #1e293b;
    /* Slate 800 */
    --text-muted: #475569;
    /* Slate 600 */

    /* --- ANIMATION --- */
    --transition-speed: 0.3s;
}

body {
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
    background-color: #f0f2f5;
    /* Animated Gradient Background */
    background-image:
        radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%),
        radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 1) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 1) 0, transparent 50%);
    background-image: url('https://images.unsplash.com/photo-1579546929518-9e396f3cc809?ixlib=rb-1.2.1&auto=format&fit=crop&w=2000&q=80');
    /* Fallback / Texture */
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    min-height: 100vh;
    overflow-x: hidden;
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* --- LAYOUT STRUCTURE --- */

#wrapper {
    display: flex;
    width: 100%;
    position: relative;
}

/* Sidebar Styles controlled by Layout Block below */

/* Page Content Wrapper defined at bottom for Toggle Logic */

/* Mobile Adjustments */
@media (max-width: 768px) {
    #sidebar-wrapper {
        margin-left: -280px;
        height: 100vh;
        margin-top: 0;
        margin-bottom: 0;
        border-radius: 0 20px 20px 0;
    }

    #page-content-wrapper {
        margin-left: 0;
        padding-right: 0;
    }

    #wrapper.toggled #sidebar-wrapper {
        margin-left: 0;
    }
}

/* Sidebar Branding */
.sidebar-heading {
    padding: 2rem 1.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    color: var(--primary-color);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* Sidebar Links */
.list-group-item {
    background: transparent !important;
    border: none;
    color: var(--text-muted) !important;
    font-weight: 500;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin: 0 10px;
    transition: all 0.2s;
}

.list-group-item:hover {
    background: rgba(99, 102, 241, 0.1) !important;
    color: var(--primary-color) !important;
    transform: translateX(5px);
}

.list-group-item.active-link {
    background: var(--primary-gradient) !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

/* --- HEADER & NAVBAR --- */
.navbar {
    background: var(--header-glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 16px;
    margin-top: 15px;
    box-shadow: var(--glass-shadow);
    border: 1px solid var(--glass-border);
}

/* --- GLASS CARDS --- */
.card,
.card-custom,
.login-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.card-header {
    background: rgba(255, 255, 255, 0.3);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-weight: 600;
    color: var(--primary-color);
}

/* --- CONTROLS: INPUTS & BUTTONS --- */
.form-control,
.form-select {
    background: rgba(255, 255, 255, 0.8) !important;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.03);
    color: var(--text-main);
    transition: all 0.2s;
}

.form-control:focus,
.form-select:focus {
    background: white !important;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.btn {
    border-radius: 10px;
    font-weight: 600;
    padding: 0.6rem 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: var(--primary-gradient);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.6);
}

/* --- DASHBOARD TILES --- */
.kpi-card {
    position: relative;
    overflow: hidden;
}

/* Use vibrant gradients for icon backgrounds or borders instead of full cards to keep glass effect */
.border-start-primary {
    border-left: 5px solid #6366f1 !important;
}

.border-start-success {
    border-left: 5px solid #10b981 !important;
}

.border-start-warning {
    border-left: 5px solid #f59e0b !important;
}

.border-start-danger {
    border-left: 5px solid #ef4444 !important;
}

/* KANBAN ENHANCEMENTS */
.kanban-list {
    background: rgba(255, 255, 255, 0.3) !important;
    border-radius: 12px;
}

.lead-card {
    background: rgba(255, 255, 255, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.8) !important;
}

/* TABLE STYLING */
.table {
    border-collapse: separate;
    border-spacing: 0 10px;
    color: var(--text-main) !important;
}

.table thead th {
    border: none;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

.table tbody tr {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
    transition: all 0.2s;
}

.table tbody tr:hover {
    transform: scale(1.01);
    background: rgba(255, 255, 255, 0.9);
    z-index: 2;
    position: relative;
}

.table td {
    border: none;
    padding: 1rem;
    vertical-align: middle;
}

.table td:first-child {
    border-radius: 10px 0 0 10px;
}

.table td:last-child {
    border-radius: 0 10px 10px 0;
}

/* --- SCROLLBAR --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.4);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.6);
}

/* --- SIDEBAR LOGO --- */
.logo-container {
    transition: all var(--transition-speed);
}

.logo-img {
    height: 40px;
    width: auto;
    transition: all var(--transition-speed);
}

.logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    transition: all var(--transition-speed);
    white-space: nowrap;
}

/* --- STANDARD LAYOUT (FIXED SIDEBAR) --- */
#wrapper {
    overflow-x: hidden;
    /* Prevent horizontal scroll */
    position: relative;
    width: 100%;
}

/* Sidebar - Fixed to Left */
#sidebar-wrapper {
    height: 100vh;
    /* key change: height vs min-height for scrolling */
    width: 260px;
    margin-left: 0;

    /* Fixed Positioning */
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;

    /* Design */
    background: var(--sidebar-glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--glass-border);

    transition: all var(--transition-speed) ease;
    overflow-y: auto;
    /* Enables vertical scrolling */
}

/* Page Content - Pushed by Sidebar */
#page-content-wrapper {
    width: auto;
    /* Let it fill the remaining space naturally */
    margin-left: 260px;
    /* Exact width of sidebar */
    padding: 20px;
    min-height: 100vh;
    /* Ensure full background coverage */
    transition: all var(--transition-speed) ease;
}

/* --- COLLAPSED STATE (Desktop) --- */
#wrapper.toggled #sidebar-wrapper {
    width: 80px;
}

#wrapper.toggled #sidebar-wrapper .sidebar-heading {
    padding: 0.5rem 0;
    text-align: center;
}

#wrapper.toggled #sidebar-wrapper .logo-text {
    display: none;
}

#wrapper.toggled #sidebar-wrapper .logo-img {
    height: 30px;
    margin: 0 auto;
}

#wrapper.toggled #sidebar-wrapper .list-group-item {
    text-align: center;
    padding: 1rem 0;
}

#wrapper.toggled #sidebar-wrapper .list-group-item span {
    display: none;
    /* Hides text */
}

#wrapper.toggled #sidebar-wrapper .list-group-item i {
    margin-right: 0 !important;
    /* Centers icon */
    font-size: 1.4rem;
}

/* Hide arrow icons if any */
#wrapper.toggled #sidebar-wrapper .dropdown-toggle::after {
    display: none;
}

#wrapper.toggled #page-content-wrapper {
    margin-left: 80px;
    /* Adjust margin dynamically */
    width: auto;
}

/* --- MOBILE LAYOUT --- */
@media (max-width: 768px) {
    #sidebar-wrapper {
        margin-left: -260px;
        /* Hide completely */
    }

    #page-content-wrapper {
        margin-left: 0 !important;
        width: 100%;
    }

    /* Mobile Open */
    #wrapper.toggled #sidebar-wrapper {
        margin-left: 0;
        width: 260px;
        /* Full drawer */
    }

    /* Overlay Backdrop */
    #wrapper.toggled #page-content-wrapper {
        position: fixed;
        width: 100%;
        height: 100%;
    }

    #wrapper.toggled #page-content-wrapper::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 900;
    }
}


/* --- LOGIN SPLIT LAYOUT --- */
.login-container {
    min-height: 100vh;
    overflow: hidden;
}

.login-left {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.9), rgba(79, 70, 229, 0.95)), url('https://images.unsplash.com/photo-1557804506-669a67965ba0?auto=format&fit=crop&w=1200&q=80');
    background-size: cover;
    background-position: center;
    color: white;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4rem;
}

.login-right {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    position: relative;
}

/* Abstract Shapes for Login Right */
.login-right::before {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: linear-gradient(45deg, #6366f1, #a855f7);
    filter: blur(80px);
    opacity: 0.1;
    border-radius: 50%;
    top: -50px;
    right: -50px;
}

/* --- FORM TWEAKS --- */
.form-select {
    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='%23343a40' 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.75rem center !important;
    background-size: 16px 12px !important;
}