/* ===================================
   HUD ADMIN STYLE - DARK FUTURISTIC THEME
   =================================== */

:root {
    /* Dark Theme Colors */
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #1c2128;
    --bg-card: #21262d;
    
    /* Accent Colors */
    --accent-primary: #00d9ff;
    --accent-secondary: #00ffc8;
    
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    
    /* Border & Effects */
    --border-color: #30363d;
    --corner-size: 12px;
    --corner-thickness: 2px;
    --glow: 0 0 20px rgba(0, 217, 255, 0.3);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme */
body[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f6f8fa;
    --bg-tertiary: #eaeef2;
    --bg-card: #ffffff;
    --text-primary: #24292f;
    --text-secondary: #57606a;
    --text-muted: #6e7781;
    --border-color: #d0d7de;
}

/* Color Themes */
body[data-color="cyan"] {
    --accent-primary: #00d9ff;
    --accent-secondary: #00ffc8;
    --glow: 0 0 20px rgba(0, 217, 255, 0.3);
}

body[data-color="blue"] {
    --accent-primary: #0066ff;
    --accent-secondary: #00d9ff;
    --glow: 0 0 20px rgba(0, 102, 255, 0.3);
}

body[data-color="purple"] {
    --accent-primary: #9d4edd;
    --accent-secondary: #c77dff;
    --glow: 0 0 20px rgba(157, 78, 221, 0.3);
}

body[data-color="pink"] {
    --accent-primary: #ff006e;
    --accent-secondary: #ff5d8f;
    --glow: 0 0 20px rgba(255, 0, 110, 0.3);
}

body[data-color="orange"] {
    --accent-primary: #ff9500;
    --accent-secondary: #ffb700;
    --glow: 0 0 20px rgba(255, 149, 0, 0.3);
}

body[data-color="yellow"] {
    --accent-primary: #ffd60a;
    --accent-secondary: #ffe66d;
    --glow: 0 0 20px rgba(255, 214, 10, 0.3);
}

body[data-color="green"] {
    --accent-primary: #00ff88;
    --accent-secondary: #00ffc8;
    --glow: 0 0 20px rgba(0, 255, 136, 0.3);
}

body[data-color="red"] {
    --accent-primary: #ff0054;
    --accent-secondary: #ff5d8f;
    --glow: 0 0 20px rgba(255, 0, 84, 0.3);
}

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

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    font-size: 13px;
}

h1 { font-size: 20px; margin-bottom: 12px; }
h2 { font-size: 18px; margin-bottom: 10px; }
h3 { font-size: 16px; margin-bottom: 8px; }
h4 { font-size: 14px; margin-bottom: 6px; }
h5 { font-size: 13px; margin-bottom: 6px; }
h6 { font-size: 12px; margin-bottom: 6px; }

/* ===================================
   HEADER
   =================================== */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 12px;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-primary);
    text-decoration: none;
}

.logo-icon {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 14px;
}

.header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.header-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition);
    position: relative;
}

.header-btn:hover {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.user-profile:hover {
    background: var(--bg-card);
    box-shadow: var(--glow);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
}

.user-name {
    font-size: 13px;
    color: var(--text-primary);
}

/* User Dropdown Menu */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    z-index: 1002;
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    font-size: 13px;
}

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

.dropdown-item i {
    width: 18px;
    text-align: center;
    font-size: 14px;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 6px 0;
}

/* ===================================
   SIDEBAR
   =================================== */

.sidebar {
    position: fixed;
    top: 48px;
    left: 0;
    width: 180px;
    height: calc(100vh - 48px);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    transition: var(--transition);
    z-index: 999;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--accent-cyan);
}

.sidebar-nav {
    padding: 8px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    border-left: 2px solid transparent;
    font-size: 12px;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-left-color: var(--accent-primary);
}

.nav-item.active {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
    border-left-color: var(--accent-primary);
}

.nav-item i {
    font-size: 13px;
    width: 18px;
    text-align: center;
}

.nav-accordion > .nav-item {
    position: relative;
}

.nav-accordion-icon {
    margin-left: auto;
    transition: var(--transition);
}

.nav-accordion.expanded .nav-accordion-icon {
    transform: rotate(180deg);
}

.nav-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.nav-accordion.expanded .nav-accordion-content {
    max-height: 2000px;
}

.nav-accordion-content .nav-item {
    padding-left: 36px;
    font-size: 11px;
}

/* ===================================
   MAIN CONTENT
   =================================== */

.main-content {
    margin-left: 180px;
    margin-top: 48px;
    padding: 16px;
    min-height: calc(100vh - 48px);
    transition: var(--transition);
}

/* ===================================
   HUD CARD WITH CORNER BRACKETS
   =================================== */

.hud-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px;
    position: relative;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.hud-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--glow);
}

/* Corner Brackets */
.hud-card::before,
.hud-card::after {
    content: '';
    position: absolute;
    width: var(--corner-size);
    height: var(--corner-size);
    border: var(--corner-thickness) solid var(--accent-primary);
}

.hud-card::before {
    top: -1px;
    left: -1px;
    border-right: none;
    border-bottom: none;
    border-top-left-radius: 12px;
}

.hud-card::after {
    top: -1px;
    right: -1px;
    border-left: none;
    border-bottom: none;
    border-top-right-radius: 12px;
}

.hud-card .corner-bottom-left,
.hud-card .corner-bottom-right {
    position: absolute;
    width: var(--corner-size);
    height: var(--corner-size);
    border: var(--corner-thickness) solid var(--accent-primary);
}

.hud-card .corner-bottom-left {
    bottom: -1px;
    left: -1px;
    border-right: none;
    border-top: none;
    border-bottom-left-radius: 12px;
}

.hud-card .corner-bottom-right {
    bottom: -1px;
    right: -1px;
    border-left: none;
    border-top: none;
    border-bottom-right-radius: 12px;
}

/* ===================================
   STAT CARDS
   =================================== */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
}

@media (max-width: 1400px) {
    .stat-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 900px) {
    .stat-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 12px;
    position: relative;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-primary);
    box-shadow: var(--glow);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.stat-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-primary);
    font-weight: 600;
}

.stat-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.stat-change {
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-change.positive {
    color: var(--accent-primary);
}

.stat-change.positive i {
    color: var(--accent-primary);
}

.stat-change.negative {
    color: #ff006e;
}

.stat-change.negative i {
    color: #ff006e;
}

/* ===================================
   THEME CUSTOMIZER
   =================================== */

.theme-panel {
    position: fixed;
    top: 60px;
    right: -320px;
    width: 320px;
    height: calc(100vh - 48px);
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    padding: 16px;
    overflow-y: auto;
    transition: var(--transition);
    z-index: 1001;
}

.theme-panel.open {
    right: 0;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
}

.theme-section {
    margin-bottom: 30px;
}

.theme-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.theme-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.theme-option {
    padding: 12px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.theme-option:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.theme-option.active {
    border-color: var(--accent-primary);
    background: var(--bg-card);
    color: var(--accent-primary);
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.color-option {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: var(--transition);
    position: relative;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.active {
    border-color: var(--text-primary);
}

.color-option.active::after {
    content: '?';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

/* ===================================
   FORM CONTROLS
   =================================== */

.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
    font-family: inherit;
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.1);
}

.form-control::placeholder,
input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

.form-control:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

select.form-control,
select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b949e' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* Form Groups */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

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

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===================================
   RESPONSIVE
   =================================== */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .user-name {
        display: none;
    }
}

/* ===================================
   ANIMATIONS
   =================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.pulse {
    animation: pulse 2s infinite;
}
/* ===================================
   GLOBAL TABLE STYLES
   =================================== */

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

thead th {
    padding: 8px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-primary);
    border-bottom: 1px solid var(--border-color);
}

tbody td {
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
}

tbody tr:hover {
    background: var(--bg-tertiary);
}

/* Input fields in tables */
table input[type="text"],
table input[type="number"],
table input[type="email"],
table input[type="date"],
table select,
table textarea {
    padding: 4px 8px;
    font-size: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
}

/* Buttons in tables */
table button,
table .btn {
    padding: 4px 8px;
    font-size: 11px;
}

/* Form elements */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="time"],
select,
textarea {
    padding: 6px 10px;
    font-size: 13px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
}

label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
    display: inline-block;
}

/* Card titles and headers */
.card-title,
.section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.card-subtitle,
.section-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* ===================================
   DASHBOARD SPECIFIC STYLES
   =================================== */

.dashboard-container {
    /* Container already has padding from .main-content */
}

.dashboard-header {
    margin-bottom: 16px;
}

.dashboard-header h1 {
    color: var(--accent-primary);
    margin: 0;
}

.dashboard-date-card {
    margin-bottom: 16px;
}

.date-range-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.date-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-input-group label {
    white-space: nowrap;
}

.dashboard-date-input {
    padding: 6px 10px;
    font-size: 12px;
}

.dashboard-date-input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

.dashboard-filter-select {
    padding: 6px 10px;
    font-size: 12px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    min-width: 140px;
    max-width: 200px;
}

.dashboard-filter-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.dashboard-filter-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.date-presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-left: auto;
}

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

.btn-secondary:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border: none;
}

.btn-primary:hover {
    opacity: 0.9;
}

.loading-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
}

.loading-state i {
    font-size: 20px;
    margin-bottom: 12px;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.charts-grid-small {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.activity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 16px;
}

.chart-title {
    color: var(--accent-primary);
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
}

.chart-canvas {
    max-height: 250px;
}

.customers-map {
    height: 250px;
    position: relative;
}

.activity-content {
    max-height: 350px;
    overflow-y: auto;
}

.loading-text {
    text-align: center;
    color: var(--text-secondary);
    padding: 16px;
}

.error-text {
    color: #ff006e;
}

/* ===================================
   PATIENT PROGRESSION CARD
   =================================== */

.progression-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 16px;
}

.progression-card {
    grid-column: 1 / -1;
}

.progression-content {
    overflow-x: auto;
}

.progression-steps {
    display: flex;
    align-items: stretch;
    gap: 0;
    min-width: 800px;
}

.progression-step {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    padding: 16px 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    min-height: 110px;
}

.progression-step:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.15);
}

.progression-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.progression-icon i {
    font-size: 16px;
    color: #fff;
}

.progression-info {
    flex: 1;
    min-width: 0;
}

.progression-title {
    color: var(--accent-primary);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.progression-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
}

.progression-metric {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
}

.progression-metric i {
    color: var(--text-secondary);
    font-size: 11px;
    margin-right: 3px;
}

.progression-extra {
    color: #ff6644;
    font-size: 12px;
    font-weight: 600;
    margin-top: 4px;
}

.progression-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    flex-shrink: 0;
    color: var(--accent-primary);
    font-size: 18px;
    opacity: 0.6;
}

@media (max-width: 1200px) {
    .progression-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .progression-steps {
        flex-direction: column;
        min-width: auto;
    }
    .progression-arrow {
        transform: rotate(90deg);
        padding: 4px 0;
    }
    .progression-step {
        min-height: auto;
    }
}

/* Responsive adjustments for dashboard */
@media (max-width: 1200px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-grid-small {
        grid-template-columns: 1fr;
    }
    
    .activity-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .date-range-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .date-presets {
        margin-left: 0;
        width: 100%;
    }
    
    .stat-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ===================================
   PAGE LAYOUT UTILITIES
   =================================== */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.page-title {
    color: var(--accent-primary);
    margin: 0;
    font-size: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.page-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ===================================
   FORM LAYOUTS
   =================================== */

.form-grid {
    display: grid;
    gap: 12px;
}

.form-grid-2 {
    grid-template-columns: 1fr 1fr;
}

.form-grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.form-grid-4 {
    grid-template-columns: 1fr 1fr 1fr 1fr;
}

.form-group {
    margin-bottom: 12px;
}

.form-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* ===================================
   MODAL STYLES
   =================================== */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    max-width: 1200px;
    width: 95%;
    margin: 20px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content-large {
    max-width: 1400px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    color: var(--accent-primary);
    font-size: 18px;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text-primary);
}

/* ===================================
   INFO CARDS
   =================================== */

.info-card {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
}

.info-card-title {
    color: var(--accent-primary);
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
}

/* ===================================
   FILTER SECTIONS
   =================================== */

.filter-section {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.filter-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ===================================
   ACTION BUTTONS
   =================================== */

.btn-group {
    display: flex;
    gap: 8px;
}

.btn-icon {
    padding: 6px 12px;
}

.btn-success {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: none;
}

.btn-success:hover {
    opacity: 0.9;
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    border: none;
}

.btn-danger:hover {
    opacity: 0.9;
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107, #ff9800);
    color: #000;
    border: none;
}

.btn-warning:hover {
    opacity: 0.9;
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8, #138496);
    color: white;
    border: none;
}

.btn-info:hover {
    opacity: 0.9;
}

/* ===================================
   STATUS BADGES
   =================================== */

.badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
}

.badge-success {
    background: #00ff8822;
    border: 1px solid #00ff88;
    color: #00ff88;
}

.badge-danger {
    background: #ff6b6b22;
    border: 1px solid #ff6b6b;
    color: #ff6b6b;
}

.badge-warning {
    background: #ffc10722;
    border: 1px solid #ffc107;
    color: #ffc107;
}

.badge-info {
    background: #17a2b822;
    border: 1px solid #17a2b8;
    color: #17a2b8;
}

.badge-secondary {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

/* ===================================
   LOADING STATES
   =================================== */

.loading-container {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
}

.loading-spinner {
    font-size: 20px;
    margin-bottom: 12px;
}

/* ===================================
   EMPTY STATES
   =================================== */

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ===================================
   DATA DISPLAY
   =================================== */

.data-grid {
    display: grid;
    gap: 16px;
}

.data-grid-2 {
    grid-template-columns: 1fr 1fr;
}

.data-grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.data-grid-4 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
}

.data-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.data-label {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
}

.data-value {
    color: var(--text-primary);
    font-size: 13px;
}

/* ===================================
   UTILITY CLASSES
   =================================== */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }

.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }

.p-8 { padding: 8px; }
.p-12 { padding: 12px; }
.p-16 { padding: 16px; }
.p-20 { padding: 20px; }
.p-24 { padding: 24px; }

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

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

/* ===================================
   RESPONSIVE UTILITIES
   =================================== */

@media (max-width: 768px) {
    .form-grid-2,
    .form-grid-3,
    .form-grid-4,
    .data-grid-2,
    .data-grid-3,
    .data-grid-4 {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .modal-content {
        width: 100%;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
    }
}

/* ===================================
   QA QUEUE & MODAL SPECIFIC STYLES
   =================================== */

.edit-field {
    display: none;
    width: 100%;
    padding: 6px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 13px;
}

.edit-field.show {
    display: block;
}

.view-field {
    display: block;
    color: var(--text-primary);
    font-size: 13px;
    min-height: 20px;
}

.insurance-tab-btn {
    padding: 12px 16px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
    font-size: 13px;
}

.insurance-tab-btn.active {
    border-bottom-color: var(--accent-primary);
    color: var(--accent-primary);
}

.insurance-tab-btn:hover {
    color: var(--text-primary);
}

.tab-container {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* City/State/Zip grid */
.address-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 8px;
}

/* Emergency contact grid */
.emergency-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.emergency-grid .full-width {
    grid-column: 1 / -1;
}

/* Select styling */
select.form-control,
.form-control {
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
}

/* Refresh button */
.btn-refresh {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
}

.btn-refresh:hover {
    background: var(--bg-card);
}


/* ===================================
   FIX FOR REMOVED INLINE STYLES
   =================================== */

/* Insurance tab buttons */
.insurTabBtn {
    padding: 12px 16px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
    font-size: 13px;
}

.insurTabBtn.active {
    border-bottom-color: var(--accent-primary);
    color: var(--accent-primary);
}

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

/* Recording tab buttons */
.recordingTabBtn {
    padding: 10px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
}

.recordingTabBtn.active {
    border-bottom-color: var(--accent-primary);
    color: var(--accent-primary);
}

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

/* Tab content areas */
#insuranceTabContent,
#recordingTabContent {
    min-height: 200px;
    padding: 16px 0;
}

/* Form inputs and selects - full width */
input[type="text"].w-full,
input[type="email"].w-full,
input[type="tel"].w-full,
input[type="date"].w-full,
input[type="time"].w-full,
select.w-full,
textarea.w-full {
    width: 100%;
}

/* Appointment form inputs */
.appointment-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
}

/* Appointment form labels */
.appointment-label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 500;
}

/* Button flex containers */
.btn-flex {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn-flex .btn {
    flex: 1;
    padding: 12px;
    font-weight: 600;
}

/* Lead override section */
#leadOverrideSection {
    margin-bottom: 20px;
}

/* Grid for city/state/zip */
.city-state-zip-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 8px;
}

/* Appointment time grid */
.appointment-time-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}


/* ============================================

/* ============================================
   FLOATING CHAT WIDGET
   ============================================ */

/* Chat badge on header button */
.chat-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #ff4444;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    text-align: center;
}

/* Chat widget container */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 700px;
    height: 600px;
    background: var(--bg-secondary);
    border-radius: var(--corner-size);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), var(--glow);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

/* Chat widget header */
.chat-widget-header {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: var(--bg-primary);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
}

.chat-widget-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--bg-primary);
}

.chat-new-btn,
.chat-minimize-btn,
.chat-close-btn {
    background: transparent;
    border: none;
    color: var(--bg-primary);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.chat-new-btn {
    margin-right: auto;
    margin-left: 8px;
}

.chat-new-btn:hover,
.chat-minimize-btn:hover,
.chat-close-btn:hover {
    opacity: 1;
}

/* Chat widget body */
.chat-widget-body {
    flex: 1;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    background: var(--bg-secondary);
}

/* Sidebar with room list */
.chat-widget-sidebar {
    width: 250px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
}

/* Rooms list */
.chat-widget-rooms {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-secondary);
}

/* Main chat area */
.chat-widget-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

/* Empty state */
.chat-widget-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
}

.chat-room-item {
    display: flex;
    align-items: center;
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
    position: relative;
    background: var(--bg-secondary);
}

.chat-room-item:hover {
    background: var(--bg-tertiary);
}

.chat-room-item.active {
    background: var(--bg-tertiary);
    border-left: 3px solid var(--accent-primary);
}

.chat-room-item.unread {
    background: var(--bg-card);
    font-weight: 600;
}

.chat-room-item.unread .chat-room-name {
    color: var(--accent-primary);
}

.chat-room-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    margin-right: 10px;
    flex-shrink: 0;
}

.chat-room-info {
    flex: 1;
    min-width: 0;
}

.chat-room-name {
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-room-last-message {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-room-unread {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--accent-primary);
    color: var(--bg-primary);
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    text-align: center;
    box-shadow: 0 0 8px rgba(0, 217, 255, 0.5);
}

/* Messages view */
.chat-widget-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-secondary);
}

.chat-widget-messages-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-tertiary);
}

.chat-back-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
    transition: var(--transition);
}

.chat-back-btn:hover {
    color: var(--accent-primary);
}

.chat-widget-messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-primary);
}

/* Individual messages */
.chat-message {
    display: flex;
    flex-direction: column;
    max-width: 75%;
}

.chat-message-own {
    align-self: flex-end;
    align-items: flex-end;
}

.chat-message-other {
    align-self: flex-start;
    align-items: flex-start;
}

.chat-message-sender {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 600;
}

.chat-message-text {
    background: var(--bg-tertiary);
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
    color: var(--text-primary);
    word-wrap: break-word;
    border: 1px solid var(--border-color);
}

.chat-message-own .chat-message-text {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: var(--bg-primary);
    border: none;
}

.chat-message-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Message input */
.chat-widget-input {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    align-items: flex-end;
    background: var(--bg-tertiary);
}

.chat-widget-input textarea {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-primary);
    resize: none;
    max-height: 100px;
    font-family: inherit;
}

.chat-widget-input textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(0, 217, 255, 0.1);
}

.chat-send-btn {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    color: var(--bg-primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.chat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--glow);
}

/* Loading and empty states */
.chat-widget-loading,
.chat-widget-empty,
.chat-widget-error {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

.chat-widget-error {
    color: #ff4444;
}

/* New Chat Modal */
.chat-new-modal {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.chat-new-modal-content {
    background: var(--bg-secondary);
    border-radius: var(--corner-size);
    width: 90%;
    max-width: 400px;
    max-height: 80%;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), var(--glow);
}

.chat-new-modal-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-tertiary);
}

.chat-new-modal-header h4 {
    margin: 0;
    font-size: 16px;
    color: var(--text-primary);
}

.chat-modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    font-size: 16px;
    transition: var(--transition);
}

.chat-modal-close:hover {
    color: var(--text-primary);
}

.chat-new-modal-body {
    padding: 16px;
    overflow-y: auto;
    background: var(--bg-secondary);
}

/* Chat Type Selector */
.chat-type-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.chat-type-btn {
    flex: 1;
    padding: 10px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition);
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.chat-type-btn:hover {
    border-color: var(--accent-primary);
    background: var(--bg-card);
}

.chat-type-btn.active {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-color: var(--accent-primary);
    color: var(--bg-primary);
    font-weight: 600;
}

/* Chat Form */
.chat-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-form label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.chat-select,
.chat-input {
    width: 100%;
    padding: 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    transition: var(--transition);
}

.chat-select option {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.chat-select:focus,
.chat-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(0, 217, 255, 0.1);
}

/* Members List */
.chat-members-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px;
    background: var(--bg-primary);
}

.chat-member-item {
    display: flex;
    align-items: center;
    padding: 8px;
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition);
    background: var(--bg-primary);
}

.chat-member-item:hover {
    background: var(--bg-tertiary);
}

.chat-member-item label {
    cursor: pointer;
    color: var(--text-primary);
}

.chat-member-checkbox {
    margin-right: 10px;
    cursor: pointer;
}

.chat-member-name {
    font-size: 13px;
    color: var(--text-primary);
}

/* Create Button */
.chat-create-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    border-radius: 6px;
    color: var(--bg-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 16px;
    transition: var(--transition);
}

.chat-create-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow);
}

.chat-create-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .chat-widget {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    
    .chat-widget-sidebar {
        width: 100%;
        border-right: none;
    }
    
    .chat-widget-main {
        display: none;
    }
    
    .chat-widget-main.active {
        display: flex;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 10;
    }
    
    .chat-widget-sidebar.hidden {
        display: none;
    }
}

/* ============================================
   SMS WIDGET (Similar to Chat Widget)
   ============================================ */

/* SMS badge on header button */
.sms-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #ff4444;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    text-align: center;
}

/* SMS widget container */
.sms-widget {
    position: fixed;
    bottom: 20px;
    right: 740px; /* Position left of chat widget */
    width: 700px;
    height: 600px;
    background: var(--bg-secondary);
    border-radius: var(--corner-size);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), var(--glow);
    display: flex;
    flex-direction: column;
    z-index: 9998; /* Below chat widget */
    overflow: hidden;
    border: 1px solid var(--border-color);
}

/* SMS widget header */
.sms-widget-header {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: var(--bg-primary);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
}

.sms-widget-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sms-widget-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--bg-primary);
}

.sms-minimize-btn,
.sms-close-btn {
    background: transparent;
    border: none;
    color: var(--bg-primary);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.sms-minimize-btn:hover,
.sms-close-btn:hover {
    opacity: 1;
}

/* SMS widget body */
.sms-widget-body {
    flex: 1;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    background: var(--bg-secondary);
}

/* Sidebar with conversation list */
.sms-widget-sidebar {
    width: 250px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
}

/* New conversation button */
.sms-new-conversation-btn-container {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sms-new-conversation-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: var(--bg-primary);
    border: none;
    border-radius: var(--corner-size);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.sms-new-conversation-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Conversations list */
.sms-widget-conversations {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-secondary);
}

/* Main SMS area */
.sms-widget-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

/* Empty state */
.sms-widget-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
}

/* Conversation items */
.sms-conv-item {
    display: flex;
    align-items: center;
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
    position: relative;
    background: var(--bg-secondary);
}

.sms-conv-item:hover {
    background: var(--bg-tertiary);
}

.sms-conv-item.active {
    background: var(--bg-tertiary);
    border-left: 3px solid var(--accent-primary);
}

.sms-conv-item.unread {
    background: var(--bg-card);
    font-weight: 600;
}

.sms-conv-item.unread .sms-conv-name {
    color: var(--accent-primary);
}

.sms-conv-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    margin-right: 10px;
    flex-shrink: 0;
}

.sms-conv-info {
    flex: 1;
    min-width: 0;
}

.sms-conv-name {
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sms-conv-last-message {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sms-conv-unread {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--accent-primary);
    color: var(--bg-primary);
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    text-align: center;
    box-shadow: 0 0 8px rgba(157, 78, 221, 0.5);
}

/* Messages view */
.sms-widget-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-secondary);
}

.sms-widget-messages-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--bg-tertiary);
}

.sms-widget-messages-header > div:first-child {
    flex: 1;
}

.sms-resolved-btn {
    background: var(--accent-success);
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.sms-resolved-btn:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.sms-resolved-btn:active {
    transform: translateY(0);
}

.sms-widget-messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-primary);
}

/* Individual messages */
.sms-message {
    display: flex;
    flex-direction: column;
    max-width: 75%;
}

.sms-message-own {
    align-self: flex-end;
    align-items: flex-end;
}

.sms-message-other {
    align-self: flex-start;
    align-items: flex-start;
}

.sms-message-sender {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 600;
}

.sms-message-text {
    background: var(--bg-tertiary);
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
    color: var(--text-primary);
    word-wrap: break-word;
    border: 1px solid var(--border-color);
}

.sms-message-own .sms-message-text {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: var(--bg-primary);
    border: none;
}

.sms-message-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Message input */
.sms-widget-input {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    align-items: flex-end;
    background: var(--bg-tertiary);
}

.sms-widget-input textarea {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-primary);
    resize: none;
    max-height: 100px;
    font-family: inherit;
}

.sms-widget-input textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--glow);
}

.sms-send-btn {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    color: var(--bg-primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.sms-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(157, 78, 221, 0.5);
}

/* Loading and empty states */
.sms-widget-loading,
.sms-widget-empty,
.sms-widget-error {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

.sms-widget-error {
    color: #ff4444;
}

/* SMS Customer Search Modal */
.sms-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.sms-modal-content {
    background: var(--bg-secondary);
    border-radius: var(--corner-size);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.sms-modal-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sms-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.sms-modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 16px;
    transition: color 0.2s;
}

.sms-modal-close:hover {
    color: var(--text-primary);
}

.sms-modal-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.sms-customer-results {
    margin-top: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.sms-customer-item {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--corner-size);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-primary);
}

.sms-customer-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    transform: translateX(4px);
}

.sms-customer-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.sms-customer-details {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.sms-customer-detail {
    display: flex;
    align-items: center;
    gap: 4px;
}

.sms-customer-detail i {
    color: var(--accent-primary);
    font-size: 11px;
}

/* ============================================
   WEBPHONE WIDGET STYLES
   ============================================ */

/* WebPhone widget container */
.webphone-widget {
    position: fixed;
    bottom: 20px;
    right: 1460px; /* Position left of SMS widget (740px SMS + 700px SMS width + 20px gap) */
    width: 350px;
    height: 600px;
    background: var(--bg-secondary);
    border-radius: var(--corner-size);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), var(--glow);
    display: flex;
    flex-direction: column;
    z-index: 9997; /* Below SMS and chat widgets */
    overflow: hidden;
    border: 1px solid var(--border-color);
}

/* WebPhone widget header */
.webphone-widget-header {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: var(--bg-primary);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
}

.webphone-widget-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.webphone-widget-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--bg-primary);
}

.webphone-minimize-btn,
.webphone-close-btn {
    background: transparent;
    border: none;
    color: var(--bg-primary);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.webphone-minimize-btn:hover,
.webphone-close-btn:hover {
    opacity: 1;
}

/* WebPhone widget body */
.webphone-widget-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px;
    background: var(--bg-primary);
    overflow-y: auto;
}

/* Status display */
.webphone-status {
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: var(--corner-size);
    text-align: center;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
}

/* Number input */
.webphone-number-input {
    margin-bottom: 10px;
}

.webphone-number-input input {
    width: 100%;
    padding: 8px;
    font-size: 14px;
    text-align: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--corner-size);
    color: var(--text-primary);
    font-family: monospace;
}

/* Call controls */
.webphone-controls {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.webphone-btn {
    flex: 1;
    padding: 6px 8px;
    border: none;
    border-radius: var(--corner-size);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.webphone-btn i {
    font-size: 10px;
}

.webphone-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.webphone-btn-primary {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.webphone-btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.webphone-btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.webphone-btn-danger:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

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

.webphone-btn-secondary:hover:not(:disabled) {
    background: var(--bg-tertiary);
}

/* Dialpad */
.webphone-dialpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}

.webphone-dialpad-btn {
    aspect-ratio: 1;
    padding: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--corner-size);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.webphone-dialpad-btn:hover {
    background: var(--bg-tertiary);
    transform: scale(1.05);
}

.webphone-dialpad-btn:active {
    transform: scale(0.95);
}

.webphone-dialpad-letters {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Registration controls */
.webphone-registration {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* Audio element (hidden) */
#webphoneAudio {
    display: none;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .webphone-widget {
        width: 100%;
        height: 100%;
        right: 0;
        bottom: 0;
        border-radius: 0;
    }
    
    .sms-widget {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    
    .sms-widget-sidebar {
        width: 100%;
        border-right: none;
    }
    
    .sms-widget-main {
        display: none;
    }
    
    .sms-widget-main.active {
        display: flex;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 10;
    }
    
    .sms-widget-sidebar.hidden {
        display: none;
    }
}

/* Notification badge on header bell button */
.notif-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #ff4444;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    text-align: center;
}

/* Universal notification dropdown panel */
.notif-panel {
    position: absolute;
    top: 50px;
    right: 0;
    width: 400px;
    max-height: 520px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--corner-size);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), var(--glow);
    z-index: 1000;
    display: none;
}

.notif-panel.open {
    display: block;
}

.notif-panel .notif-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Category row in the notification dropdown */
.notif-category-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.notif-category-item:hover {
    background: var(--bg-tertiary);
}

.notif-category-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.notif-category-content {
    flex: 1;
    min-width: 0;
}

.notif-category-label {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}

.notif-category-count {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.notif-category-arrow {
    color: var(--text-secondary);
    font-size: 12px;
    opacity: 0.5;
    flex-shrink: 0;
}

/* Insurance detail sub-items (expandable under insurance_check category) */
.notif-detail-container {
    background: rgba(0,0,0,0.15);
}

.notif-detail-item {
    padding: 8px 16px 8px 48px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    cursor: pointer;
    transition: background 0.2s;
}

.notif-detail-item:hover {
    background: var(--bg-tertiary);
}

.notif-detail-item.unread {
    border-left: 3px solid var(--accent-primary);
}

.notif-detail-title {
    font-weight: 600;
    font-size: 12px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.notif-detail-message {
    font-size: 11px;
    color: var(--text-secondary);
}

.notif-detail-time {
    font-size: 10px;
    color: var(--text-secondary);
    opacity: 0.7;
    margin-top: 3px;
}

/* Legacy insurance-notif classes for backward compat */
.insurance-notif-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #ff4444;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    text-align: center;
}

.insurance-notif-panel {
    position: absolute;
    top: 50px;
    right: 0;
    width: 380px;
    max-height: 500px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--corner-size);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), var(--glow);
    z-index: 1000;
    display: none;
}

.insurance-notif-panel.open {
    display: block;
}

.insurance-notif-panel .notif-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
