/*
 * AdCircle Media CRM — Master Stylesheet
 * Design System: Purple-branded, modern, clean
 * ============================================================
 */

/* ─── CSS VARIABLES ──────────────────────────────────────── */
:root {
    --primary:        #534AB7;
    --primary-dark:   #4239A0;
    --primary-light:  #7F77DD;
    --primary-bg:     #EEEDFE;
    --secondary:      #7F77DD;

    --success:        #1D9E75;
    --success-light:  #E8F8F2;
    --warning:        #BA7517;
    --warning-light:  #FFF6E8;
    --danger:         #E24B4A;
    --danger-light:   #FDE8E8;
    --info:           #3B82F6;
    --info-light:     #EFF6FF;

    --text-dark:      #26215C;
    --text-body:      #4A4578;
    --text-muted:     #888780;
    --text-light:     #B0ADC0;

    --bg-body:        #F8F7FE;
    --bg-white:       #FFFFFF;
    --border-color:   #D3D1C7;
    --border-light:   #EEEDFE;

    --sidebar-bg:     #26215C;
    --sidebar-width:  260px;
    --topbar-height:  64px;

    --radius-sm:      6px;
    --radius-md:      10px;
    --radius-lg:      16px;
    --radius-full:    50%;

    --shadow-sm:      0 1px 3px rgba(83, 74, 183, 0.06);
    --shadow-md:      0 2px 12px rgba(83, 74, 183, 0.08);
    --shadow-lg:      0 8px 30px rgba(83, 74, 183, 0.12);
    --shadow-hover:   0 4px 20px rgba(83, 74, 183, 0.15);

    --transition:     all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --font-family:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ─── RESET & BASE ───────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-body);
    background: var(--bg-body);
    margin: 0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-dark);
    font-weight: 600;
    line-height: 1.3;
}

/* ─── APP LAYOUT ─────────────────────────────────────────── */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

.page-content {
    flex: 1;
    padding: 24px;
}

.content-flash {
    padding: 0 24px;
}

/* ─── SIDEBAR ────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    overflow: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 22px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-name {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.3px;
}

.brand-crm {
    font-size: 11px;
    font-weight: 500;
    color: var(--primary-light);
    letter-spacing: 3px;
    text-transform: uppercase;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

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

.nav-section {
    margin-bottom: 8px;
}

.nav-section-title {
    display: block;
    padding: 12px 22px 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.35);
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 22px;
    color: rgba(255,255,255,0.7);
    font-size: 13.5px;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: var(--transition);
    position: relative;
}

.sidebar-nav .nav-link i:first-child {
    width: 20px;
    text-align: center;
    font-size: 15px;
    flex-shrink: 0;
}

.sidebar-nav .nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.06);
}

.sidebar-nav .nav-link.active {
    color: #fff;
    background: var(--primary-bg);
    background: rgba(127, 119, 221, 0.15);
    border-left-color: var(--primary-light);
}

/* Nav Badges */
.nav-badge {
    margin-left: auto;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 22px;
    text-align: center;
}

.nav-badge.badge-danger {
    background: var(--danger);
}

/* Submenu */
.nav-toggle {
    cursor: pointer;
}

.nav-arrow {
    margin-left: auto;
    font-size: 10px;
    transition: transform 0.2s ease;
}

.nav-item-group.open .nav-arrow {
    transform: rotate(90deg);
}

.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0,0,0,0.1);
}

.nav-item-group.open .nav-submenu {
    max-height: 200px;
}

.nav-submenu .nav-link {
    padding-left: 56px;
    font-size: 13px;
    border-left: none;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 18px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-user-name {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    color: rgba(255,255,255,0.5);
    font-size: 11px;
}

.btn-sidebar-logout {
    color: rgba(255,255,255,0.5);
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.btn-sidebar-logout:hover {
    color: var(--danger);
    background: rgba(255,255,255,0.08);
}

/* Sidebar Overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(2px);
    z-index: 1040;
}

.sidebar-overlay.active {
    display: block;
}

/* ─── TOPBAR ─────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: var(--shadow-sm);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-toggle {
    font-size: 20px;
    color: var(--text-dark);
    padding: 4px 8px;
}

.topbar-search .input-group {
    width: 280px;
}

.topbar-search .input-group-text {
    background: var(--bg-body);
    border: 1px solid var(--border-light);
    border-right: none;
    color: var(--text-muted);
}

.topbar-search .form-control {
    background: var(--bg-body);
    border: 1px solid var(--border-light);
    border-left: none;
    font-size: 13px;
}

.topbar-search .form-control:focus {
    box-shadow: none;
    border-color: var(--primary-light);
    background: var(--bg-white);
}

.topbar-search .form-control:focus + .input-group-text,
.topbar-search .input-group:focus-within .input-group-text {
    border-color: var(--primary-light);
    background: var(--bg-white);
}

.btn-topbar {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-body);
    background: transparent;
    border: none;
    transition: var(--transition);
}

.btn-topbar:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.notification-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 18px;
    height: 18px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-white);
}

.user-menu-btn {
    width: auto !important;
    padding: 4px 8px !important;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dark);
}

/* Notification Dropdown */
.notification-dropdown {
    width: 360px;
    padding: 0;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
}

.notification-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
}

.notification-header h6 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.notification-body {
    max-height: 320px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
    color: var(--text-body);
}

.notification-item:hover {
    background: var(--primary-bg);
    color: var(--text-body);
}

.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--primary-bg);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-content p {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
}

.notification-content small {
    color: var(--text-muted);
}

.notification-empty {
    padding: 30px;
    text-align: center;
    color: var(--text-muted);
}

.notification-empty i {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: 0.4;
}

/* ─── BREADCRUMBS ────────────────────────────────────────── */
.breadcrumb {
    margin: 0;
    padding: 0;
    background: none;
    font-size: 13px;
}

.breadcrumb-item a {
    color: var(--text-muted);
}

.breadcrumb-item.active {
    color: var(--text-dark);
    font-weight: 500;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    color: var(--text-light);
}

/* ─── PAGE HEADER ────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.page-header-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 2px;
}

.page-header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ─── CARDS ──────────────────────────────────────────────── */
.card {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

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

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-light);
    padding: 16px 20px;
    font-weight: 600;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 20px;
}

.card-footer {
    background: transparent;
    border-top: 1px solid var(--border-light);
    padding: 16px 20px;
}

/* Metric Cards (Dashboard) */
.metric-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-md);
    padding: 22px;
    transition: var(--transition);
    border: none;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.metric-card .metric-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 16px;
}

.metric-card .metric-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1;
    margin-bottom: 4px;
}

.metric-card .metric-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.metric-card .metric-trend {
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
}

.metric-card .metric-trend.up { color: var(--success); }
.metric-card .metric-trend.down { color: var(--danger); }

.metric-card::after {
    content: '';
    position: absolute;
    right: -20px;
    bottom: -20px;
    width: 100px;
    height: 100px;
    border-radius: var(--radius-full);
    opacity: 0.06;
}

.metric-card.metric-purple { background: var(--bg-white); }
.metric-card.metric-purple .metric-icon { background: var(--primary-bg); color: var(--primary); }
.metric-card.metric-purple::after { background: var(--primary); }

.metric-card.metric-green { background: var(--bg-white); }
.metric-card.metric-green .metric-icon { background: var(--success-light); color: var(--success); }
.metric-card.metric-green::after { background: var(--success); }

.metric-card.metric-orange { background: var(--bg-white); }
.metric-card.metric-orange .metric-icon { background: var(--warning-light); color: var(--warning); }
.metric-card.metric-orange::after { background: var(--warning); }

.metric-card.metric-red { background: var(--bg-white); }
.metric-card.metric-red .metric-icon { background: var(--danger-light); color: var(--danger); }
.metric-card.metric-red::after { background: var(--danger); }

.metric-card.metric-blue { background: var(--bg-white); }
.metric-card.metric-blue .metric-icon { background: var(--info-light); color: var(--info); }
.metric-card.metric-blue::after { background: var(--info); }

/* ─── BUTTONS ────────────────────────────────────────────── */
.btn {
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 500;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(83, 74, 183, 0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 14px rgba(83, 74, 183, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--primary-bg);
    color: var(--primary);
    border: 1px solid transparent;
}

.btn-secondary:hover {
    background: var(--primary);
    color: #fff;
}

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #178a65; color: #fff; }

.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #a5680f; color: #fff; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c93938; color: #fff; }

.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { background: #2563EB; color: #fff; }

.btn-light {
    background: var(--bg-body);
    color: var(--text-body);
    border: 1px solid var(--border-color);
}

.btn-light:hover {
    background: var(--border-light);
    color: var(--text-dark);
}

.btn-outline-primary {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: #fff;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 15px;
}

/* ─── FORMS ──────────────────────────────────────────────── */
.form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.form-label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-control,
.form-select {
    font-family: var(--font-family);
    font-size: 13.5px;
    padding: 9px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-dark);
    background: var(--bg-white);
    transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(83, 74, 183, 0.1);
    outline: none;
}

.form-control::placeholder {
    color: var(--text-light);
}

.form-text {
    font-size: 12px;
    color: var(--text-muted);
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(83, 74, 183, 0.15);
    border-color: var(--primary-light);
}

textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

.input-group-text {
    font-size: 13px;
    background: var(--bg-body);
    border-color: var(--border-color);
    color: var(--text-muted);
}

/* Select2 Custom Styles */
.select2-container--bootstrap-5 .select2-selection {
    border-color: var(--border-color) !important;
    border-radius: var(--radius-sm) !important;
    min-height: 40px !important;
    font-size: 13.5px !important;
}

.select2-container--bootstrap-5 .select2-selection--single:focus,
.select2-container--bootstrap-5.select2-container--focus .select2-selection {
    border-color: var(--primary-light) !important;
    box-shadow: 0 0 0 3px rgba(83, 74, 183, 0.1) !important;
}

.select2-container--bootstrap-5 .select2-dropdown {
    border-color: var(--border-color) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: var(--shadow-lg) !important;
}

.select2-container--bootstrap-5 .select2-results__option--selected {
    background-color: var(--primary-bg) !important;
    color: var(--primary) !important;
}

.select2-container--bootstrap-5 .select2-results__option--highlighted {
    background-color: var(--primary) !important;
}

/* Flatpickr Custom Styles */
.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
}

/* ─── TABLES ─────────────────────────────────────────────── */
.table-wrapper {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}

.table-search {
    width: 280px;
}

.table-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.table {
    margin: 0;
    font-size: 13.5px;
}

.table thead th {
    background: var(--bg-body);
    color: var(--text-dark);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-body);
}

.table tbody tr:hover {
    background: rgba(83, 74, 183, 0.02);
}

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

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.table-info {
    font-size: 13px;
    color: var(--text-muted);
}

/* Sortable columns */
.sortable {
    cursor: pointer;
    user-select: none;
}

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

.sortable i {
    margin-left: 4px;
    font-size: 10px;
    opacity: 0.4;
}

.sortable.active i {
    opacity: 1;
    color: var(--primary);
}

/* ─── BADGES ─────────────────────────────────────────────── */
.badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.3px;
}

.badge-primary   { background: var(--primary-bg); color: var(--primary); }
.badge-purple    { background: #F0EDFF; color: #6C5DD3; }
.badge-success   { background: var(--success-light); color: var(--success); }
.badge-warning   { background: var(--warning-light); color: var(--warning); }
.badge-danger    { background: var(--danger-light); color: var(--danger); }
.badge-info      { background: var(--info-light); color: var(--info); }
.badge-secondary { background: #F1F1EF; color: #6B6B6B; }
.badge-dark      { background: #2D2B3A; color: #fff; }
.badge-orange    { background: #FFF0E0; color: #D97706; }

/* ─── AVATARS ────────────────────────────────────────────── */
.avatar {
    border-radius: var(--radius-full);
    object-fit: cover;
}

.avatar-initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    font-weight: 600;
    flex-shrink: 0;
}

.avatar-sm, .avatar-sm.avatar-initials { width: 32px; height: 32px; font-size: 12px; }
.avatar-md, .avatar-md.avatar-initials { width: 40px; height: 40px; font-size: 14px; }
.avatar-lg, .avatar-lg.avatar-initials { width: 60px; height: 60px; font-size: 20px; }
.avatar-xl, .avatar-xl.avatar-initials { width: 80px; height: 80px; font-size: 28px; }

.avatar-group {
    display: flex;
}

.avatar-group .avatar,
.avatar-group .avatar-initials {
    margin-left: -8px;
    border: 2px solid var(--bg-white);
}

.avatar-group .avatar:first-child,
.avatar-group .avatar-initials:first-child {
    margin-left: 0;
}

/* ─── TABS ───────────────────────────────────────────────── */
.nav-tabs-custom {
    border-bottom: 2px solid var(--border-light);
    gap: 0;
}

.nav-tabs-custom .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    padding: 12px 20px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: -2px;
    transition: var(--transition);
}

.nav-tabs-custom .nav-link:hover {
    color: var(--primary);
    background: transparent;
}

.nav-tabs-custom .nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: transparent;
}

/* ─── PAGINATION ─────────────────────────────────────────── */
.pagination .page-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-body);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: var(--radius-sm) !important;
    margin: 0 2px;
    transition: var(--transition);
}

.pagination .page-link:hover {
    background: var(--primary-bg);
    color: var(--primary);
    border-color: var(--primary-light);
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.pagination .page-item.disabled .page-link {
    color: var(--text-light);
}

/* ─── ALERTS / FLASH ─────────────────────────────────────── */
.flash-alert {
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    padding: 14px 18px;
    margin-bottom: 16px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
}

.alert-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.alert-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.alert-info {
    background: var(--info-light);
    color: var(--info);
}

/* ─── MODAL ──────────────────────────────────────────────── */
.modal-content {
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
}

/* ─── KANBAN BOARD ───────────────────────────────────────── */
.kanban-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 16px;
    min-height: 400px;
}

.kanban-column {
    min-width: 280px;
    max-width: 320px;
    flex: 1;
    background: var(--bg-body);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
}

.kanban-column-header {
    padding: 14px 16px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.kanban-column-header .count {
    background: rgba(0,0,0,0.08);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.kanban-column-body {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
    min-height: 100px;
}

.kanban-column-body.drag-over {
    background: rgba(83, 74, 183, 0.05);
    border: 2px dashed var(--primary-light);
    border-radius: var(--radius-sm);
}

.kanban-card {
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 8px;
    box-shadow: var(--shadow-sm);
    cursor: grab;
    transition: var(--transition);
    border: 1px solid var(--border-light);
}

.kanban-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.kanban-card:active {
    cursor: grabbing;
    box-shadow: var(--shadow-lg);
    opacity: 0.9;
}

.kanban-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.kanban-card-title {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 8px;
    line-height: 1.4;
}

.kanban-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

.kanban-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
}

.kanban-card .progress {
    height: 4px;
    border-radius: 2px;
    margin-top: 10px;
}

/* Column Colors */
.kanban-column[data-status="not_started"] .kanban-column-header,
.kanban-column[data-status="todo"] .kanban-column-header {
    color: #6B6B6B;
    background: #F1F1EF;
}

.kanban-column[data-status="in_progress"] .kanban-column-header {
    color: var(--primary);
    background: var(--primary-bg);
}

.kanban-column[data-status="under_review"] .kanban-column-header,
.kanban-column[data-status="internal_review"] .kanban-column-header {
    color: var(--info);
    background: var(--info-light);
}

.kanban-column[data-status="client_review"] .kanban-column-header,
.kanban-column[data-status="revision"] .kanban-column-header {
    color: var(--warning);
    background: var(--warning-light);
}

.kanban-column[data-status="completed"] .kanban-column-header,
.kanban-column[data-status="done"] .kanban-column-header {
    color: var(--success);
    background: var(--success-light);
}

.kanban-column[data-status="on_hold"] .kanban-column-header {
    color: var(--danger);
    background: var(--danger-light);
}

/* ─── CONTENT CALENDAR ───────────────────────────────────── */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border-light);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.calendar-header {
    background: var(--bg-body);
    padding: 10px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
}

.calendar-day {
    background: var(--bg-white);
    min-height: 120px;
    padding: 8px;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
}

.calendar-day:hover {
    background: rgba(83, 74, 183, 0.02);
}

.calendar-day.other-month {
    background: var(--bg-body);
    opacity: 0.5;
}

.calendar-day.today {
    background: var(--primary-bg);
}

.calendar-day-number {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.calendar-day.today .calendar-day-number {
    background: var(--primary);
    color: #fff;
    width: 26px;
    height: 26px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-post {
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 4px;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: var(--transition);
}

.calendar-post:hover {
    filter: brightness(0.95);
}

.calendar-post.platform-facebook   { background: #E3F2FD; color: #1565C0; }
.calendar-post.platform-instagram  { background: #FCE4EC; color: #C2185B; }
.calendar-post.platform-youtube    { background: #FFEBEE; color: #C62828; }
.calendar-post.platform-linkedin   { background: #E8EAF6; color: #283593; }
.calendar-post.platform-twitter    { background: #E0F7FA; color: #00838F; }

/* ─── INVOICE PREVIEW ────────────────────────────────────── */
.invoice-preview {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 40px;
    box-shadow: var(--shadow-md);
    max-width: 800px;
    margin: 0 auto;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--primary);
}

.invoice-company h2 {
    color: var(--primary);
    font-size: 24px;
    margin-bottom: 4px;
}

.invoice-title {
    text-align: right;
}

.invoice-title h1 {
    font-size: 32px;
    color: var(--primary);
    margin: 0;
}

.invoice-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.invoice-items-table {
    width: 100%;
    margin-bottom: 30px;
}

.invoice-items-table thead th {
    background: var(--primary);
    color: #fff;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
}

.invoice-items-table tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light);
}

.invoice-totals {
    width: 300px;
    margin-left: auto;
}

.invoice-totals table {
    width: 100%;
}

.invoice-totals td {
    padding: 6px 0;
    font-size: 14px;
}

.invoice-totals .grand-total td {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    border-top: 2px solid var(--primary);
    padding-top: 12px;
}

.invoice-bank-details {
    background: var(--primary-bg);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-top: 30px;
}

/* ─── EMPTY STATE ────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    font-size: 52px;
    color: var(--text-light);
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h5 {
    font-size: 18px;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 20px;
}

/* ─── SUMMARY CARDS ROW (Invoice totals, etc.) ───────────── */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.summary-card {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 18px;
    border: 1px solid var(--border-light);
    text-align: center;
}

.summary-card .summary-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
}

.summary-card .summary-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ─── LOADING OVERLAY ────────────────────────────────────── */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(3px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    text-align: center;
    color: var(--primary);
}

.loading-spinner .spinner-border {
    width: 48px;
    height: 48px;
    border-width: 3px;
}

/* ─── PROFILE HEADER ─────────────────────────────────────── */
.profile-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: var(--radius-md);
    padding: 30px;
    color: #fff;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.profile-header::after {
    content: '';
    position: absolute;
    right: -30px;
    top: -30px;
    width: 200px;
    height: 200px;
    border-radius: var(--radius-full);
    background: rgba(255,255,255,0.08);
}

.profile-header .profile-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.profile-header .profile-details h2 {
    color: #fff;
    font-size: 22px;
    margin-bottom: 4px;
}

.profile-header .profile-details p {
    margin: 0;
    opacity: 0.85;
    font-size: 14px;
}

.profile-stats {
    display: flex;
    gap: 30px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.2);
}

.profile-stat {
    text-align: center;
}

.profile-stat .stat-value {
    font-size: 24px;
    font-weight: 700;
}

.profile-stat .stat-label {
    font-size: 12px;
    opacity: 0.7;
}

/* ─── DYNAMIC LINE ITEMS (Invoice Builder) ───────────────── */
.line-items-table {
    width: 100%;
}

.line-items-table th {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 8px 10px;
    border-bottom: 2px solid var(--border-light);
}

.line-items-table td {
    padding: 8px 10px;
    vertical-align: top;
}

.line-items-table .form-control {
    font-size: 13px;
    padding: 7px 10px;
}

.line-items-table .btn-remove-row {
    color: var(--danger);
    background: var(--danger-light);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.line-items-table .btn-remove-row:hover {
    background: var(--danger);
    color: #fff;
}

.totals-section {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}

.totals-table {
    width: 350px;
}

.totals-table td {
    padding: 8px 12px;
    font-size: 14px;
}

.totals-table .total-row td {
    font-weight: 700;
    font-size: 16px;
    color: var(--primary);
    border-top: 2px solid var(--primary);
    padding-top: 12px;
}

/* ─── CHART CONTAINERS ───────────────────────────────────── */
.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ─── LOGIN PAGE ─────────────────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--sidebar-bg) 0%, var(--primary) 100%);
    padding: 20px;
}

.login-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-card .login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-card .login-logo img {
    width: 60px;
    margin-bottom: 12px;
}

.login-card .login-logo h1 {
    font-size: 24px;
    color: var(--primary);
    margin: 0;
}

.login-card .login-logo p {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

.login-card .form-control {
    padding: 12px 16px;
    font-size: 14px;
}

.login-card .btn-primary {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
}

/* ─── ERROR PAGES ────────────────────────────────────────── */
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: var(--bg-body);
    padding: 20px;
}

.error-page .error-code {
    font-size: 120px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 16px;
}

.error-page h2 {
    font-size: 24px;
    margin-bottom: 12px;
}

.error-page p {
    color: var(--text-muted);
    font-size: 15px;
    margin-bottom: 24px;
}

/* ─── ANIMATIONS ─────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.fade-in {
    animation: fadeIn 0.4s ease forwards;
}

.card, .metric-card {
    animation: fadeIn 0.4s ease forwards;
}

/* Staggered card animation */
.row > [class*="col-"]:nth-child(1) .metric-card { animation-delay: 0s; }
.row > [class*="col-"]:nth-child(2) .metric-card { animation-delay: 0.05s; }
.row > [class*="col-"]:nth-child(3) .metric-card { animation-delay: 0.1s; }
.row > [class*="col-"]:nth-child(4) .metric-card { animation-delay: 0.15s; }
.row > [class*="col-"]:nth-child(5) .metric-card { animation-delay: 0.2s; }
.row > [class*="col-"]:nth-child(6) .metric-card { animation-delay: 0.25s; }
.row > [class*="col-"]:nth-child(7) .metric-card { animation-delay: 0.3s; }

/* ─── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .topbar-search {
        display: none !important;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .kanban-board {
        overflow-x: auto;
    }

    .calendar-grid {
        font-size: 12px;
    }

    .calendar-day {
        min-height: 80px;
        padding: 4px;
    }

    .invoice-preview {
        padding: 20px;
    }

    .invoice-header {
        flex-direction: column;
        gap: 16px;
    }

    .invoice-title {
        text-align: left;
    }

    .invoice-details-grid {
        grid-template-columns: 1fr;
    }

    .profile-header .profile-info {
        flex-direction: column;
        text-align: center;
    }

    .profile-stats {
        justify-content: center;
    }
}

@media (max-width: 575.98px) {
    .page-content {
        padding: 16px;
    }

    .table-toolbar {
        flex-direction: column;
    }

    .table-search {
        width: 100%;
    }

    .table-filters {
        width: 100%;
    }

    .table-filters .form-select {
        flex: 1;
    }

    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .metric-card .metric-value {
        font-size: 22px;
    }

    .notification-dropdown {
        width: 300px;
    }

    .totals-table {
        width: 100%;
    }
}

/* ─── PRINT STYLES ───────────────────────────────────────── */
@media print {
    .sidebar, .topbar, .sidebar-overlay, .page-header-actions,
    .btn, .loading-overlay, .content-flash { display: none !important; }

    .main-content { margin-left: 0 !important; }
    .page-content { padding: 0 !important; }

    .invoice-preview { box-shadow: none; padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ─── UTILITY CLASSES ────────────────────────────────────── */
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger  { color: var(--danger) !important; }
.text-muted   { color: var(--text-muted) !important; }

.bg-primary-light { background: var(--primary-bg) !important; }
.bg-success-light { background: var(--success-light) !important; }
.bg-warning-light { background: var(--warning-light) !important; }
.bg-danger-light  { background: var(--danger-light) !important; }

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

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.cursor-pointer { cursor: pointer; }
.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── VIEW TOGGLE ────────────────────────────────────────── */
.view-toggle {
    display: inline-flex;
    background: var(--bg-body);
    border-radius: var(--radius-sm);
    padding: 3px;
    border: 1px solid var(--border-light);
}

.view-toggle .btn {
    padding: 6px 14px;
    font-size: 13px;
    border: none;
    background: transparent;
    color: var(--text-muted);
}

.view-toggle .btn.active {
    background: var(--bg-white);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
    border-radius: 4px;
}

/* ─── FILTER BAR ─────────────────────────────────────────── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 20px;
    background: var(--bg-white);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    margin-bottom: 20px;
}

.filter-bar .form-select,
.filter-bar .form-control {
    width: auto;
    min-width: 160px;
}

/* ─── PROGRESS BAR ───────────────────────────────────────── */
.progress {
    height: 6px;
    border-radius: 3px;
    background: var(--border-light);
}

.progress-bar {
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 3px;
    transition: width 0.5s ease;
}

.progress-bar.bg-success { background: linear-gradient(90deg, var(--success), #2DC98E) !important; }
.progress-bar.bg-warning { background: linear-gradient(90deg, var(--warning), #D4912A) !important; }
.progress-bar.bg-danger  { background: linear-gradient(90deg, var(--danger), #F06B6B) !important; }

/* Character counter */
.char-counter {
    font-size: 12px;
    color: var(--text-muted);
    text-align: right;
    margin-top: 4px;
}

.char-counter.warning { color: var(--warning); }
.char-counter.danger { color: var(--danger); }

/* ─── OVERDUE HIGHLIGHT ──────────────────────────────────── */
tr.overdue {
    background: var(--danger-light) !important;
}

tr.overdue td {
    color: var(--danger);
}
