/* 
 * Main Style Sheet - CRM Viaansh
 * Design: Minimal, Elegant, Modern
 * Font: Inter
 */

:root {
    /* Color Palette */
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;

    /* Backgrounds */
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #1e293b;
    --bg-sidebar-active: #334155;

    /* Text */
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-sidebar: #e2e8f0;
    --text-white: #ffffff;

    /* Borders & Shadows */
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md:
        0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg:
        0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    /* Spacing */
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
}

/* Global Typography */
body {
    font-family:
        "Inter",
        system-ui,
        -apple-system,
        sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    font-size: clamp(0.75rem, 2vw, 0.8125rem);
    overflow-x: hidden;
}

/* Responsive Typography - Mobile First */
h1 {
    font-size: clamp(1.25rem, 4vw, 1.5rem);
}
h2 {
    font-size: clamp(1.1rem, 3.5vw, 1.25rem);
}
h3 {
    font-size: clamp(1rem, 3vw, 1.1rem);
}
h4 {
    font-size: clamp(0.9rem, 2.5vw, 1rem);
}
h5 {
    font-size: clamp(0.8rem, 2vw, 0.875rem);
}
h6 {
    font-size: clamp(0.75rem, 1.8vw, 0.8125rem);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

a {
    text-decoration: none;
    transition: color 0.2s ease;
}

/* Layout Structure */
.wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100vh;
    max-width: 100%;
    overflow-x: hidden;
}

main {
    flex: 1;
    width: 100%;
}

/* --- Sidebar Design --- */
.sidebar {
    width: 215px;
    background-color: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    flex-shrink: 0;
    transition: width 0.3s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.02);
    z-index: 100;
}

.sidebar.collapsed {
    width: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

.sidebar-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-white);
}

.brand-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
    color: #818cf8;
}

/* Sidebar Navigation */
.nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    margin: 1.5rem 0 0.5rem 0.5rem;
    font-weight: 600;
}

.sidebar-nav-item {
    margin-bottom: 0.25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-md);
    color: #cbd5e1;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
    position: relative;
    overflow: hidden;
}

.sidebar-link i {
    font-size: 1.1rem;
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
    transition: transform 0.2s ease;
}

.sidebar-link:hover {
    color: var(--text-white);
    background-color: rgba(255, 255, 255, 0.05);
    background-color: var(--bg-sidebar-active);
}

.sidebar-link:hover i {
    transform: translateX(2px);
}

.sidebar-link.active {
    background: linear-gradient(
        90deg,
        rgba(79, 70, 229, 0.15) 0%,
        rgba(79, 70, 229, 0.05) 100%
    );
    color: #818cf8;
    border-left: 3px solid #818cf8;
    border-radius: 4px var(--radius-md) var(--radius-md) 4px;
    padding-left: calc(1rem - 3px);
}

.sidebar-link.active i {
    color: #818cf8;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    color: #64748b;
    text-align: center;
}

/* Toggle Button within sidebar */
.sidebar-toggle-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border: none;
    color: #cbd5e1;
    padding: 0.75rem 1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s;
}

.sidebar-toggle-btn:hover {
    background-color: var(--bg-sidebar-active);
    color: var(--text-white);
}

.sidebar-toggle-btn[aria-expanded="true"] .chevron-icon {
    transform: rotate(180deg);
}

.chevron-icon {
    transition: transform 0.2s ease;
}

/* --- Header & Content --- */
header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 1.5rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 90;
}

/* Mobile Header */
@media (max-width: 767px) {
    header {
        padding: 0.5rem 0.75rem;
    }

    header .container-fluid {
        padding: 0 !important;
    }

    /* Make buttons more compact on mobile */
    header .btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
    }

    /* Hide text labels on very small screens */
    header .d-flex.align-items-center.me-3 {
        margin-right: 0.5rem !important;
    }
}

/* Tablet Header */
@media (min-width: 768px) and (max-width: 1024px) {
    header {
        padding: 0.5rem 1rem;
    }
}

.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background-color: #f1f5f9;
    border-radius: 2rem;
    transition: background 0.2s;
}

/* Mobile user profile */
@media (max-width: 767px) {
    .user-profile-badge {
        padding: 0.4rem 0.6rem;
        gap: 0.5rem;
    }
}

.user-profile-badge:hover {
    background-color: #e2e8f0;
}

.avatar-circle {
    width: 30px;
    height: 30px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

/* --- Card & Table Styles --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.3s ease;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

/* Mobile cards */
@media (max-width: 767px) {
    .card {
        border-radius: 0.5rem;
    }

    .card-body {
        padding: 0.75rem !important;
    }
}

.table {
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    background-color: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.05em;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.table tbody td {
    padding: 0.5rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-main);
    font-size: 0.875rem;
}

/* Mobile table optimization */
@media (max-width: 767px) {
    .table thead th {
        padding: 0.4rem 0.5rem;
        font-size: 0.6rem;
    }

    .table tbody td {
        padding: 0.5rem 0.5rem;
        font-size: 0.75rem;
    }

    /* Improve horizontal scroll on mobile */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        border-radius: 0.5rem;
    }

    /* Compact action buttons in tables */
    .table .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }
}

/* Tablet table optimization */
@media (min-width: 768px) and (max-width: 1024px) {
    .table thead th {
        padding: 0.45rem 0.65rem;
        font-size: 0.62rem;
    }

    .table tbody td {
        padding: 0.5rem 0.65rem;
        font-size: 0.8rem;
    }
}

.table tbody tr:last-child td {
    border-bottom: none;
}

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

.user-row {
    transition: background-color 0.2s ease;
}

/* --- Badges --- */
.badge {
    padding: 0.35em 0.8em;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 2rem;
}

/* --- Buttons --- */
.btn {
    border-radius: 0.375rem;
    padding: 0.4rem 1rem;
    font-weight: 500;
    font-size: 0.825rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 38px;
}

/* Mobile button adjustments */
@media (max-width: 767px) {
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
        min-height: 44px; /* Touch-friendly size */
    }

    .btn-sm {
        padding: 0.35rem 0.6rem;
        font-size: 0.7rem;
        min-height: 36px;
    }

    .btn-lg {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
        min-height: 48px;
    }
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(79, 70, 229, 0.25);
}

.btn-outline-secondary {
    border-color: #cbd5e1;
    color: #64748b;
}

.btn-outline-secondary:hover {
    background-color: #f1f5f9;
    color: #334155;
    border-color: #94a3b8;
}

/* --- Inputs --- */
.form-control,
.form-select {
    border-radius: 0.375rem;
    border: 1px solid #cbd5e1;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    transition: all 0.2s;
    background-color: #fff;
    min-height: 38px;
}

/* Mobile input sizing */
@media (max-width: 767px) {
    .form-control,
    .form-select {
        padding: 0.6rem 0.75rem;
        font-size: 0.875rem;
        min-height: 44px; /* Touch-friendly */
    }

    .form-control-sm,
    .form-select-sm {
        padding: 0.45rem 0.65rem;
        font-size: 0.8rem;
        min-height: 38px;
    }
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    outline: none;
}

/* --- Login Page --- */
.login-page {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: white;
    padding: 3rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

/* Password Toggle Style */
#togglePassword {
    z-index: 10;
    padding: 0 10px;
    background: transparent;
    transition: color 0.2s ease;
}

#togglePassword:hover {
    color: var(--primary-color) !important;
}

#password.form-control-lg {
    padding-right: 45px; /* Space for the icon */
}

/* --- Toastify Animations --- */
.toastify {
    font-family: "Inter", sans-serif !important;
    padding: 16px 24px !important;
    box-shadow:
        0 10px 15px -3px rgba(0, 0, 0, 0.1),
        0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    max-width: 350px !important;
}

.toast-slide-in {
    animation: slideInRight 0.5s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%) translateY(0);
    }
    to {
        opacity: 1;
        transform: translateX(0) translateY(0);
    }
}

/* --- Stat Cards --- */
.stat-card {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition:
        transform 0.2s,
        box-shadow 0.2s;
    height: auto;
    color: white;
    overflow: hidden;
    position: relative;
    text-decoration: none;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Mobile stat cards */
@media (max-width: 767px) {
    .stat-card .card-body {
        padding: 1rem !important;
    }

    .stat-card .h3 {
        font-size: 1.3rem !important;
    }

    .stat-card .icon-circle {
        width: 36px;
        height: 36px;
    }

    /* Stack stat cards vertically */
    .row.g-3 > [class*="col-md"] {
        margin-bottom: 0.75rem;
    }
}

/* Card Variants */
.stat-card-total {
    background: #fff;
    border-left: 4px solid #6366f1 !important;
}

.stat-card-active {
    background: #fff;
    border-left: 4px solid #10b981 !important;
}

.stat-card-inactive {
    background: #fff;
    border-left: 4px solid #ef4444 !important;
}

.stat-card-warning {
    background: #fff;
    border-left: 4px solid #f59e0b !important;
}

/* Icon Circles */
.icon-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.icon-circle-total {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}
.icon-circle-active {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}
.icon-circle-inactive {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.icon-circle-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        height: 100vh;
        z-index: 1050;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    }

    .sidebar.show {
        left: 0;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(15, 23, 42, 0.6);
        z-index: 1040;
        display: none;
        backdrop-filter: blur(2px);
        transition: opacity 0.3s;
        opacity: 0;
    }

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

/* --- Global Drawer System --- */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1060;
    display: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.drawer-overlay.show {
    display: block;
    opacity: 1;
}

.crm-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    height: 100vh;
    background: #ffffff;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);
    z-index: 1070;
    transition:
        right 0.35s cubic-bezier(0.25, 1, 0.5, 1),
        width 0.35s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-width: 100vw;
}

.crm-drawer.show {
    right: 0;
}

/* Width States - Mobile First */
.crm-drawer.w-40,
.crm-drawer.w-70,
.crm-drawer.w-100 {
    width: 100%;
}

/* Tablet breakpoint */
@media (min-width: 768px) {
    .crm-drawer.w-40 {
        width: 50%;
        max-width: 500px;
    }
    .crm-drawer.w-70 {
        width: 70%;
        max-width: none;
    }
    .crm-drawer.w-100 {
        width: 90%;
    }
}

/* Laptop breakpoint */
@media (min-width: 1025px) {
    .crm-drawer.w-40 {
        width: 40%;
        max-width: 600px;
    }
    .crm-drawer.w-70 {
        width: 70%;
    }
    .crm-drawer.w-100 {
        width: 85%;
    }
}

/* Large desktop breakpoint */
@media (min-width: 1441px) {
    .crm-drawer.w-40 {
        width: 30%;
        max-width: 650px;
    }
    .crm-drawer.w-70 {
        width: 60%;
    }
    .crm-drawer.w-100 {
        width: 80%;
    }
}

/* Drawer Header */
.drawer-header {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.drawer-header h5 {
    color: #ffffff;
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.01em;
}

.drawer-header .btn-close {
    background: rgba(255, 255, 255, 0.2);
    opacity: 1;
    border-radius: 0.375rem;
    width: 32px;
    height: 32px;
    padding: 0;
    transition: all 0.2s ease;
    filter: brightness(0) invert(1);
}

.drawer-header .btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Drawer Body */
.drawer-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background: #f8fafc;
    padding: 0;
    position: relative;
}

/* Fix for double container issue in edit views */
.drawer-body .container-fluid {
    padding: 1.5rem;
    background: transparent;
}

.drawer-body .card-body {
    background: #ffffff;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Mobile drawer body */
@media (max-width: 767px) {
    .drawer-body {
        padding: 0;
    }
    .drawer-body .container-fluid {
        padding: 1rem;
    }
    .drawer-body .card-body {
        padding: 1rem;
    }
}

/* Drawer Footer */
.drawer-footer {
    background: #ffffff;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    flex-shrink: 0;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

.drawer-footer .btn {
    min-width: 100px;
}

@media (max-width: 767px) {
    .drawer-footer {
        padding: 0.875rem 1rem;
    }
    .drawer-footer .btn {
        min-width: 80px;
        font-size: 0.875rem;
    }
}

/* Drawer Content Styling */
.drawer-body h2,
.drawer-body h3,
.drawer-body h4,
.drawer-body h5,
.drawer-body h6 {
    color: #1e293b;
    font-weight: 600;
}

.drawer-body .h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.drawer-body .form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #475569;
    margin-bottom: 0.5rem;
}

.drawer-body .form-control,
.drawer-body .form-select {
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
}

.drawer-body .form-control:focus,
.drawer-body .form-select:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.drawer-body .text-primary {
    color: #4f46e5 !important;
}

.drawer-body .border-bottom {
    border-color: #e2e8f0 !important;
}

/* Section Headers in Drawer */
.drawer-body h6.text-primary {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 0.5rem;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.drawer-body h6.text-primary:first-of-type {
    margin-top: 0;
}

/* Smooth Scrollbar */
.drawer-body::-webkit-scrollbar {
    width: 8px;
}

.drawer-body::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.drawer-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.drawer-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* --- Filter Grid System --- */
.filter-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

/* Tablet and up - 2 columns */
@media (min-width: 768px) {
    .filter-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .filter-grid .col-12,
    .filter-grid .col-md-12 {
        grid-column: span 2;
    }

    .filter-grid .col-6,
    .filter-grid .col-md-6 {
        grid-column: span 1;
    }
}

/* Mobile - all full width */
@media (max-width: 767px) {
    .filter-grid .col-12,
    .filter-grid .col-6,
    .filter-grid .col-md-6,
    .filter-grid .col-md-12 {
        grid-column: span 1;
    }
}

.filter-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.05em;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.filter-section-title:first-of-type {
    margin-top: 0;
}

.filter-section-title i {
    font-size: 0.9rem;
    margin-right: 0.5rem;
    color: #4f46e5;
}

/* Integrated Range Group */
.filter-range-group {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 2px;
    gap: 0.25rem;
}

/* Mobile range group - stack on very small screens */
@media (max-width: 374px) {
    .filter-range-group {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .filter-range-separator {
        display: none;
    }
}

.filter-range-group input {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0.4rem 0.6rem !important;
    font-size: 0.8rem !important;
    width: 100%;
    min-height: 36px;
}

@media (max-width: 767px) {
    .filter-range-group input {
        padding: 0.5rem 0.6rem !important;
        min-height: 40px;
    }
}

.filter-range-separator {
    color: #94a3b8;
    padding: 0 0.25rem;
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* Compact Labels */
.filter-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.25rem;
}

.drawer-body .form-control-sm,
.drawer-body .form-select-sm {
    border-color: #e2e8f0;
    font-size: 0.8rem;
    padding: 0.45rem 0.75rem;
    transition: all 0.2s ease;
}

.drawer-body .form-control-sm:focus,
.drawer-body .form-select-sm:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.05);
}

.drawer-footer {
    padding: 1rem 1.25rem;
    background: #ffffff;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

body.drawer-open {
    overflow: hidden;
}

/* --- Pagination --- */
.pagination {
    margin-bottom: 0;
    gap: 0.25rem;
    display: flex;
    align-items: center;
}

.page-link {
    border: none;
    border-radius: 0.375rem;
    color: var(--text-muted);
    padding: 0.25rem 0.6rem;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all 0.2s;
}

.page-item.active .page-link {
    color: white;
}

.page-item.disabled .page-link {
    background-color: transparent;
    color: #cbd5e1;
}

/* --- Notifications --- */
.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.2s;
    cursor: pointer;
    text-decoration: none !important;
    display: block;
    color: inherit;
}

.notification-item:hover {
    background-color: #f8fafc;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item.unread {
    background-color: #f0f7ff;
}

.notification-item.unread:hover {
    background-color: #e6f1ff;
}

.notification-item .title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 2px;
}

.notification-item .message {
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.4;
}

.notification-item .time {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 4px;
}

.notification-item.success {
    border-left: 3px solid #22c55e;
}
.notification-item.info {
    border-left: 3px solid #3b82f6;
}
.notification-item.warning {
    border-left: 3px solid #f59e0b;
}
.notification-item.danger {
    border-left: 3px solid #ef4444;
}

#unreadCountBadge {
    padding: 0.25em 0.4em;
    min-width: 1.6em;
}

/* --- Global Compact Overrides --- */
.mb-4 {
    margin-bottom: 1.25rem !important;
}
.mb-3 {
    margin-bottom: 0.75rem !important;
}
.p-4 {
    padding: 1rem !important;
}
.p-3 {
    padding: 0.75rem !important;
}
.py-4 {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
}
.py-3 {
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
}
.px-4 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}

/* Mobile spacing adjustments */
@media (max-width: 767px) {
    .mb-4 {
        margin-bottom: 1rem !important;
    }
    .mb-3 {
        margin-bottom: 0.5rem !important;
    }
    .p-4 {
        padding: 0.75rem !important;
    }
    .py-4 {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }
    .px-4 {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
}

.container-fluid {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}

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

.stat-card .h3 {
    font-size: 1.1rem !important;
}

.table th,
.table td {
    padding: 0.5rem 0.75rem !important;
}

.breadcrumb {
    font-size: 0.75rem;
}

@media (max-width: 767px) {
    .breadcrumb {
        font-size: 0.65rem;
    }
}

.sidebar .nav-section-title {
    margin-top: 1rem;
}

.hover-primary {
    transition: color 0.2s ease;
}

.hover-primary:hover {
    color: var(--primary-color) !important;
}

/* --- Lead Show Timeline --- */
.timeline-compact .timeline-indicator {
    min-width: 30px;
}

.timeline-compact .timeline-content {
    min-width: 0;
}

.avatar-xxs {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* --- Search Bar Fix --- */
.input-group {
    flex-shrink: 0 !important;
    width: auto;
}

/* Target search bars in dashboard headers */
.container-fluid .d-flex .input-group,
header .input-group {
    width: 280px !important;
}

/* Mobile search bar */
@media (max-width: 767px) {
    .container-fluid .d-flex .input-group,
    header .input-group {
        width: 100% !important;
        max-width: 220px;
    }
}

/* Tablet search bar */
@media (min-width: 768px) and (max-width: 1024px) {
    .container-fluid .d-flex .input-group,
    header .input-group {
        width: 240px !important;
    }
}

.input-group .form-control:focus {
    z-index: 3;
}

/* ========================================
   NOTIFICATION DRAWER
   ======================================== */

.notification-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    z-index: 1060;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.notification-drawer.active {
    opacity: 1;
    pointer-events: all;
}

.notification-drawer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.notification-drawer.active .notification-drawer-overlay {
    opacity: 1;
}

.notification-drawer-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 450px;
    max-width: 95vw;
    height: 100%;
    background-color: #ffffff;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.05);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    flex-direction: column;
}

.notification-drawer.active .notification-drawer-content {
    transform: translateX(0);
}

.notification-drawer-header {
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
}

.notification-drawer-header h5 {
    color: #0f172a;
    font-size: 1.1rem;
    letter-spacing: -0.01em;
}

.notification-drawer-header .btn-link {
    color: #64748b;
    border-radius: 0.5rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.notification-drawer-header .btn-link:hover {
    color: #4f46e5;
    background-color: #f1f5f9;
}

#drawerUnreadCount {
    font-weight: 700;
    padding: 0.3rem 0.6rem;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

.notification-drawer-body {
    flex: 1;
    overflow-y: auto;
    background-color: #ffffff;
}

/* Individual Notification Item */
.notification-item {
    position: relative;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: #ffffff;
    border-left: 4px solid transparent;
}

.notification-item:hover {
    background-color: #f8fafc;
    transform: translateX(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    z-index: 1;
}

.notification-item.unread {
    background-color: #f0f7ff;
}

.notification-item.unread:hover {
    background-color: #e6f1ff;
}

.notification-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
    margin-right: 1rem;
    line-height: 1.3;
}

.notification-time {
    font-size: 0.75rem;
    color: #94a3b8;
    white-space: nowrap;
    font-weight: 500;
}

.notification-description {
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.5;
    margin-top: 0.25rem;
}

/* Status Indicators */
.notification-item.success {
    border-left-color: #22c55e;
}
.notification-item.info {
    border-left-color: #3b82f6;
}
.notification-item.warning {
    border-left-color: #f59e0b;
}
.notification-item.danger {
    border-left-color: #ef4444;
}

/* Status Dot micro-styles */
.notification-item.success .notification-title::before,
.notification-item.info .notification-title::before,
.notification-item.warning .notification-title::before,
.notification-item.danger .notification-title::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}

.notification-item.success .notification-title::before {
    background-color: #22c55e;
}
.notification-item.info .notification-title::before {
    background-color: #3b82f6;
}
.notification-item.warning .notification-title::before {
    background-color: #f59e0b;
}
.notification-item.danger .notification-title::before {
    background-color: #ef4444;
}

/* Needs Review Status (Special for SuperAdmin) */
.notification-item.needs-review {
    background-color: #fff8eb;
    border-left-color: #f59e0b;
}
.notification-item.needs-review:hover {
    background-color: #fef3e2;
}
.notification-item.needs-review .notification-title::before {
    background-color: #f59e0b;
}

.notification-drawer-body .text-center {
    padding: 4rem 2rem;
}

.notification-drawer-body .bi-bell-slash {
    color: #cbd5e1;
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    .notification-drawer-content {
        width: 100%;
        max-width: 100%;
    }
}

/* ==========================================
   PAGE LAYOUT RESPONSIVENESS
   ========================================== */

/* Action Bar - Top button row on index pages */
@media (max-width: 767px) {
    /* Stack header elements vertically */
    .container-fluid > .d-flex.justify-content-between {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem;
    }

    /* Button groups - wrap on mobile */
    .d-flex.align-items-center.gap-3,
    .d-flex.align-items-center.gap-2 {
        flex-wrap: wrap;
        width: 100%;
        gap: 0.5rem !important;
    }

    /* Make primary action buttons more prominent on mobile */
    .d-flex.align-items-center .btn-primary {
        order: -1;
        flex: 1 1 auto;
    }

    /* Compact secondary buttons */
    .d-flex.align-items-center .btn:not(.btn-primary) {
        flex: 0 1 auto;
    }
}

/* Tablet action bar adjustments */
@media (min-width: 768px) and (max-width: 1024px) {
    .container-fluid > .d-flex.justify-content-between {
        gap: 0.75rem;
    }

    .d-flex.align-items-center.gap-3 {
        gap: 0.5rem !important;
    }

    .d-flex.align-items-center .btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
    }
}

/* Pagination improvements */
@media (max-width: 767px) {
    .d-flex.justify-content-between.align-items-center.p-3 {
        flex-direction: column;
        gap: 0.75rem;
        align-items: center !important;
    }

    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Large Desktop - prevent excessive stretching */
@media (min-width: 1920px) {
    main .container-fluid {
        max-width: 1800px;
        margin: 0 auto;
    }
}

/* Responsive Badge Sizing */
@media (max-width: 767px) {
    .badge {
        font-size: 0.65rem;
        padding: 0.3em 0.6em;
    }
}

/* Avatar sizing */
@media (max-width: 767px) {
    .avatar-circle {
        width: 26px;
        height: 26px;
        font-size: 0.8rem;
    }
}

/* Dropdown menu touch improvements */
@media (max-width: 767px) {
    .dropdown-menu {
        font-size: 0.85rem;
    }

    .dropdown-item {
        padding: 0.6rem 1rem;
        min-height: 44px;
    }
}

/* Modal Responsiveness */
@media (max-width: 767px) {
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-lg,
    .modal-xl {
        max-width: 100% !important;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-header {
        padding: 0.75rem 1rem;
    }

    .modal-footer {
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        flex: 1;
    }
}

/* ========================================
   Compact Filter Drawer & Active Filters
   ======================================== */

/* Make drawer more compact */
.filter-drawer {
    max-width: 420px !important;
}

.drawer-body {
    padding: 1rem !important;
}

.filter-grid {
    gap: 0.75rem !important;
}

.filter-label {
    font-size: 0.8rem !important;
    margin-bottom: 0.25rem !important;
    font-weight: 500;
}

.filter-section-title {
    font-size: 0.85rem !important;
    padding: 0.5rem 0 !important;
    margin-bottom: 0.25rem !important;
}

/* Active Filters Display Inside Drawer */
.drawer-active-filters {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.drawer-active-filters-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.drawer-active-filters-title i {
    color: #007bff;
}

.drawer-filter-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.drawer-filter-badge {
    display: inline-flex;
    align-items: center;
    background: #007bff;
    color: white;
    padding: 0.3rem 0.65rem;
    border-radius: 12px;
    font-size: 0.75rem;
    line-height: 1.2;
    box-shadow: 0 1px 3px rgba(0, 123, 255, 0.3);
}

.drawer-filter-badge strong {
    margin-right: 0.3rem;
    font-weight: 600;
}

/* Compact form controls */
.drawer-body .form-control-sm,
.drawer-body .form-select-sm {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
}

.drawer-footer {
    padding: 0.75rem 1rem !important;
}

/* --- Notification Drawer Improvements --- */
.notification-item.needs-review {
    background-color: #fff9db !important; /* Light yellow background for review required */
    border-left: 4px solid #f59e0b; /* Amber border */
}

.notification-item.needs-review:hover {
    background-color: #fff3bf !important;
}

.notification-item.needs-review .notification-title {
    color: #92400e; /* Darker amber text */
    font-weight: 700;
}

.notification-item.unread:not(.needs-review) {
    background-color: #f8fafc;
}
