/* ========================================
   1. VARIABLES & GLOBAL RESETS
   ======================================== */
:root {
    --primary-color: #007bff;
    --primary-rgb: 0, 123, 255;
    --primary-hover-color: #0056b3;
    --secondary-color: #6c757d;
    --secondary-rgb: 108, 117, 125;
    --c-primary: #2563EB;
    --c-primary-light: #EFF6FF;
    --c-bg-body: #F8FAFC;
    --c-bg-card: #FFFFFF;
    --c-text-primary: #1F2937;
    --c-text-secondary: #6B7280;
    --c-border: #E5E7EB;
    --c-error: #DC2626;
    --c-success: #16A34A;
    --c-danger-bg: #FEF2F2;
    --c-success-bg: #F0FDF4;
    --radius-md: 6px;
    --radius-lg: 10px;
    --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 rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--c-bg-body);
    color: var(--c-text-primary);
}


/* ========================================
   2. LOGIN PAGE STYLES
   ======================================== */
.login-body {
    background-color: #F8F9FA;
    font-family: 'Inter', sans-serif;
    overflow: hidden;
}

.login-wrapper {
    display: flex;
    min-height: 100vh;
}

.login-showcase {
    flex: 1;
    background: linear-gradient(rgba(37, 99, 235, 0.9), rgba(29, 78, 216, 0.9)), url('https://images.unsplash.com/photo-1556761175-5973dc0f32e7?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1632&q=80') no-repeat center center;
    background-size: cover;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 64px;
    color: white;
}

.showcase-content { max-width: 450px; }
.showcase-title { font-size: 42px; font-weight: 700; line-height: 1.2; margin-bottom: 24px; }
.showcase-text { font-size: 18px; font-weight: 400; line-height: 1.6; opacity: 0.9; }

.login-form-container { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px; }
.login-card {
    width: 100%;
    max-width: 550px; /* A little wider for better spacing */
    background: #FFFFFF; /* The white box */
    padding: 48px; /* Add generous spacing inside the box */
    border-radius: var(--radius-lg); /* Use our standard curved borders */
    box-shadow: var(--shadow-lg); /* Add a nice, soft shadow */
}
.login-header { text-align: left; margin-bottom: 40px; }
.login-logo { height: 48px; width: auto; margin-bottom: 24px; }
.login-title { font-size: 28px; font-weight: 700; color: var(--c-text-primary); margin-bottom: 8px; }
.login-subtitle { font-size: 16px; color: var(--c-text-secondary); }
.login-form .form-group { margin-bottom: 24px; }
.login-label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 8px; color: var(--c-text-primary); }

.login-input { width: 100%; height: 50px; padding: 0 20px 0 50px; border: 1px solid var(--c-border); border-radius: var(--radius-md); font-size: 16px; transition: border-color 0.2s, box-shadow 0.2s; box-sizing: border-box; }
.login-input:focus { border-color: var(--c-primary); outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2); }
.password-toggle { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); cursor: pointer; color: #9CA3AF; }

.login-button { width: 100%; height: 50px; border: none; background: var(--c-primary); color: white; transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s; border-radius: var(--radius-md); font-size:15px;}
.login-button:hover { background-color: #1D4ED8; box-shadow: 0 4px 15px rgba(37, 99, 235, 0.2); }
.login-button:active { transform: scale(0.98); }

.error-message { display: flex; align-items: center; gap: 10px; background-color: var(--c-danger-bg); color: var(--c-error); padding: 12px 16px; border-radius: var(--radius-md); font-size: 14px; margin-bottom: 24px; }

@media (max-width: 992px) {
    .login-showcase { display: none; }
    .login-form-container { flex: 1; }
    .login-card { padding: 24px; }
}


/* ========================================
   3. MAIN APP LAYOUT
   ======================================== */
.page-wrapper { display: flex; }
.main-content { margin-left: 260px; flex-grow: 1; display: flex; flex-direction: column; width: calc(100% - 260px); }
.header { display: flex; justify-content: space-between; align-items: center; padding: 24px 32px; background-color: var(--c-bg-card); border-bottom: 1px solid var(--c-border); }
.header-title { font-size: 24px; font-weight: 600; color: var(--c-text-primary); margin: 0; }
.header-subtitle { font-size: 14px; color: var(--c-text-secondary); margin-top: 4px; }
.header-actions { display: flex; align-items: end; gap: 8px; }
.content-body { padding: 32px; flex-grow: 1; }


/* ========================================
   4. SIDEBAR STYLES (DARK THEME)
   ======================================== */
.sidebar { width: 260px; background-color:var(--c-sidebar-bg); border-right: 1px solid #1E293B; display: flex; flex-direction: column; height: 100vh; position: fixed; top: 0; left: 0; z-index: 100; }
.sidebar-header { padding: 24px; border-bottom: 1px solid #1E293B; }
.sidebar-title-main { font-size: 20px; font-weight: 700; color: var(--c-sidebar-text); line-height: 1.2; }
.sidebar-title-sub { font-size: 13px; font-weight: 500; color: var(--c-sidebar-text); opacity: 0.7; line-height: 1.3; }
.nav-list { list-style: none; flex-grow: 1; overflow-y: auto; padding: 16px; }
.nav-item { margin-bottom: 4px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 13px 13px; border-radius: 6px; text-decoration: none; color: var(--c-sidebar-text); font-weight: 500; transition: background-color 0.2s, color 0.2s; position: relative; }
.nav-link:hover { background-color: ##1b2d4b; color: ##1b2d4b; }
.nav-link.active { background-color: #334155; color: #FFFFFF; font-weight: 600; box-shadow: 0 0 15px rgba(59, 130, 246, 0.3); }
.nav-link:not(.active):hover {
    background-color: var(--c-primary);
    color: #FFFFFF;
}
.nav-icon { width: 20px; height: 20px; font-size: 16px; text-align: center; flex-shrink: 0; }
.nav-text { flex-grow: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.submenu { list-style: none; padding-left: 20px; margin-top: 8px; margin-left: 18px; border-left: 1px solid #334155; max-height: 0; overflow: hidden; transition: max-height 0.3s ease-in-out; }
.has-submenu.menu-open > .submenu { max-height: 500px; }
.submenu .nav-item { position: relative; }
.submenu .nav-item::before { content: ''; position: absolute; left: -12px; top: 20px; width: 12px; height: 1px; background-color: #334155; }
.submenu .nav-link { padding-left: 12px; font-size: 14px; color: #94A3B8; }
.submenu .nav-link:hover { background-color: transparent; color: #FFFFFF; }
.submenu .nav-link.active { background-color: transparent; color: #FFFFFF; font-weight: 600; box-shadow: none; }
.nav-link-placeholder { padding: 10px 28px; font-size: 14px; color: #64748B; font-style: italic; }
.toggle-icon { font-size: 12px; margin-left: auto; transition: transform 0.3s ease; }
.has-submenu.menu-open > .nav-link .toggle-icon { transform: rotate(-180deg); }
.notification-badge { margin-left: auto; background-color: #EF4444; color: white; font-size: 12px; font-weight: 600; border-radius: 50%; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; line-height: 1; }
.sidebar-footer { margin-top: auto; padding: 16px;}
.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 6px;
    background-color: #1E293B;
}
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background-color: #3B82F6; color: #FFFFFF; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 16px; flex-shrink: 0; }
.user-info { line-height: 1.3; overflow: hidden; }
.user-name { display: block; font-size: 14px; font-weight: 600; color: var(--c-sidebar-text); }
.user-role { display: block; font-size: 12px; color: #94A3B8; }
.logout-button {
    width: 100%;
    justify-content: flex-start;
    color: var(--c-sidebar-text);
    opacity: 0.7;
    margin-top: 16px; /* Adds space above the line */
    padding-top: 16px; /* Adds space below the line */
    border-top: 1px solid rgba(255, 255, 255, 0.15); /* A clean, semi-transparent white line */
    border-radius: 5px; /* Make sure it's a straight line */
}
.nav-link.logout-button:hover {
    background-color: #660f0f; /* A deeper, darker red */
    color: #FFFFFF; /* White text, like the other active tabs */
    font-weight: 600; /* Bolder text on hover */
    box-shadow: 0 0 15px rgba(220, 38, 38, 0.3); /* A subtle red glow */
    opacity: 1;
}


/* ========================================
   5. GLOBAL COMPONENT STYLES
   ======================================== */

/* --- General Form Styles --- */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 8px; color: var(--c-text-primary); }
.input-wrapper { position: relative; }
.input-wrapper .input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #9CA3AF; font-size: 16px; }
select.input { -webkit-appearance: none; -moz-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e"); background-position: right 0.7rem center; background-repeat: no-repeat; background-size: 1.5em 1.5em; padding-right: 2.5rem; }
.input { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--c-border); border-radius: var(--radius-md); font-size: 14px; transition: border-color 0.2s, box-shadow 0.2s; background-color: var(--c-bg-card); color: var(--c-text-primary); }
.input.with-icon { padding-left: 40px; }
.input:focus { border-color: var(--c-primary); outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2); }

/* --- Toggle Switch Styles --- */
.form-options { margin-bottom: 32px; display: flex; align-items: center; }
.toggle-switch-container { display: flex; align-items: center; cursor: pointer; user-select: none; }
.toggle-switch-container input { opacity: 0; width: 0; height: 0; }
.toggle-label { font-size: 14px; font-weight: 500; color: var(--c-text-secondary); margin-left: 12px; }
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; background-color: #ccc; border-radius: 34px; transition: background-color 0.3s; }
.toggle-switch::before { content: ""; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; border-radius: 50%; transition: transform 0.3s; }
.toggle-switch-container input:checked + .toggle-switch { background-color: var(--c-primary); }
.toggle-switch-container input:checked + .toggle-switch::before { transform: translateX(20px); }

/* --- Button Styles (Consolidated & Specific) --- */
.btn-primary, .btn-secondary, .btn-icon, .btn-danger, .btn-success, .btn-secondary-sm, .btn-danger-sm, .btn-success-sm { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-family: 'Inter', sans-serif; font-weight: 600; border-radius: var(--radius-md); border: 1px solid transparent; cursor: pointer; transition: all 0.2s ease; text-decoration: none !important; }
.btn-primary:hover, .btn-secondary:hover, .btn-icon:hover, .btn-secondary-sm:hover, .btn-danger-sm:hover, .btn-success-sm:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary { background-color: var(--c-primary); color: white; padding: 10px 16px; font-size: 14px; }
.btn-primary:hover { background-color: #1D4ED8; }
/* Style for visually disabling buttons that need to remain clickable */
.btn-primary.disabled {
    background-color: #A0AEC0; /* A grey color */
    border-color: #A0AEC0;
    opacity: 0.65;
    cursor: not-allowed;
}
.btn-secondary { background-color: #F1F5F9; color: #475569; border: 1px solid #E2E8F0; padding: 10px 16px; font-size: 14px; }
.btn-secondary:hover { background-color: #E2E8F0; border-color: #CBD5E1; }
.btn-icon { height: 44px; width: 44px; padding: 0; background-color: #F1F5F9; color: #475569; border: 1px solid var(--c-border); font-size: 16px; }
.btn-icon:hover { background-color: #E2E8F0; }
.btn-secondary-sm, .btn-danger-sm, .btn-success-sm { padding: 6px 12px; font-size: 13px; font-weight: 500; }
.actions-cell .btn-secondary-sm { background-color: #F1F5F9; color: #475569; border-color: #E2E8F0; }
.actions-cell .btn-secondary-sm:hover { background-color: #E2E8F0; border-color: #CBD5E1; }
.actions-cell .btn-danger-sm { background-color: #FEF2F2; color: #DC2626; border-color: #FECACA; }
.actions-cell .btn-danger-sm:hover { background-color: #FEE2E2; border-color: #FCA5A5; }
.actions-cell .btn-success-sm { background-color: #F0FDF4; color: #16A34A; border-color: #BBF7D0; }
.actions-cell .btn-success-sm:hover { background-color: #DCFCE7; border-color: #86EFAC; }
.btn-danger {
    background-color: var(--c-error);
    color: white;
    padding: 10px 16px;
    font-size: 14px;
}
.btn-danger:hover {
    background-color: #B91C1C; /* A darker red for hover */
}


/* --- Card Styles --- */
.card { background-color: var(--c-bg-card); border-radius: var(--radius-lg); border: 1px solid var(--c-border); box-shadow: var(--shadow-sm); }
.card-header { padding: 16px 24px; border-bottom: 1px solid var(--c-border); }
.card-header .card-title { font-size: 16px; font-weight: 600; color: var(--c-text-primary); margin: 0; }
.card-body { padding: 24px; }
.card-body.no-padding { padding: 0; }

/* --- Table Styles --- */
.table-container { overflow-x: auto; }
.styled-table {
    width: 100%;
    table-layout: auto; /* Let the browser decide column widths */
    border-collapse: collapse;
}
.styled-table thead tr th { background-color: #F8FAFC; padding: 12px 24px; text-align: left; font-size: 12px; font-weight: 600; color: var(--c-text-secondary); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--c-border); }
.styled-table tbody tr td { padding: 16px 24px; font-size: 14px; color: var(--c-text-secondary); border-bottom: 1px solid var(--c-border); vertical-align: middle; }
.styled-table tbody tr:last-child td { border-bottom: none; }
.styled-table tbody tr:hover { background-color: #F8FAFC; }
.actions-cell { 
  /*  display: flex; */
    gap: 8px; 
    align-items: center; 
    
}

/* --- Status Badge Styles --- */
.status-badge { display: inline-block; padding: 4px 12px; border-radius: 9999px; font-size: 12px; font-weight: 600; line-height: 1.5; }
.status-badge.status-active { background-color: #F0FDF4; color: #15803D; }
.status-badge.status-inactive { background-color: #FEF2F2; color: #B91C1C; }

/* --- Modal Styles --- */
.modal-overlay { position: fixed; inset: 0; background-color: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 1100; opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0s 0.3s; }
.modal-overlay.active { opacity: 1; visibility: visible; transition-delay: 0s; }
.modal-content { background-color: var(--c-bg-card); border-radius: var(--radius-lg); width: 100%; max-width: 500px; box-shadow: var(--shadow-lg); transform: scale(0.95); transition: transform 0.3s ease; }
.modal-overlay.active .modal-content { transform: scale(1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--c-border); }
.modal-title { font-size: 18px; font-weight: 600; color: var(--c-text-primary); }
.modal-close-btn { background: none; border: none; font-size: 24px; color: var(--c-text-secondary); cursor: pointer; padding: 0; line-height: 1; }
.modal-body { padding: 24px; max-height: 60vh; overflow-y: auto; }
.modal-body .form-group:last-child { margin-bottom: 0; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--c-border); display: flex; justify-content: flex-end; gap: 12px; background-color: #F8FAFC; }


/* ========================================
6. PAGE-SPECIFIC STYLES
======================================== */

/* --- Dashboard Page --- */
.dashboard-filters .form-group { margin-bottom: 0; }
.dashboard-filters .input-wrapper .input { min-width: 280px; }
.dashboard-row { margin-bottom: 24px; }
.dashboard-grid-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; margin-bottom: 24px; }
.summary-card { display: flex; align-items: center; padding: 24px; gap: 20px; }
.summary-card .card-icon-wrapper { flex-shrink: 0; width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.summary-card .card-icon-wrapper i { font-size: 20px; }
.summary-card .card-title { font-size: 14px; font-weight: 500; color: var(--c-text-secondary); margin-bottom: 4px; }
.summary-card .card-value { font-size: 28px; font-weight: 700; color: var(--c-text-primary); line-height: 1; }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 24px; margin-bottom: 24px; }
.chart-container { position: relative; height: 350px; width: 100%; }
.card-comparison { font-size: 13px; font-weight: 500; color: #64748B; margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.card-comparison.positive { color: #16A34A; }
.card-comparison.negative { color: #DC2626; }

/* --- Fixes for User Management Page --- */

/* Fix for Modal Cancel Buttons */
.btn-secondary {
background-color: #F1F5F9;
color: #475569;
border: 1px solid #E2E8F0;
padding: 10px 16px;
font-size: 14px;
}
.btn-secondary:hover {
background-color: #E2E8F0;
border-color: #CBD5E1;
}

/* --- Permission Checklist Styles --- */
.permission-checklist {
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    padding: 8px;
    max-height: 250px;
    overflow-y: auto;
    background-color: #F8FAFC;
}

.permission-item {
    display: flex;
    align-items: flex-start;
    padding: 12px;
}

.permission-item:not(:last-child) {
    border-bottom: 1px solid var(--c-border);
}

.permission-item input[type="checkbox"] {
    margin-top: 5px;
    margin-right: 12px;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.permission-label {
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.permission-name {
    font-weight: 500;
    color: var(--c-text-primary);
    font-size: 14px;
}

.permission-description {
    color: var(--c-text-secondary);
    font-weight: 400;
    font-size: 13px;
    margin-top: 2px;
}
/* --- System Values Page Styles --- */
.add-record-form {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--c-border);
}

.add-record-form .form-group {
    flex-grow: 1;
    margin-bottom: 0;
}

.add-record-form .form-action-group {
    flex-shrink: 0;
}

#confirmModal .modal-content {
    max-width: 450px;
}
/* --- Manage Forms & Wizard Styles --- */
.status-badge.status-pending-setup {
    background-color: #FEF3C7; /* A light yellow */
    color: #92400E; /* A dark amber */
}


.column-picker-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}
.column-picker-layout .checkbox-container {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    transition: border-color 0.2s, background-color 0.2s;
    cursor: pointer;
}
.column-picker-layout .checkbox-container:hover {
    background-color: #F9FAFB;
    border-color: var(--c-primary);
}
.column-picker-layout .checkbox-container input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-right: 12px;
}

.wizard-table th:nth-child(1) { width: 25%; } /* Nice Name */
.wizard-table th:nth-child(2) { width: 20%; } /* Data Type */
.wizard-table th:nth-child(3) { width: 20%; } /* Visibility */
.wizard-table th:nth-child(4) { width: 35%; } /* Option Values */

/* --- Wizard Field Configuration List --- */
.form-fields-list-container {
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.form-fields-header {
    display: flex;
    padding: 10px 16px;
    background-color: #F8FAFC;
    font-size: 12px;
    font-weight: 600;
    color: var(--c-text-secondary);
    text-transform: uppercase;
    border-bottom: 1px solid var(--c-border);
}

.form-fields-body {
    max-height: 40vh;
    overflow-y: auto;
}

.form-field-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
}

.form-field-row:not(:last-child) {
    border-bottom: 1px solid var(--c-border);
}

.field-col {
    display: flex;
    align-items: center;
}

.field-col .input {
    height: 40px; /* Uniform height for inputs */
}

/* --- Filter Card Styles --- */
.filter-card {
    border-radius: var(--radius-lg);
    background-color: var(--c-bg-card);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
    overflow: visible; /* Allows dropdowns to show */
    position: relative; /* Establishes stacking context */
    z-index: 10;      /* Ensures this card is above elements below it */
}
.filter-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    cursor: pointer;
    background-color: transparent;
    border-bottom: 1px solid transparent;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}
.filter-card.is-open .card-header {
    border-color: var(--c-border);
}
.filter-card .card-header:hover {
    background-color: #F8FAFC;
}
.filter-card .card-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--c-text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.filter-card .card-header .toggle-icon {
    color: var(--c-text-secondary);
    transition: transform 0.3s ease;
}
.filter-card.is-open .card-header .toggle-icon {
    transform: rotate(-180deg);
}
.filter-card .card-body {
    padding: 0 1.5rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}
.filter-card.is-open .card-body {
    padding: 1.5rem;
    max-height: 500px;
}
.filter-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem 1.5rem;
    align-items: flex-end;
}
.filter-button-container {
    display: flex;
    justify-content: flex-end;
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--c-border);
}
.form-action-group {
    display: flex;
    gap: 1rem;
}

/* --- Dropdown Menu (Three dots) --- */
.dropdown-container {
    position: relative;
}
.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    background-color: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    z-index: 100;
    padding: 0.5rem 0;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.dropdown-menu.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}
.dropdown-item {
    display: block;
    padding: 0.75rem 1.25rem;
    color: var(--c-text-primary);
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
}
.dropdown-item:hover {
    background-color: #F8FAFC;
    color: var(--c-primary);
}

/* --- Table Details Row --- */
.lead-details-row td {
    padding: 24px 48px;
    background-color: #F8FAFC;
    border-top: 1px solid #F1F5F9;
}
.lead-details-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem 2rem;
}
.lead-details-content strong {
    font-size: 12px;
    font-weight: 600;
    color: var(--c-text-secondary);
    display: block;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.lead-details-content span {
    font-size: 14px;
    color: var(--c-text-primary);
}
/* Add this entire block to the end of your file */

/* --- Custom Select Dropdown (for Filters) --- */
.custom-select-container {
    position: relative;
}

.custom-select-display {
    display: flex;
    align-items: center;
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    font-size: 14px;
    background-color: var(--c-bg-card);
    color: var(--c-text-primary);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-select-display::after {
    content: '\f078'; /* Font Awesome chevron-down icon */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-left: auto;
    color: var(--c-text-secondary);
}

.custom-select-dropdown {
    display: none;
    position: absolute;
    top: 105%;
    left: 0;
    right: 0;
    background-color: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    max-height: 220px;
    overflow-y: auto;
    z-index: 1050; /* High z-index to appear above other elements */
    box-shadow: var(--shadow-lg);
}

.custom-select-dropdown.active {
    display: block;
}

.custom-select-option {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
}

.custom-select-option:hover {
    background-color: var(--c-primary-light);
    color: var(--c-primary);
}

.custom-select-option input {
    margin-right: 10px;
    flex-shrink: 0;
}

.custom-select-option label {
    cursor: pointer;
    font-weight: 400;
    margin-bottom: 0;
}

/* --- Table Cell Alignment Helper --- */
.styled-table .text-right {
    text-align: right;
}
.styled-table .text-center {
    text-align: center;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--c-border);
    background-color: #F8FAFC;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-usage-info {
    font-size: 13px;
    color: var(--c-text-secondary);
}
.pagination-controls {
    display: flex;
    gap: 8px;
}

/* Add this to the end of the file */

/* --- Rearrange Columns Modal UI --- */
.draggable-list {
    list-style: none;
    padding: 0;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    background-color: #F8FAFC;
    padding: 24px;
}

.draggable {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 12px 16px;
    margin-bottom: 8px;
    cursor: grab;
    background-color: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    font-weight: 500;
    user-select: none;
}

.draggable:last-child {
    margin-bottom: 0;
}

.draggable:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--c-primary);
}

.draggable.dragging {
    opacity: 0.5;
    background: var(--c-primary-light);
    box-shadow: var(--shadow-lg);
}

.drag-handle {
    color: var(--c-text-secondary);
    cursor: grab;
}

.draggable.dragging .drag-handle {
    cursor: grabbing;
}

/* Add this to the end of the file */

/* --- Table Details Row --- */
.lead-details-row td {
    padding: 24px 48px;
    background-color: #F8FAFC;
    border-top: 1px solid #F1F5F9;
}
.lead-details-content {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 1rem 2rem;
    align-items: center;
}
.lead-details-content strong {
    font-size: 12px;
    font-weight: 600;
    color: var(--c-text-secondary);
    text-align: left;
}
.lead-details-content span {
    font-size: 12px;
    color: var(--c-text-secondary);
}

/* Add this to the end of the file */

/* --- Configure Fields Modal Grid Layout --- */
.config-fields-grid .grid-header,
.config-fields-grid .grid-row {
    display: grid;
    grid-template-columns: 2fr 1.5fr 80px 2fr 60px;
    gap: 16px;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--c-border);
}

.config-fields-grid .grid-header {
    background-color: #F8FAFC;
    font-size: 12px;
    font-weight: 600;
    color: var(--c-text-secondary);
    text-transform: uppercase;
}

.config-fields-grid .grid-row:last-child {
    border-bottom: none;
}

.config-fields-grid .grid-cell {
    display: flex;
    align-items: center;
}

.config-fields-grid .grid-cell.justify-center {
    justify-content: center;
}

/* Add this to the end of the file */

/* --- Text Area Specific Styles --- */
textarea.input {
    height: auto; /* Override the fixed height */
    min-height: 120px; /* Set a taller default height */
    padding: 8px 12px; /* Add top and bottom padding */
    resize: vertical; /* Allow vertical resizing, but not horizontal */
}

/* --- Options Manager Modal List (from manual_leads.php) --- */
.options-list {
    list-style: none;
    padding: 0;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
}

.options-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background-color: var(--c-bg-card);
}

.options-list li:not(:last-child) {
    border-bottom: 1px solid var(--c-border);
}

/* --- Filter Card Collapse Functionality --- */
.filter-card.collapsed .card-body {
    display: none;
}

.filter-card.collapsed .toggle-icon {
    transform: rotate(-90deg);
    transition: transform 0.2s ease-in-out;
}

.filter-card .toggle-icon {
    transition: transform 0.2s ease-in-out;
}


/* --- Style for Read-Only Inputs in Modals --- */
.readonly-field {
    background-color: #F8FAFC; /* A light grey */
    color: var(--c-text-secondary);
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px dashed var(--c-border);
    font-size: 14px;
    min-height: 44px;
    word-break: break-word; /* Ensures long text wraps */
}

/* --- Sync History Status Colors --- */
.status-badge.status-success {
    background-color: var(--c-success-bg);
    color: var(--c-success);
}

.status-badge.status-danger {
    background-color: var(--c-danger-bg);
    color: var(--c-error);
}

.status-badge.status-info {
    background-color: #EFF6FF; /* A light blue */
    color: #2563EB;      /* A medium blue */
}

.header-actions .btn-primary {
    height: 44px;
}

/* Base style for all cells */
.styled-table td {
    padding: 16px 24px;
    vertical-align: top; /* Align all text to the top */
}

/* For long text cells: let them wrap */
.styled-table .wrap-cell {
    white-space: normal;
    word-break: break-word;
}

/* For short text cells: keep them on a single line */
.styled-table .no-wrap-cell {
    white-space: nowrap;
}

/* For the Actions column: keep it from wrapping */
.styled-table .actions-cell {
    width: 1%;
    white-space: nowrap;
}

/* --- Animations for Details Section --- */

/* By default, the details row is hidden */
.lead-details-row {
    display: none;
}

/* When it's open, display it as a table row */
.lead-details-row.is-open {
    display: table-row;
}

/* --- Final, Working Animations for Details Section --- */

/* 1. Arrow Rotation Animation */
.btn-toggle-details i {
    transition: transform 0.3s ease; /* Animate the arrow icon's rotation */
}

.btn-toggle-details.active i {
    transform: rotate(180deg); /* When active, flip the icon upside down */
}

/* 2. Section Slide-Down Animation */
.lead-details-row .details-container {
    max-height: 0; /* By default, the content container has no height */
    overflow: hidden; /* Hide the content when it has no height */
    transition: max-height 0.4s ease-in-out, padding 0.3s ease-in-out; /* Animate the change! */
    padding-top: 0;
    padding-bottom: 0;
    box-sizing: border-box;
}

.lead-details-row.is-open .details-container {
    max-height: 500px; /* When open, animate to a large height */
    padding-top: 16px; /* Animate the padding back in */
    padding-bottom: 16px;
}

/* --- Custom Multiselect Filter Dropdown (Final Fix) --- */
.custom-multiselect-container {
    position: relative;
}

.custom-multiselect-display {
    background-color: var(--c-bg-input);
    border: 1px solid var(--c-border);
    border-radius: 8px;
    padding: 10px 16px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 44px;
    display: flex;
    align-items: center;
}

.custom-multiselect-dropdown {
    display: none;
    position: fixed; /* Use fixed positioning to escape containers */
    background-color: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    padding: 8px;
    z-index: 1000; /* High z-index to appear on top of everything */
    max-height: 200px;
    overflow-y: auto;
    width: auto; /* Let the content determine the width */
    min-width: 220px; /* Ensure it's not too narrow */
}

.custom-multiselect-dropdown.active {
    display: block;
}

.checkbox-container-filter {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
}

.checkbox-container-filter:hover {
    background-color: var(--c-bg-hover);
}

.checkbox-container-filter input {
    margin-right: 8px;
}

/* --- Custom Radio Filter Dropdown --- */
.custom-radio-container {
    position: relative;
}

.custom-radio-display {
    background-color: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 44px;
    display: flex;
    align-items: center;
    font-size: 14px;
    color: var(--c-text-primary);
}

.custom-radio-dropdown {
    display: none;
    position: fixed; /* Use fixed positioning to escape containers */
    background-color: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    padding: 8px;
    z-index: 1000; /* High z-index to appear on top of everything */
    max-height: 200px;
    overflow-y: auto;
    width: auto;
    min-width: 220px;
}

.custom-radio-dropdown.active {
    display: block;
}

.radio-container-filter {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
}

.radio-container-filter:hover {
    background-color: #F8FAFC;
}

.radio-container-filter input {
    margin-right: 8px;
}

.filter-range-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* --- FINAL: Lead Details Section Styles --- */
.details-wrapper {
    background-color: #FFFFFF;
    border: 1px solid #E5E7EB; /* Main container border */
    border-radius: 8px;      /* Curved edges */
    overflow: hidden;        /* Keeps content within the curved edges */
}

.details-grid-row {
    display: grid;
    grid-template-columns: 180px 1fr; /* Label column width */
    align-items: start;
    padding: 12px 16px;
    border-bottom: 1px solid #E5E7EB; /* Border between rows */
}

/* This is your clever fix for the padding */
.details-wrapper > div:first-child {
    padding-top: 16px;
}
.details-wrapper > div:last-child {
    border-bottom: none;
    padding-bottom: 16px;
}

.details-grid-row strong {
    color: #6B7280;         /* Grey color for labels */
    font-weight: 500;
}

.details-grid-row span {
    color: #111827;         /* Black color for values */
    word-break: break-word; /* Prevents long text from overflowing */
}

/* --- Special styling for Text Area fields --- */
.details-textarea-row {
    padding: 16px;
    border-bottom: 1px solid #E5E7EB;
}

.details-textarea-row strong {
    color: #6B7280;
    font-weight: 500;
    display: block;
    margin-bottom: 8px;
}

.details-textarea-content {
    background-color: #F9FAFB; /* Light grey background for the box */
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    padding: 12px;
    font-size: 14px;
    line-height: 1.5;
    color: #111827;
    word-break: break-word;
}

/* --- Table Row Hover Highlight --- */
#leadsTable tbody tr {
    /* This makes the color change smooth instead of instant */
    transition: background-color 0.2s ease-in-out;
}

#leadsTable tbody tr:hover {
    /* A light grey color for the highlight */
    background-color: #F8FAFC; 
    /* Changes the mouse cursor to a pointer to show it's clickable */
    cursor: pointer;
}

/* --- NEW: Hover Highlight for Details Rows --- */
.details-grid-row, .details-textarea-row {
    transition: background-color 0.2s ease-in-out;
}

.details-grid-row:hover, .details-textarea-row:hover {
    background-color: #F8FAFC; /* The same light grey as the table hover */
}

/* --- Adds spacing in Edit Lead modal for radios/checkboxes --- */
.radio-group input[type="radio"],
.checkbox-group input[type="checkbox"] {
    margin-right: 8px;
}

.required-asterisk {
    color: var(--c-error);
    font-weight: bold;
    margin-left: 4px;
}

.form-group.error .input,
.form-group.error .radio-group,
.form-group.error .checkbox-group {
    border-color: var(--c-error);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.form-group.error label {
    color: var(--c-error);
}

/* --- Form Setup Wizard --- */
.wizard-stepper {
    display: flex;
    padding: 20px 24px;
    border-bottom: 1px solid var(--c-border);
    background-color: #F8FAFC;
}
.wizard-stepper .step {
    flex: 1;
    text-align: center;
    color: var(--c-text-secondary);
    font-weight: 500;
    position: relative;
    font-size: 14px;
}
.wizard-stepper .step .step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--c-border);
    color: var(--c-text-secondary);
    margin-bottom: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid var(--c-border);
}
.wizard-stepper .step.active .step-number {
    background-color: var(--c-primary-light);
    color: var(--c-primary);
    border-color: var(--c-primary);
}
.wizard-stepper .step.active {
    color: var(--c-primary);
    font-weight: 600;
}

.btn-primary-sm {
    background-color: var(--c-primary);
    color: white;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
}
.btn-primary-sm:hover {
    background-color: #1D4ED8;
}

.btn-secondary-sm.disabled {
    background-color: #F8FAFC;
    color: #CBD5E1;
    border-color: #E2E8F0;
    cursor: not-allowed;
    box-shadow: none;
}
.btn-secondary-sm.disabled:hover {
    transform: none;
}

.input-with-button {
    display: flex;
    align-items: center;
    gap: 12px;
}
.input-with-button .input {
    flex-grow: 1;
}
.input-with-button .btn-secondary {
    flex-shrink: 0;
}
#syncStatus.status-danger {
    color: var(--c-error);
    font-weight: 500;
}

.branding-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: stretch; /* This is the fix */
}
.branding-section .image-preview {
    margin-top: 8px;
    margin-bottom: 1rem;
    min-height: 60px; /* Ensures the container has a height even if empty */
}

input[type="file"].input {
    line-height: 40px;
}

.color-picker-group {
    display: flex;
    align-items: center;
    gap: 12px;
}
input[type="color"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 40px;
    height: 40px;
    background-color: transparent;
    border: none;
    cursor: pointer;
}
input[type="color"]::-webkit-color-swatch {
    border-radius: 8px;
    border: 1px solid #E2E8F0;
}
input[type="color"]::-moz-color-swatch {
    border-radius: 8px;
    border: 1px solid #E2E8F0;
}

/* Theme Customization Grid */
.theme-color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* 3 columns, responsive */
    gap: 1.5rem; /* Space between grid items */
    margin-bottom: 2rem; /* Space below the grid */
}


.color-picker-group input[type="color"] {
    width: 40px; /* Adjust size as needed */
    height: 40px; /* Adjust size as needed */
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
}

.color-picker-group input[type="text"] {
    flex-grow: 1; /* Allow text input to take remaining space */
    width: auto; /* Override default input width */
}

.image-preview img {
    width: 100%;
    height: 120px; /* A fixed height */
    object-fit: contain;
    display: block;
    background-color: #f8fafc; /* A light grey background */
    border-radius: var(--radius-md);
    border: 1px solid var(--c-border);
    padding: 8px;
}

.image-dimensions {
    font-size: 12px;
    color: var(--c-text-secondary);
    text-align: left;
    margin-top: 8px;
}

/* Profile Management Page Specific Styles */
.grid-2-col-profile {
    display: grid;
    grid-template-columns: 1fr; /* Default to single column for smaller screens */
    gap: 20px; /* Add spacing between cards */
}

.profile-picture-preview {
    width: 120px; /* Fixed size for the circle */
    height: 120px;
    border-radius: 50%; /* Makes it a perfect circle */
    background-color: #f0f2f5; /* Greyer background color */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Ensures image stays within the circle */
    margin: 0 auto 15px auto; /* Center it and add space below */
    border: 1px solid var(--c-border); /* Subtle border */
}

@media (min-width: 768px) { /* Two columns for medium screens and up */
    .grid-2-col-profile {
        grid-template-columns: 1fr 2fr; /* Profile Picture card smaller, Details card wider */
    }
}

.profile-picture-preview img {
    width: 100%; /* Make image fill the circle */
    height: 100%;
    object-fit: cover; /* Crop image to fit without distortion */
}

/* You might want to remove or adjust the margin-bottom for the card */
/* from the .card style if it interferes with the new grid gap. */
/* If you have a .card style like: */
/* .card { margin-bottom: 2rem; } */
/* You might want to change it to: */
/* .card:not(:last-child) { margin-bottom: 2rem; } */
/* or simply rely on the grid gap. */

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* --- New Subscription Card Design --- */
.subscription-info-card {
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-lg);
  margin-top: 2rem;
  overflow: hidden;
  position: relative;
  border: none;
}

.subscription-info-card .card-header-bg {
  background-color: #f0f0f0; /* Change header background to a very light grey or white */
  color: var(--c-text-primary); /* Default text color for header */
  padding: 3rem 1.5rem 2rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.subscription-info-card .card-header-bg::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color:#1E293B;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: bottom;
  z-index: 1;
}

.subscription-info-card .card-header-bg > * {
  position: relative;
  z-index: 2;
}

.subscription-info-card .plan-name {
  font-size: 22px;
  font-weight: 700;
  /* Removed margin-bottom as it's not needed without price */
  color: #ffffff; /* Make the plan name blue */
}

/* Removed .plan-price and .price-unit CSS as they are no longer in HTML */

.subscription-info-card .card-body {
  padding: 24px 32px;
}

.subscription-info-card .features-list {
  list-style: none;
  padding: 0;
  margin-bottom: 24px;
}

.subscription-info-card .features-list .info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px dashed var(--c-border);
}

.subscription-info-card .features-list .info-row:last-child {
  border-bottom: none;
}

.subscription-info-card .info-label {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.subscription-info-card .info-label strong {
  font-size: 15px;
  font-weight: 600;
  color: var(--c-text-primary);
}

.subscription-info-card .info-label .sub-text {
  font-size: 13px;
  color: var(--c-text-secondary);
  font-weight: 400;
  margin-top: 4px;
}

.subscription-info-card .info-value {
  text-align: right;
  flex-shrink: 0;
  padding-left: 1rem;
}

.subscription-info-card .info-value span {
  font-size: 15px;
  font-weight: 600;
  color: var(--c-text-primary);
}

.subscription-info-card .contact-btn {
  display: block;
  width: 100%;
  text-align: center;
  padding: 12px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-md);
  background-color: #1E293B;
  color: white;
  border: none;
  transition: all 0.2s ease;
}

.subscription-info-card .contact-btn:hover {
  background-color: #1D4ED8;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.2);
}
.subscription-info-card .plan-description {
  font-size: 14px;
  font-weight: 400;
  color: #ffffff;
  margin-top: 5px;
}

/* Google Sign-in Button Styles */
.login-button.google-btn {
  background-color: #FFFFFF;
  color: var(--c-text-primary);
  border: 1px solid var(--c-border);
  box-shadow: none;
  font-weight: 500;
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-decoration: none;
}

.login-button.google-btn:hover {
  background-color: #F8FAFC;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.login-button.google-btn i {
  font-size: 16px;
}

/* --- START WHATSAPP SIDEBAR STYLES (WhatsApp Theme) --- */

.sidebar-right {
    position: fixed;
    top: 0;
    right: -450px; /* Start off-screen */
    width: 420px;
    height: 100%;
    background-color: #f0f0f0; /* A neutral fallback */
    box-shadow: -2px 0 15px rgba(0,0,0,0.1);
    transition: right 0.3s ease-in-out;
    z-index: 1050;
    display: flex;
    flex-direction: column;
}

.sidebar-right.active {
    right: 0; /* Slide in */
}

#sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out;
}

#sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* --- THEME CHANGE: WhatsApp Green Header --- */
.profile-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background-color: #005E54; /* WhatsApp dark green */
    color: white; /* White text */
    flex-shrink: 0;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.profile-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-name {
    font-weight: 600;
    color: white; /* White text */
}

.profile-phone {
    font-size: 0.85rem;
    color: #f0f0f0; /* Lighter text for the phone number */
    opacity: 0.9;
}

.sidebar-close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: white; /* White close button */
    cursor: pointer;
    line-height: 1;
}

/* --- THEME CHANGE: WhatsApp Background Pattern --- */
.sidebar-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
    /* --- Alternative Dotted Pattern --- */
    background-color: #E5DDD5;
    background-image: radial-gradient(#BDBDBD 1px, transparent 1px);
    background-size: 10px 10px;
}

.chat-bubble {
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    max-width: 80%;
    word-wrap: break-word;
    box-shadow: 0 1px 1px rgba(0,0,0,0.08);
}

/* --- THEME CHANGE: WhatsApp White Received Bubble --- */
.chat-bubble-received {
    background-color: #FFFFFF;
    color: var(--c-text-primary);
    border-top-left-radius: 0;
    align-self: flex-start;
}

/* --- THEME CHANGE: WhatsApp Light Green Sent Bubble --- */
.chat-bubble-sent {
    background-color: #DCF8C6;
    color: var(--c-text-primary);
    border-top-right-radius: 0;
    margin-left: auto; /* Push to the right */
}

.chat-text {
    font-size: 0.9rem;
    line-height: 1.4;
}

.chat-time {
    font-size: 0.7rem;
    color: #999; /* Grey time text */
    text-align: right;
    margin-top: 4px;
}

.sidebar-loading, .sidebar-error {
    padding: 2rem;
    text-align: center;
    color: #6B7280;
}

.chat-system-event {
    text-align: center;
    margin: 12px auto;
    padding: 4px 12px;
    background-color: #E1F2FB; /* Light blue system message background */
    color: #555;
    border-radius: 9999px;
    font-size: 11px;
    max-width: 90%;
}

.chat-time-event {
    opacity: 0.8;
}

  /* This new block adds the spacing and alignment for the footer */
  .chat-footer {
    display: flex;
    justify-content: space-between; /* Puts name on left, time on right */
    align-items: center;
    margin-top: 5px; /* Adds the 5px space you requested */
  }
  .chat-sender-name {
    color: #999; /* Makes name slightly darker than the time */
    font-size: 0.7rem;
  }
/* --- END WHATSAPP SIDEBAR STYLES --- */

/* =================================================================== */
/* Sync Progress Modal Styling
/* =================================================================== */

.sync-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
}

.sync-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sync-modal-content {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 700px;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.sync-modal-overlay.active .sync-modal-content {
    transform: scale(1);
}

.sync-modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.sync-modal-title {
    margin: 0;
    font-size: 1.25rem;
    color: #333;
}

.sync-modal-body {
    padding: 1.5rem;
}

.sync-progress-bar-container {
    height: 12px;
    width: 100%;
    background-color: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.sync-progress-bar {
    height: 100%;
    width: 0%;
    background-color: var(--c-primary);
    border-radius: 6px;
    transition: width 0.4s ease-in-out;
}

.sync-progress-bar.progress-bar-success {
    background-color: var(--c-success);
}

.sync-progress-bar.progress-bar-danger {
    background-color: var(--c-error);
}

.sync-log-output {
    background-color: #2d3748; /* Dark background */
    color: #e2e8f0;           /* Light text */
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875rem;
    padding: 1rem;
    border-radius: 6px;
    height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    border: 1px solid #4a5568;
}

.sync-modal-footer {
    padding: 1rem 1.5rem;
    text-align: right;
    border-top: 1px solid #e0e0e0;
    background-color: #f8f9fa;
}

/* =================================================================== */
/* Page Load Animation (Specific)
/* =================================================================== */

/* Page Load Animation (Specific) */
.content-to-animate {
    opacity: 0;
    transition: opacity 0.4s ease-in-out; /* A simple, clean fade-in */
}

.content-to-animate.loaded {
    opacity: 1;
}

/* =================================================================== */
/* Table Header Sorting Links
/* =================================================================== */

/* 1. Remove the default blue color and underline */
.styled-table thead th a {
    text-decoration: none;
    color: inherit; /* This makes the link inherit the grey color of the header text */
    display: block; /* Makes the entire header area clickable */
}

/* 2. Add a subtle hover effect to show it's interactive */
.styled-table thead th a:hover {
    color: var(--c-primary); /* On hover, change the text color to your primary theme color */
}