/* === Brand tokens. Semantic names stay so existing components follow the palette. === */
:root {
    --raisin-black: #211C2F;
    --sea-salt: #FBFBFF;
    --jade-green: #7655E9;
    --maya-blue: #8A5CF0;
    --ecru: #D5B6F4;
    --purple: #7655E9;
    --blue: #8A5CF0;
    --neon-teal-accent: #CDBAFF;
    --error-color: #ff4757;
    --success-color: #2ed573;
    --warning-color: #ffa502;
    --info-color: #7655E9;
    --jade-green-rgb: 118, 85, 233;
    --maya-blue-rgb: 138, 92, 240;
    --ecru-rgb: 213, 182, 244;
    --neon-teal-accent-rgb: 205, 186, 255;
    --purple-rgb: 118, 85, 233;
    --blue-rgb: 138, 92, 240;
}

/* === Dark mode (default): violet-black, not pure black === */
:root,
[data-theme="dark"],
html.dark-theme {
    --text-sub-color: #B6A9D1;
    --background-color: #171326;
    --form-bg-color: #201735;
    --border-color: #4B3B70;
    --text-primary: #F7F4FF;
    --text-secondary: #B6A9D1;
    --bg-primary: #171326;
    --bg-secondary: #201735;
    --bg-tertiary: #151221;
    --bg-hover: rgba(255, 255, 255, 0.08);
    --card-bg: rgba(255, 255, 255, 0.05);
    --accent-purple: #7655E9;
    --accent-blue: #8A5CF0;
    --accent-gradient: linear-gradient(135deg, #6545E7 0%, #8A5CF0 40%, #B17AF3 72%, #D5B6F4 100%);
    --accent-ecru: #D5B6F4;
    --sidebar-bg: #151221;
    --sidebar-border: rgba(205, 186, 255, 0.16);
    --input-bg: rgba(255, 255, 255, 0.06);
    --primary-color: #7655E9;
    --primary-hover: #8A5CF0;
    --button-gradient: linear-gradient(135deg, #7655E9 0%, #AA76EE 100%);
    --button-text-color: #FFFFFF;
}

/* === Light mode: lavender-white, not clinical white === */
[data-theme="light"],
html.light-theme,
body.light-theme {
    --text-sub-color: #736A8E;
    --background-color: #FBFBFF;
    --form-bg-color: rgba(255, 255, 255, 0.82);
    --border-color: #D8D0F4;
    --text-primary: #251D42;
    --text-secondary: #736A8E;
    --bg-primary: #FBFBFF;
    --bg-secondary: #F0EDFF;
    --bg-tertiary: #EDE9FB;
    --bg-hover: rgba(118, 85, 233, 0.08);
    --card-bg: rgba(255, 255, 255, 0.78);
    --accent-purple: #7655E9;
    --accent-blue: #8A5CF0;
    --accent-gradient: linear-gradient(135deg, #6545E7 0%, #8A5CF0 40%, #B17AF3 72%, #D5B6F4 100%);
    --accent-ecru: #D5B6F4;
    --sidebar-bg: rgba(255, 255, 255, 0.72);
    --sidebar-border: rgba(118, 85, 233, 0.14);
    --input-bg: rgba(255, 255, 255, 0.9);
    --primary-color: #7655E9;
    --primary-hover: #8A5CF0;
    --button-gradient: linear-gradient(135deg, #7655E9 0%, #AA76EE 100%);
    --button-text-color: #FFFFFF;
}

/* === Modal Styling with Theme Support === */
.modal-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #ffffff;
}

.modal-label {
    display: block;
    text-align:left;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.modal-description {
    font-size: 0.75rem;
    color: var(--text-sub-color);
}

.folder-input {
    background: var(--form-bg-color);
    border: 2px solid var(--jade-green);
    color: var(--text-primary);
}

.folder-input:focus {
    border-color: var(--maya-blue);
    box-shadow: 0 0 0 3px rgba(var(--jade-green-rgb), 0.1);
}

.folder-input::placeholder {
    color: var(--text-sub-color);
}

.modal-button-secondary {
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

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

.modal-button-primary {
    padding: 0.5rem 1rem;
    background: var(--jade-green);
    color: var(--raisin-black);
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.modal-button-primary:hover {
    background: var(--maya-blue);
    transform: translateY(-1px);
}

.modal-button-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Light theme specific adjustments */
body.light-theme .modal-content {
    background: var(--sea-salt);
    border-color: #e5e7eb;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

body.light-theme .folder-input {
    background: #f8fafc;
    color: var(--raisin-black);
}

body.light-theme .modal-button-secondary {
    border-color: #d1d5db;
    color: #6b7280;
}

body.light-theme .modal-button-secondary:hover {
    background: #f8fafc;
    color: #374151;
}

/* === Reset and Base Styles === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--background-color);
    font-family: "DM Sans", Arial, sans-serif;
    color: var(--text-primary);
    line-height: 1.65;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Prevent white flash during page navigation */
html {
    background-color: var(--background-color);
}

/* Page transition improvements */
body.loading {
    opacity: 0;
    background-color: var(--background-color);
}

body.loaded {
    opacity: 1;
    transition: opacity 0.2s ease-in;
}

/* === Layout Containers === */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.auth-wrapper {
    width: 100%;
    max-width: 450px;
}

/* === Logo Styling === */
.logo-container {
    text-align: center;
    margin-bottom: 3rem;
}

.logo-container img {
    height: 60px;
    width: auto;
}

/* === Animated Form Container === */
.auth-form {
    background-color: var(--form-bg-color);
    padding: 3rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.auth-form::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150%;
    height: 150%;
    z-index: 1;
    background: conic-gradient(
        transparent 290deg,
        rgba(var(--purple-rgb), 0.6) 310deg,
        rgba(var(--blue-rgb), 0.6) 320deg,
        rgba(var(--neon-teal-accent-rgb), 0.8) 330deg,
        transparent 340deg
    );
    animation: spin 4s linear infinite;
}

.auth-form::after {
    content: '';
    position: absolute;
    inset: 2px;
    background: var(--form-bg-color);
    border-radius: 18px;
    z-index: 2;
}

.auth-form > * {
    position: relative;
    z-index: 3;
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* === Form Header === */
.auth-form h2 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--maya-blue), var(--jade-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 15px rgba(230, 196, 122, 0.3); /* Ecru golden glow */
    text-align: center;
}

.auth-form .subtitle {
    color: var(--text-sub-color);
    margin-bottom: 2.5rem;
    font-size: 1rem;
    text-align: center;
}

/* === Form Groups === */
.form-group {
    margin-bottom: 1.8rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-size: 0.9rem;
    color: var(--text-sub-color);
    font-weight: 500;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* === Input Styling === */
input[type="text"],
input[type="email"],
input[type="password"],
select {
    width: 100%;
    padding: 1rem;
    background-color: #2a2a4a;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder {
    color: var(--text-sub-color);
    opacity: 0.6;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus {
    outline: none;
    border-color: var(--neon-teal-accent);
    box-shadow: 0 0 10px 0px rgba(100, 240, 212, 0.3);
    background-color: #323255;
    color: white;
}

select {
    cursor: pointer;
}

select option {
    background-color: #2a2a4a;
    color: white;
}

/* === Button Styling === */
.btn-primary {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--maya-blue), var(--jade-green));
    color: var(--raisin-black);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.btn-demo {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: transparent;
    color: var(--neon-teal-accent);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.8rem;
}

.btn-demo:hover {
    border-color: var(--neon-teal-accent);
    background: rgba(100, 240, 212, 0.1);
    transform: translateY(-1px);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(178, 216, 194, 0.3); /* Jade Green */
}

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

/* === Form Footer === */
.form-footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.9rem;
    color: var(--text-sub-color);
}

.form-footer a {
    color: var(--neon-teal-accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.form-footer a:hover {
    color: white;
    text-decoration: none;
}

/* === Flash Messages === */
.flash-messages {
    margin-bottom: 1.5rem;
}

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    border-left: 4px solid;
}

.alert-success {
    background-color: rgba(46, 213, 115, 0.1);
    border-left-color: var(--success-color);
    color: var(--success-color);
}

.alert-error {
    background-color: rgba(255, 71, 87, 0.1);
    border-left-color: var(--error-color);
    color: var(--error-color);
}

.alert-warning {
    background-color: rgba(255, 165, 2, 0.1);
    border-left-color: var(--warning-color);
    color: var(--warning-color);
}

.alert-info {
    background-color: rgba(55, 66, 250, 0.1);
    border-left-color: var(--info-color);
    color: var(--info-color);
}

/* === Dashboard Styles === */
.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.dashboard-header h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--maya-blue), var(--jade-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.user-info {
    color: var(--text-sub-color);
    font-size: 0.9rem;
}

.logout-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-sub-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.logout-btn:hover {
    border-color: var(--neon-teal-accent);
    color: var(--neon-teal-accent);
}

.dashboard-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.dashboard-card {
    background-color: var(--form-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    transition: all 0.3s ease;
}

.dashboard-card:hover {
    border-color: rgba(100, 240, 212, 0.3);
    box-shadow: 0 4px 20px rgba(100, 240, 212, 0.1);
}

.dashboard-card h3 {
    color: var(--neon-teal-accent);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.dashboard-card p {
    color: var(--text-sub-color);
    line-height: 1.6;
}

/* === Responsive Design === */
@media (max-width: 768px) {
    .auth-container {
        padding: 1rem;
    }
    
    .auth-form {
        padding: 2rem;
    }
    
    .auth-form h2 {
        font-size: 1.8rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .dashboard-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .dashboard-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .auth-form {
        padding: 1.5rem;
    }
    
    .auth-form h2 {
        font-size: 1.6rem;
    }
}

/* === Loading Animation === */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading .btn-primary {
    background: linear-gradient(90deg, var(--text-sub-color), var(--text-sub-color));
    cursor: not-allowed;
}

/* === Form Validation === */
.field-error {
    color: var(--error-color);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    display: block;
}

.form-group.has-error input,
.form-group.has-error select {
    border-color: var(--error-color);
    box-shadow: 0 0 10px rgba(255, 71, 87, 0.3);
}

/* === Dashboard Layout === */
.dashboard-layout {
    display: flex;
    height: 100vh;
    background: linear-gradient(135deg, 
        rgba(26, 32, 44, 1) 0%, 
        rgba(45, 55, 72, 0.95) 25%, 
        rgba(26, 32, 44, 0.98) 50%, 
        rgba(45, 55, 72, 0.95) 75%, 
        rgba(26, 32, 44, 1) 100%);
    overflow: hidden;
}

/* === Sidebar Navigation === */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.sidebar-header {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* LawZen Logo System - Theme Responsive */
.sidebar-logo {
    height: 32px;
    width: auto;
    object-fit: contain;
}

/* Dark Mode Logo (default) */
.theme-responsive-logo-dark {
    display: block;
    height: 36px;
    width: auto;
    margin: 0 auto;
}

.theme-responsive-logo-light {
    display: none;
    height: 36px;
    width: auto;
    margin: 0 auto;
}

/* Light Mode Logo */
[data-theme="light"] .theme-responsive-logo-dark {
    display: none !important;
}

[data-theme="light"] .theme-responsive-logo-light {
    display: block !important;
}

.sidebar-title {
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.nav-section {
    margin-bottom: 1rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-sub-color);
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    border-radius: 6px;
    margin: 0 0.5rem;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    text-decoration: none;
}

.nav-item.active {
    background: rgba(178, 216, 194, 0.15); /* Jade Green with transparency */
    color: var(--jade-green);
    border-left: 3px solid var(--jade-green);
    margin-left: 0.5rem;
    padding-left: 0.75rem;
}

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

.nav-divider {
    height: 1px;
    background: var(--border-color);
    margin: 1rem 0.5rem;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.user-profile i {
    font-size: 1.5rem;
    color: var(--text-sub-color);
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    color: white;
    font-size: 0.9rem;
    font-weight: 700;
}

.user-role {
    color: var(--text-sub-color);
    font-size: 0.8rem;
}

.logout-btn {
    color: var(--text-sub-color);
    text-decoration: none;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
}

/* === Main Content === */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* === Top Navigation === */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(45, 55, 72, 0.8);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

.nav-left h1 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* === Theme Switcher === */
.theme-switcher .theme-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.theme-switcher .theme-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* === Profile Dropdown === */
.profile-dropdown {
    position: relative;
    z-index: 999999;
}

.profile-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: none;
    border: none;
    padding: 0;
}

.profile-trigger:hover .profile-avatar {
    transform: scale(1.05);
}

.profile-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--jade-green), var(--maya-blue));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
    font-weight: 700;
    transition: transform 0.3s ease;
}

.profile-info {
    display: none;
}

.profile-name {
    display: none;
}

.profile-email {
    display: none;
}

.profile-trigger i.fa-chevron-down {
    display: none;
}

.profile-menu {
    position: fixed;
    top: 60px;
    right: 16px;
    min-width: 280px;
    background: #1e293b;
    border: 1px solid rgba(71, 85, 105, 0.3);
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(20px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 999999;
}

.profile-dropdown.active .profile-menu,
.profile-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.profile-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(71, 85, 105, 0.3);
}

.profile-user-info {
    margin-bottom: 1rem;
}

.profile-user-name {
    color: #f1f5f9;
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.profile-user-email {
    color: #94a3b8;
    font-size: 0.8rem;
}

.profile-actions {
    padding: 0.5rem 0;
}

.profile-action {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #f1f5f9;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

.profile-action:hover {
    background: rgba(71, 85, 105, 0.3);
    color: #f1f5f9;
}

.profile-action i {
    color: #94a3b8;
    width: 16px;
    text-align: center;
}

.profile-action.logout {
    color: #ef4444;
}

.profile-action.logout:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.profile-action.logout i {
    color: #ef4444;
}

.profile-divider {
    height: 1px;
    background: rgba(71, 85, 105, 0.3);
    margin: 0.5rem 0;
}

.profile-credits {
    margin-bottom: 1rem;
}

.credit-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.credit-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.credit-dot.words {
    background: var(--accent-teal);
}

.credit-dot.images {
    background: var(--accent-purple);
}

.credit-label {
    color: var(--text-sub-color);
    font-size: 0.85rem;
    flex: 1;
}

.credit-value {
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
}

.credit-progress {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-teal), var(--accent-purple));
    width: 75%;
    border-radius: 2px;
}

.view-credits {
    color: var(--accent-teal);
    font-size: 0.85rem;
    text-decoration: none;
    transition: color 0.3s ease;
}

.view-credits:hover {
    color: var(--accent-blue);
}

.profile-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.profile-menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-teal);
}

.profile-menu-item.logout {
    color: var(--error-color);
}

.profile-menu-item.logout:hover {
    background: rgba(255, 71, 87, 0.1);
    color: var(--error-color);
}

.content-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
}

.content-header h1 {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-sub-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-primary {
    background: linear-gradient(135deg, var(--maya-blue), var(--jade-green));
    border: none;
    color: var(--raisin-black);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(178, 216, 194, 0.3);
}

/* === Chat Interface === */
.chat-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    margin: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
}

.chat-sidebar {
    width: 320px;
    background: rgba(45, 55, 72, 0.8);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    border-radius: 12px 0 0 12px;
}

.chat-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.ai-model-selector {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-model-selector:hover {
    background: rgba(255, 255, 255, 0.1);
}

.ai-model-selector i:first-child {
    color: var(--neon-teal-accent);
}

.ai-model-selector i:last-child {
    margin-left: auto;
    color: var(--text-sub-color);
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease-out;
    margin-bottom: 0.5rem;
}

.chat-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.chat-item.is-deleting {
    opacity: 0;
    transform: translateX(-20px);
    height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    margin-bottom: 0;
    border: none;
    overflow: hidden;
}

.chat-item i {
    color: var(--neon-teal-accent);
    font-size: 1rem;
}

.chat-info h4 {
    color: white;
    font-size: 0.9rem;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
}

/* Light mode override for chat history titles */
body.light-theme .chat-info h4 {
    color: #1a202c !important;
    font-weight: 700;
}

.chat-info span {
    color: var(--text-sub-color);
    font-size: 0.8rem;
}

/* Light mode override for chat time text */
body.light-theme .chat-info span {
    color: #4a5568 !important;
}

/* === Enhanced Chat History Panel Styles === */
.chat-item.enhanced {
    display: block;
    padding: .4rem .6rem .4rem .6rem;
    margin-bottom: 0.5rem;
    width: 100%;
    margin-left: 1px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.chat-item.enhanced:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(178, 216, 194, 0.3); /* Jade Green */
}

/* Main container - Large circle on left, content in middle, actions on right */
.chat-item-main {
    display: flex;
    align-items: center;
    width: 100%;
    overflow: hidden;
    position: relative;
}

/* Large color circle on far left */
.chat-color-circle {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 12px;
    flex-shrink: 0;
    box-shadow: 0px 0px 9px 6px #2c181842;
}

/* Content area - title and case/agent info */
.chat-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    gap: 2px;
    overflow: hidden;
    white-space: nowrap;
}

/* Title row */
.chat-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pin-indicator {
    color: white;
    font-size: 0.8rem;
    margin-right: 8px;
    flex-shrink: 0;
}

.pin-icon {
    color: white;
    font-size: 0.8rem;
    margin-right: 8px;
}

.chat-title {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    text-overflow: ellipsis;
    overflow: hidden;
    flex: 1;
}

/* Case name and agent row */
.chat-case-agent-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.case-name {
    color: var(--text-sub-color);
    font-size: 0.8rem;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-type {
    color: var(--accent-blue);
    font-size: 0.8rem;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Right side - date and ellipsis */
.chat-right-side {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: auto;
}

.chat-timestamp {
    color: var(--text-sub-color);
    font-size: 0.75rem;
    flex-shrink: 0;
    display: block;
    min-width: 24px;
    text-align: right;
}

.chat-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-sub-color);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.pin-btn:hover {
    color: var(--accent-purple);
}

.delete-btn:hover {
    color: var(--error-color);
}

/* Hover effect to show/hide timestamp and actions */
.chat-item.enhanced:hover .chat-timestamp {
    display: none;
}

.chat-item.enhanced:hover .chat-actions {
    display: flex !important;
}

/* Light mode overrides */
[data-theme="light"] .chat-item.enhanced:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(124, 58, 237, 0.3);
}

[data-theme="light"] .action-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.new-conversation-btn {
    margin: 1rem;
    background: linear-gradient(135deg, var(--maya-blue), var(--jade-green));
    border: none;
    color: white;
    padding: 0.75rem;
    border-radius: 6px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

/* Light mode styling for New Conversation button - subtle and on-brand */
body.light-theme .new-conversation-btn {
    background: rgba(255, 255, 255, 0.95) !important;
    color: #1a202c !important;
    border: 1px solid #d1d5db !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

body.light-theme .new-conversation-btn:hover {
    background: #f8fafc !important;
    color: #1a202c !important;
    border-color: #9ca3af !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
}

/* === AI Selector Dropdown === */
.ai-model-selector {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.ai-model-selector:hover {
    background: rgba(255, 255, 255, 0.1);
}

.ai-model-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.ai-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--maya-blue), var(--jade-green));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
}

.ai-details {
    display: flex;
    flex-direction: column;
}

.ai-name {
    color: white;
    font-size: 0.9rem;
    font-weight: 700;
}

.ai-role {
    color: var(--text-sub-color);
    font-size: 0.8rem;
}

/* Agent Selector Dropdown - Built like case selector */
.agent-selector-dropdown {
    position: relative;
    display: flex;
    flex: 1;
    max-width: 400px;
    width: 100%;
    justify-content: flex-start;
    margin-left: 0px;
}

.agent-selector-trigger {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    height: 56px;
    color: var(--text-primary);
    min-width: 280px;
}

/* Light mode agent selector border */
body.light-theme .agent-selector-trigger {
    border: 1px solid #d1d5db !important;
    background: rgba(255, 255, 255, 0.95) !important;
}

body.light-theme .agent-selector-trigger:hover {
    border-color: #9ca3af !important;
    background: #f8fafc !important;
}

.agent-selector-trigger .fas.fa-chevron-down {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    margin-left: 8px;
}

/* Light mode arrow icon for agent selector */
body.light-theme .agent-selector-trigger .fas.fa-chevron-down {
    color: #4a5568 !important;
}

.agent-selector-trigger:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

.agent-selector-trigger.active {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

.selected-agent {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.agent-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--maya-blue), var(--jade-green));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--raisin-black);
    font-weight: 700;
    flex-shrink: 0;
}

.selected-agent-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.selected-agent-title {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.selected-agent-description {
    font-size: 11px;
    color: var(--text-sub-color);
}

.agent-selector-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 0.5rem;
    padding: 0;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-height: 300px;
    overflow-y: auto;
}

.agent-selector-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.agent-search {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.agent-search input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
}

.agent-options {
    max-height: 200px;
    overflow-y: auto;
}

.agent-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.agent-option:hover {
    background: rgba(255, 255, 255, 0.05);
}

.agent-option.selected {
    background: rgba(99, 102, 241, 0.1);
    border-left: 3px solid #72c9ff;
}

.search-container {
    position: relative;
    margin-bottom: 1rem;
}

.chatbot-search {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    color: white;
    font-size: 0.9rem;
    outline: none;
}

.chatbot-search::placeholder {
    color: var(--text-sub-color);
}

.search-container i {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-sub-color);
}

.chatbot-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 0.5rem;
    border: 1px solid transparent;
}

.chatbot-option:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
}

.chatbot-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    flex-shrink: 0;
}

.gradient-blue {
    background: linear-gradient(135deg, var(--maya-blue), var(--jade-green));
}

.gradient-orange {
    background: linear-gradient(135deg, #ff8a50, #ff6b35);
}

.gradient-pink {
    background: linear-gradient(135deg, #ff6b9d, #ff4081);
}

.gradient-red {
    background: linear-gradient(135deg, #ff5252, #d32f2f);
}

.chatbot-info {
    flex: 1;
}

.chatbot-info h4 {
    color: white;
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
}

.chatbot-info p {
    color: var(--text-sub-color);
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.4;
}

.chatbot-option i:last-child {
    color: var(--text-sub-color);
    font-size: 0.9rem;
}

/* === Chat Main === */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(26, 32, 44, 0.6);
    border-radius: 0 12px 12px 0;
}

.chat-header-main {
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.03);
}

.current-ai-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.current-ai-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--maya-blue), var(--jade-green));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
}

.current-ai-details {
    display: flex;
    flex-direction: column;
}

.current-ai-name {
    color: white;
    font-size: 0.9rem;
    font-weight: 700;
}

.current-ai-role {
    color: var(--text-sub-color);
    font-size: 0.8rem;
}

.chat-actions {
    display: flex;
    gap: 0.75rem;
}

.action-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-sub-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.chat-messages {
    flex-grow: 1;
    padding: 1rem;
    padding-bottom: 120px; /* Extra padding to go behind chat input */
    overflow-y: auto;
    width: 100%;
    min-height: 0;
    /* Full width for scrollbar positioning */
}

.chat-messages-inner {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 880px;
    width: 100%;
    margin: 0 auto;
    /* Centered content area within full-width scrollable container */
}

/* Animated scrollbar for chat messages */
.chat-messages {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
    transition: scrollbar-color 0.3s ease;
}

.chat-messages.scrolling {
    scrollbar-color: #4a5568 transparent;
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.chat-messages.scrolling::-webkit-scrollbar-thumb {
    background: #4a5568;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #5a6578 !important;
}

.chat-messages::-webkit-scrollbar-corner {
    background: transparent;
}

.message {
    display: flex;
    gap: 0.75rem;
    animation: fadeIn 0.3s ease-in;
}

.message-avatar {
    display: none !important;
}

.message-content {
    flex: 1;
    border-radius: 16px;
    padding: 0.5rem 0.75rem;
    line-height: 1.4;
    word-wrap: break-word;
}

/* User Messages - Right aligned with blue gradient */
.user-message {
    align-self: flex-end;
    margin: 0.5rem 0;
    max-width: min(75%, 42rem);
    width: auto;
    min-width: 0;
}

.user-message .message-content {
    background: linear-gradient(135deg, rgba(114, 201, 255, 0.2), rgba(178, 216, 194, 0.2));
    border-radius: 16px;
    font-weight: 400;
    padding: 10px 14px;
    line-height: 1.5;
    color: white;
    width: auto;
    max-width: 100%;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* AI Messages - Left aligned with no background */
.ai-message {
    align-self: flex-start;
    margin: 0.5rem 0;
    max-width: 100%;
}

.ai-message .message-content {
    background: transparent;
    border: none;
    color: var(--text-primary);
    border-radius: 16px 16px 16px 4px;
}

.user-message .message-content p {
    color: white;
    margin: 0 0 1rem 0;
    line-height: 1.6;
}

.ai-message .message-content p {
    color: var(--text-primary);
    margin: 0 0 1rem 0;
    line-height: 1.6;
}

.message-content p:last-child {
    margin-bottom: 0;
}

/* Markdown formatting in messages */
.message-text h1,
.message-text h2,
.message-text h3,
.message-text h4 {
    color: var(--text-primary);
    margin: 1rem 0 0.5rem 0;
    font-weight: 700;
}

.message-text h1 {
    font-size: 1.5rem;
}

.message-text h2 {
    font-size: 1.3rem;
}

.message-text h3 {
    font-size: 1.2rem;
}

.message-text h4 {
    font-size: 1.1rem;
}

.message-text strong {
    color: #ffffff;
    font-weight: 700;
}

.message-text em {
    color: var(--accent-teal);
    font-style: italic;
}

.message-text ul,
.message-text ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.message-text li {
    color: var(--text-primary);
    margin: 0.25rem 0;
    line-height: 1.5;
}

.message-text code {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-teal);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.message-text pre {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 1rem;
    margin: 0.5rem 0;
    overflow-x: auto;
}

.message-text pre code {
    background: none;
    padding: 0;
    color: var(--text-primary);
}

/* Ensure message text doesn't have scroll restrictions */
.message-text {
    overflow: visible;
    max-height: none;
    height: auto;
}

/* === Chat Input Container === */
.chat-input-container {
    padding: 1rem 1.5rem;
    background: transparent;
    border-top: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: auto;
    position: sticky;
    bottom: 0;
}

.chat-input {
    display: flex;
    flex-direction: column;
    background: rgba(45, 55, 72, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 28px;
    padding: 0.75rem;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    width: 100%;
    max-width: 880px;
    min-height: 56px;
    position: relative;
    box-shadow: 0 -15px 30px -10px rgba(120, 120, 180, 0.15);
}

/* Light theme chat input styling */
body.light-theme .chat-input {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #d1d5db;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(10px);
}

body.light-theme .chat-input:focus-within {
    border-color: #9ca3af;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}



.chat-input:focus-within {
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: none;
}

.input-controls-bottom {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 12px;
    margin-bottom: 22px;
    width: 100%;
    position: relative;
}

.input-controls-left {
    display: flex;
    align-items: center;
    gap: 8px;
    position: absolute;
    left: 6px;
}

.input-controls-right {
    display: flex;
    align-items: center;
    gap: 8px;
    position: absolute;
    right: 6px;
}

.input-btn {
    background: transparent;
    border: none;
    color: var(--icon-secondary, #D4C9E8);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.chat-input .input-btn:not(.chat-send-button) {
    color: var(--icon-secondary, #D4C9E8);
    background: transparent;
    border: none;
}

.chat-input .input-btn:not(.chat-send-button):hover {
    color: var(--icon-hover, #FFFFFF);
}

.input-btn.attach-btn,
.input-btn.tools-btn,
.input-btn.voice-btn,
.input-btn.voice-wave-btn,
.input-btn.sparkle-btn {
    background-color: transparent;
    color: inherit;
    border: none;
}

.chat-send-button {
    border-radius: 50%;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    flex: 0 0 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    padding: 0;
    position: relative;
    background: linear-gradient(135deg, #7655E9 0%, #9A6CF3 100%);
    color: #FFFFFF;
    box-shadow: 0 8px 18px rgba(118, 85, 233, 0.28);
}

.chat-send-button .theme-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.chat-send-button .arrow-up {
    font-size: 14px;
    color: inherit;
}

.chat-send-button .composer-glyph {
    position: absolute;
    opacity: 0;
    transform: scale(0.92);
    pointer-events: none;
}

.chat-send-button:not(.is-send) .composer-glyph--voice,
.chat-send-button.is-send .composer-glyph--send {
    opacity: 1;
    transform: scale(1);
    pointer-events: none;
    transition: opacity 140ms ease, transform 140ms ease;
}

/* Remove old voice-mode and send-mode specific styling since we're using inline styles now */

/* Theme-aware icon sizing */
.theme-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.sparkle-icon {
    transition: all 0.3s ease;
}

.input-btn.sparkle-btn:hover .sparkle-icon {
    transform: scale(1.1);
    filter: brightness(1.2);
}

/* Light theme sparkle button */
body.light-theme .input-btn.sparkle-btn {
    color: #4a5568 !important;
}

body.light-theme .input-btn.sparkle-btn:hover {
    color: #1a202c !important;
}

/* Custom tooltip for sparkle button */
.input-btn.sparkle-btn {
    position: relative;
}

.input-btn.sparkle-btn::after {
    content: attr(title);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    white-space: nowrap;
    font-size: 12px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    pointer-events: none;
    z-index: 1000;
}

.input-btn.sparkle-btn::before {
    content: '';
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid rgba(0, 0, 0, 0.9);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    pointer-events: none;
    z-index: 1000;
}

.input-btn.sparkle-btn:hover::after,
.input-btn.sparkle-btn:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Light theme tooltip */
body.light-theme .input-btn.sparkle-btn::after {
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
}

body.light-theme .input-btn.sparkle-btn::before {
    border-top-color: rgba(0, 0, 0, 0.8);
}

.input-wrapper {
    flex: 1;
    margin-left: 0px !important;
}

.input-btn:hover:not(.chat-send-button) {
    background: rgba(255, 255, 255, 0.05);
    color: var(--icon-hover, var(--text-primary));
}

.input-btn.tools-btn {
    padding: 0.5rem 0.75rem;
}

.input-btn span {
    font-weight: 400;
}

/* Dropdown Styles */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 0.5rem;
    background: rgba(30, 35, 50, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    min-width: 180px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
}

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

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    color: white;
    font-size: 0.9rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease;
    border-radius: 0;
}

.dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 8px 8px;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.dropdown-item:hover i {
    color: #ffffff;
}

.dropdown-item i {
    font-size: 0.85rem;
    color: var(--text-sub-color);
}

.input-wrapper {
    flex: 1;
    margin: 0 0.5rem;
}

.message-input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    padding: 12px 12px 35px 12px;
    outline: none;
    min-height: 48px;
    max-height: 200px;
    resize: none;
    overflow-y: auto;
    font-family: inherit;
    line-height: 1.5;
}

.message-input::placeholder {
    color: var(--text-sub-color);
    font-weight: 400;
}

.chat-disclaimer {
    text-align: center;
    color: var(--text-sub-color);
    font-size: 0.8rem;
    margin-top: 0.75rem;
    opacity: 0.8;
    max-width: 800px;
    width: 100%;
}

/* === Light Theme Styles === */
body.light-theme {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --text-primary: #1a202c;
    --text-sub-color: #4a5568;
    --border-color: #e2e8f0;
    background-color: #f8fafc !important;
}

/* Input Spinner for Chat Creation */
.input-spinner {
    position: absolute;
    bottom: 16px;
    right: 60px;
    z-index: 10;
    pointer-events: none;
}

.input-spinner .ai-loader {
    transform: scale(0.7);
}

/* Light theme background support */
html.light-theme {
    background-color: #f8fafc !important;
}

body.light-theme.loading {
    background-color: #f8fafc !important;
}

/* Color picker styles */
.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

.color-circle-wrapper {
    position: relative;
    display: inline-block;
}

.color-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.color-circle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.color-circle-wrapper input[type="color"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none;
    background: none;
}

.color-preview {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.2s ease;
}

.color-label {
    font-size: 13px;
    color: var(--text-sub-color);
}

/* Create Case Button Styling */
.create-case-btn {
    width: 120px !important;
    height: 56px !important;
    float: right;
    margin-left: auto;
}

.modal-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.modal-actions .btn-secondary {
    height: 56px;
}

/* Case Details Page Styles */
.case-details-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

.case-header {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.case-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.case-title-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.case-color-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
}

.case-title-info {
    flex: 1;
}

.case-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
}

.case-meta {
    display: flex;
    gap: 1rem;
    color: var(--text-sub-color);
    font-size: 0.875rem;
}

.case-status-badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.case-status-badge.active {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.case-status-badge.completed {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.case-status-badge.on_hold {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.case-status-badge.cancelled {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.case-sections {
    display: grid;
    gap: 1.5rem;
}

.case-section {
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.section-title i {
    color: var(--accent-purple);
}

.edit-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    color: var(--text-sub-color);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.edit-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent-purple);
}

.section-content {
    padding: 1.5rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

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

.info-item label {
    font-weight: 500;
    color: var(--text-sub-color);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.5;
}

.priority-badge, .status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: fit-content;
}

.priority-badge.low {
    background: rgba(156, 163, 175, 0.1);
    color: #9ca3af;
}

.priority-badge.medium {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.priority-badge.high {
    background: rgba(249, 115, 22, 0.1);
    color: #f97316;
}

.priority-badge.urgent {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.color-display {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.color-display .color-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.color-value {
    font-family: monospace;
    color: var(--text-sub-color);
    font-size: 0.875rem;
}

.edit-mode {
    margin-top: 1rem;
}

.edit-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

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

.form-group label {
    font-weight: 500;
    color: var(--text-sub-color);
    font-size: 0.875rem;
}

.form-control {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(178, 216, 194, 0.1);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.save-btn {
    background: var(--accent-purple);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.save-btn:hover {
    background: var(--accent-purple-hover);
}

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

.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1rem;
}

.breadcrumb-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-sub-color);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s ease;
}

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

.breadcrumb-separator {
    color: var(--text-sub-color);
    font-size: 0.75rem;
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.875rem;
}

.desktop-only {
    display: inline;
}

/* Mobile Styles for Case Details */
@media (max-width: 768px) {
    .case-details-container {
        padding: 1rem;
    }
    
    .case-header {
        padding: 1.5rem;
    }
    
    .case-header-content {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .case-title {
        font-size: 1.5rem;
    }
    
    .case-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .breadcrumb-nav {
        margin-left: 0.5rem;
    }
    
    .desktop-only {
        display: none;
    }
    
    .section-header {
        padding: 1rem;
    }
    
    .section-content {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .case-header-content {
        gap: 1rem;
    }
    
    .case-title {
        font-size: 1.25rem;
    }
    
    .breadcrumb-nav {
        font-size: 0.75rem;
    }
    
    .breadcrumb-current {
        font-size: 0.75rem;
        max-width: 150px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Clickable Case Rows */
.clickable-case {
    cursor: pointer;
    transition: all 0.2s ease;
}

.clickable-case:hover {
    background: var(--bg-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.empty-state-row {
    grid-column: 1 / -1;
    padding: 3rem 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Empty state styles */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-sub-color);
}

.empty-state i {
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

.empty-state p {
    margin-bottom: 30px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Case Details Page Styles */
.case-details-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.case-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 20px;
}

.case-info-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border-color);
}

.case-info-card h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 700;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-item label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-sub-color);
    font-weight: 500;
}

.info-item span {
    color: var(--text-primary);
    font-weight: 500;
}

.priority-badge, .status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.priority-low { background: rgba(34, 197, 94, 0.1); color: #22c55e; }
.priority-medium { background: rgba(251, 191, 36, 0.1); color: #fbbf24; }
.priority-high { background: rgba(249, 115, 22, 0.1); color: #f97316; }
.priority-urgent { background: rgba(239, 68, 68, 0.1); color: #ef4444; }

.status-active { background: rgba(34, 197, 94, 0.1); color: #22c55e; }
.status-pending { background: rgba(251, 191, 36, 0.1); color: #fbbf24; }
.status-completed { background: rgba(99, 102, 241, 0.1); color: #72c9ff; }
.status-on_hold { background: rgba(156, 163, 175, 0.1); color: #9ca3af; }

.case-description {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.case-description label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-sub-color);
    font-weight: 500;
    margin-bottom: 8px;
    display: block;
}

.case-description p {
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
}

/* Chat History Styles */
.chat-history-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border-color);
}

.chat-messages {
    overflow-y: auto;
    margin-top: 16px;
}

.chat-message {
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
}

.chat-message.user {
    background: rgba(99, 102, 241, 0.05);
    border-color: rgba(99, 102, 241, 0.1);
}

.chat-message.ai {
    background: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.1);
}

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

.message-header .sender {
    font-weight: 700;
    font-size: 13px;
    color: var(--text-primary);
}

.message-header .timestamp {
    font-size: 11px;
    color: var(--text-sub-color);
}

.message-content {
    color: var(--text-primary);
    line-height: 1.5;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    max-width: 100%;
    width: 100%;
    display: block;
}

/* Ensure chat-row content also has proper wrapping */
.chat-row .chat-content {
    color: var(--text-primary);
    line-height: 1.5;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    max-width: 100%;
    width: 100%;
    display: block;
}

.no-messages {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-sub-color);
}

.no-messages i {
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-messages p {
    margin-bottom: 8px;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-sub-color);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 8px;
    transition: color 0.2s ease;
}

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

/* Case Selector Dropdown for AI Chat - Removed negative margins */
.case-selector-dropdown {
    position: relative;
    display: flex;
    max-width: 300px;
    width: auto;
}

.chat-input .case-selector-dropdown {
    margin: 0 auto;
    justify-self: center;
}

.case-selector-trigger {
    padding: 11px 16px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    height: 50px;
    color: var(--text-primary);
    min-width: 330px;
}

.case-selector-trigger .fas.fa-chevron-down {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    margin-left: 8px;
}

/* Light mode styling for case selector */
body.light-theme .case-selector-trigger {
    border: 1px solid #d1d5db !important;
    background: rgba(255, 255, 255, 0.95) !important;
}

body.light-theme .case-selector-trigger:hover {
    border-color: #9ca3af !important;
    background: #f8fafc !important;
}

body.light-theme .case-selector-trigger .fas.fa-chevron-down {
    color: #4a5568 !important;
}

.case-selector-trigger:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

.case-selector-trigger.active {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

.selected-case {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.case-color-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.selected-case-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.selected-case-title {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom:-8px;
}

.selected-case-number {
    font-size: 11px;
    color: var(--text-sub-color);
}



.case-selector-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    margin-bottom: 8px;
    min-width: 300px;
}

/* Modal case selector override for overflow fix */
#modalCaseSelectorMenu {
    z-index: 10000 !important;
    position: absolute !important;
}

.case-selector-menu.active {
    display: block;
}

.case-search {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.case-search input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
}

.case-option {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.case-option:last-child {
    border-bottom: none;
}

.case-option:hover {
    background: var(--bg-primary);
}

.case-option.selected {
    background: rgba(100, 240, 212, 0.1);
}

/* Responsive Media Queries */
@media (max-width: 1200px) {
    .case-selector-dropdown {
        margin-left: 60px;
    }
    
    .case-selector-trigger {
        min-width: 280px;
    }
}

@media (max-width: 1024px) {
    .case-selector-dropdown {
        margin-left: 40px;
    }
    
    .case-selector-trigger {
        min-width: 250px;
    }
}

@media (max-width: 768px) {
    .case-selector-dropdown {
        margin-left: 20px;
        max-width: none;
    }
    
    .case-selector-trigger {
        min-width: 200px;
        padding: 10px 12px;
    }
    
    .selected-case-title {
        font-size: 13px;
    }
    
    .selected-case-number {
        font-size: 10px;
    }
    
    .case-info-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .case-selector-dropdown {
        margin-left: 10px;
        margin-right: 10px;
    }
    
    .case-selector-trigger {
        min-width: 180px;
        padding: 8px 10px;
    }
    
    .case-selector-menu {
        min-width: 250px;
    }
}

@media (max-width: 480px) {
    .case-selector-dropdown {
        margin-left: 5px;
        margin-right: 5px;
    }
    
    .case-selector-trigger {
        min-width: 150px;
        padding: 8px;
    }
    
    .selected-case-title {
        font-size: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
    }
    
    .selected-case-number {
        font-size: 9px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
    }
    
    .case-selector-menu {
        min-width: 200px;
        left: -10px;
        right: -10px;
    }
}

/* Mobile Responsive Styles for Dashboard, Cases, and Documents */
@media (max-width: 768px) {
    /* Main Layout Adjustments */
    .main-layout,
    .dashboard-layout {
        flex-direction: column;
        height: 100vh;
    }
    
    /* Hide desktop sidebar on mobile */
    .sidebar {
        display: none;
    }
    
    /* Mobile Chat Layout */
    .chat-section {
        display: flex;
        flex-direction: column;
        height: 100vh;
        overflow: hidden;
    }
    
    /* Mobile Chat Header */
    .chat-header {
        background: var(--bg-primary);
        border-bottom: 1px solid var(--border-color);
        padding: 1rem;
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
    
    /* Mobile Top Bar */
    .mobile-top-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }
    
    .mobile-app-title {
        font-size: 1.25rem;
        font-weight: 700;
        color: var(--text-primary);
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    
    /* Mobile Agent Selector */
    .mobile-agent-selector {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        width: 100%;
        margin-top: 0.5rem;
    }
    
    .mobile-chat-threads-btn {
        background: var(--bg-secondary);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 0.5rem;
        color: var(--text-primary);
        cursor: pointer;
        transition: all 0.2s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
    }
    
    .mobile-chat-threads-btn:hover {
        background: var(--bg-primary);
    }
    
    /* Mobile Chat Threads Panel */
    .mobile-chat-threads {
        position: fixed;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100vh;
        background: var(--bg-primary);
        z-index: 1000;
        transition: left 0.3s ease;
        overflow-y: auto;
        padding: 1rem;
    }
    
    .mobile-chat-threads.open {
        left: 0;
    }
    
    .mobile-threads-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
        border-bottom: 1px solid var(--border-color);
    }
    
    .mobile-threads-title {
        font-size: 1.25rem;
        font-weight: 700;
        color: var(--text-primary);
    }
    
    .mobile-close-threads {
        background: none;
        border: none;
        color: var(--text-primary);
        font-size: 1.25rem;
        cursor: pointer;
        padding: 0.5rem;
        border-radius: 6px;
        transition: background-color 0.2s ease;
    }
    
    .mobile-close-threads:hover {
        background: var(--bg-secondary);
    }
    
    /* Mobile Threads Content */
    .mobile-threads-content {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .mobile-thread-item {
        display: flex;
        align-items: center;
        gap: 1rem;
        padding: 1rem;
        border-radius: 12px;
        background: var(--bg-secondary);
        border: 1px solid var(--border-color);
        cursor: pointer;
        transition: all 0.2s ease;
    }
    
    .mobile-thread-item:hover {
        background: var(--bg-primary);
        border-color: #d1d5db;
    }
    
    .mobile-thread-item:active {
        transform: translateY(1px);
    }
    
    .thread-icon {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: linear-gradient(135deg, #72c9ff, #b2d8c2);
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 1rem;
        flex-shrink: 0;
    }
    
    .thread-info {
        flex: 1;
        min-width: 0;
    }
    
    .thread-title {
        font-size: 1rem;
        font-weight: 500;
        color: var(--text-primary);
        margin-bottom: 0.25rem;
        line-height: 1.4;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .thread-time {
        font-size: 0.875rem;
        color: var(--text-sub-color);
        opacity: 0.8;
    }
    
    /* Mobile New Conversation Button */
    .mobile-new-conversation {
        margin-top: 2rem;
        padding-top: 1.5rem;
        border-top: 1px solid var(--border-color);
    }
    
    .new-conversation-btn {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.75rem;
        padding: 1rem;
        background: linear-gradient(135deg, #72c9ff, #b2d8c2);
        color: white;
        border: none;
        border-radius: 12px;
        font-size: 1rem;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    
    .new-conversation-btn:hover {
        background: linear-gradient(135deg, #b2d8c2, #b2d8c2);
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    }
    
    .new-conversation-btn:active {
        transform: translateY(0);
    }
    
    /* Light theme adjustments for mobile threads */
    body.light-theme .mobile-thread-item {
        border: 1px solid #d1d5db;
        background: rgba(255, 255, 255, 0.9);
    }
    
    body.light-theme .mobile-thread-item:hover {
        background: #f8fafc;
        border-color: #9ca3af;
    }
    
    /* Light theme text contrast fixes */
    body.light-theme .thread-title {
        color: #1a202c;
        font-weight: 700;
    }
    
    body.light-theme .thread-time {
        color: #4a5568;
    }
    
    body.light-theme .new-conversation-btn {
        background: #1a202c;
        color: white;
    }
    
    body.light-theme .new-conversation-btn:hover {
        background: #2d3748;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(26, 32, 44, 0.3);
    }
    
    /* Light mode agent selector border fix */
    body.light-theme .agent-selector-trigger {
        border: 1px solid #d1d5db;
        background: rgba(255, 255, 255, 0.95);
    }
    
    body.light-theme .agent-selector-trigger:hover {
        border-color: #9ca3af;
        background: #f8fafc;
    }
    
    body.light-theme .agent-selector-trigger.active {
        border-color: #9ca3af;
        background: #f8fafc;
    }
    
    body.light-theme .agent-selector-trigger .fas.fa-chevron-down {
        color: #6b7280;
    }
    
    /* Light mode sidebar chat history styling */
    body.light-theme .chat-info h4 {
        color: #1a202c;
        font-weight: 700;
    }
    
    body.light-theme .chat-info span {
        color: #4a5568;
    }
    
    /* Light mode chat input button icons */
    body.light-theme .input-btn {
        color: #4a5568 !important;
    }
    
    body.light-theme .input-btn:hover {
        color: #1a202c !important;
    }
    
    body.light-theme .send-btn {
        background: linear-gradient(135deg, #1a202c, #2d3748);
        color: white;
    }
    

    
    .mobile-menu-btn {
        background: none;
        border: none;
        color: var(--text-primary);
        font-size: 1.25rem;
        cursor: pointer;
        padding: 0.5rem;
        border-radius: 6px;
        transition: background-color 0.2s ease;
    }
    
    .mobile-menu-btn:hover {
        background: var(--bg-secondary);
    }
    
    .mobile-logo {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-weight: 700;
        color: var(--text-primary);
    }
    
    .mobile-logo img {
        height: 24px;
        width: auto;
    }
    
    /* Mobile Overlay */
    .mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
        transition: opacity 0.3s ease;
    }
    
    .mobile-overlay.show {
        display: block;
        opacity: 1;
    }
    
    .main-content {
        padding: 1rem;
        height: auto;
        overflow: visible;
        margin-top: 0;
    }
    
    /* Header Adjustments */
    .header {
        padding: 1rem;
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .header h1 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    /* Dashboard Grid */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .dashboard-card {
        padding: 1rem;
    }
    
    .dashboard-card h3 {
        font-size: 1rem;
    }
    
    /* Chat Container Mobile */
    .chat-container {
        height: calc(100vh - 200px);
        max-height: calc(100vh - 200px);
        border-radius: 8px;
    }
    
    .chat-header {
        padding: 1rem;
        flex-wrap: wrap;
    }
    
    .chat-input-container {
        padding: 1rem;
    }
    
    .chat-input {
        border-radius: 20px;
        padding: 0.5rem;
    }
    
    .input-controls-bottom {
        margin-top: 8px;
        margin-bottom: 16px;
    }
    
    /* Cases Page Mobile */
    .cases-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .cases-controls {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .filter-group {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .filter-group label {
        font-size: 0.8rem;
        margin-bottom: 0.25rem;
    }
    
    .filter-group input,
    .filter-group select {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
    
    /* Cases Grid Mobile */
    .cases-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .case-card {
        padding: 1rem;
    }
    
    .case-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .case-title {
        font-size: 1rem;
        line-height: 1.3;
    }
    
    .case-number {
        font-size: 0.8rem;
    }
    
    .case-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .case-badges {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    /* Documents Page Mobile */
    .documents-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .documents-controls {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .search-bar {
        width: 100%;
    }
    
    .view-toggle {
        justify-content: center;
    }
    
    /* Modal Mobile */
    .modal-content {
        width: 95%;
        max-width: none;
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
        max-height: calc(100vh - 10rem);
    }
    
    /* Form Mobile */
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .form-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.75rem;
        font-size: 1rem;
    }
    
    /* Button Mobile */
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .btn-group {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .header-actions .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    /* Extra small screens */
    .main-content {
        padding: 0.75rem;
    }
    
    .header {
        padding: 0.75rem;
    }
    
    .header h1 {
        font-size: 1.25rem;
    }
    
    .dashboard-card {
        padding: 0.75rem;
    }
    
    .case-card {
        padding: 0.75rem;
    }
    
    .modal-content {
        margin: 0.5rem;
        width: calc(100% - 1rem);
    }
    
    .chat-container {
        height: calc(100vh - 160px);
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .chat-input {
        border-radius: 16px;
        padding: 0.5rem;
    }
    
    .input-controls-bottom {
        gap: 8px;
    }
    
    .input-btn {
        padding: 0.4rem;
        font-size: 0.8rem;
    }
}

body.light-theme .dashboard-layout {
    background: linear-gradient(135deg, 
        rgba(248, 250, 252, 1) 0%, 
        rgba(237, 242, 247, 0.95) 25%, 
        rgba(248, 250, 252, 0.98) 50%, 
        rgba(237, 242, 247, 0.95) 75%, 
        rgba(248, 250, 252, 1) 100%);
}

body.light-theme .sidebar {
    background: rgba(255, 255, 255, 0.95);
}

body.light-theme .chat-container {
    background: rgba(255, 255, 255, 0.8);
}

body.light-theme .chat-sidebar {
    background: rgba(255, 255, 255, 0.9);
}

body.light-theme .chat-main {
    background: rgba(248, 250, 252, 0.6);
}

body.light-theme .top-nav {
    background: rgba(255, 255, 255, 0.9);
}

body.light-theme .chat-input-container {
    background: transparent;
}

body.light-theme .chat-input {
    background: rgba(248, 250, 252, 0.8);
}

body.light-theme .profile-menu {
    background: rgba(255, 255, 255, 0.95);
}

body.light-theme .message-content {
    background: rgba(26, 32, 44, 0.05);
    color: var(--text-primary);
}

/* File Upload Styles */
.uploaded-files-container {
    display: none;
    flex-wrap: nowrap;
    gap: 8px;
    margin-bottom: 12px;
    padding: 8px 0 0 0;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.uploaded-files-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.file-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
    color: white;
    font-weight: 500;
    max-width: 200px;
    min-width: 120px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
    white-space: nowrap;
    height: 48px;
}

.file-pill .file-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.file-pill .file-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    flex: 1;
    min-width: 0;
}

.file-pill .file-name {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.file-pill .file-type {
    font-size: 10px;
    opacity: 0.7;
    text-transform: uppercase;
    font-weight: 400;
}

/* File pill uploading state */
.file-pill.uploading {
    opacity: 0.7;
    position: relative;
}

.file-pill.uploading .file-icon {
    opacity: 0.6;
}

.upload-spinner {
    color: #72c9ff;
    font-size: 14px;
    animation: spin 1s linear infinite;
    margin-left: auto;
    flex-shrink: 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.file-pill .file-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.file-pill .file-thumbnail {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.file-pill .file-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.remove-file-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 2px;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.remove-file-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

.file-attachment {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.file-attachment i {
    font-size: 16px;
}

.file-attachment span {
    font-weight: 500;
}

#uploadProgress {
    display: none;
    padding: 8px;
    color: var(--text-sub-color);
    font-size: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Typing indicator styles */
.typing-indicator {
    opacity: 0.7;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-sub-color);
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Remove duplicate message styling - styles are now defined above */

/* Legacy styling cleaned up - using new message styles above */

.ai-message .message-time {
    text-align: left;
}

/* Typing Indicator */
.typing-indicator .message-text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.typing-dots {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-teal);
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

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

/* Light theme chat messages */
body.light-theme .ai-message .message-content {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

body.light-theme .message-time {
    opacity: 0.5;
}

/* AI agent name styling */
.ai-agent-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-teal);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
    opacity: 0.8;
}

/* Voice Chat Overlay */
.voice-chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.voice-chat-content {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    min-width: 300px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.voice-chat-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--accent-teal);
}

.voice-chat-overlay.thinking .voice-chat-icon {
    color: var(--purple-accent);
    animation: pulse 2s infinite;
}

.voice-chat-overlay.speaking .voice-chat-icon {
    color: var(--blue-accent);
    animation: bounce 1s infinite;
}

.voice-chat-message {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.voice-chat-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.voice-chat-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-teal);
    animation: dots 1.5s infinite ease-in-out;
}

.voice-chat-dots span:nth-child(1) {
    animation-delay: -0.3s;
}

.voice-chat-dots span:nth-child(2) {
    animation-delay: -0.15s;
}

.voice-chat-dots span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes dots {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

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

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Light theme voice chat overlay */
body.light-theme .voice-chat-overlay {
    background: rgba(255, 255, 255, 0.9);
}

body.light-theme .voice-chat-content {
    background: var(--bg-primary);
    border-color: var(--border-color);
}

/* Theme-responsive logos */
.theme-responsive-logo {
    transition: all 0.3s ease;
}

body:not(.light-theme) .theme-responsive-logo {
    content: url('/static/images/lawyer-ai-white.png');
}

body.light-theme .theme-responsive-logo {
    content: url('/static/images/lawyer-ai.png');
}

/* Ensure proper logo sizing */
.sidebar-logo,
.logo-image {
    height: 32px;
    width: auto;
}

/* Ensure proper voice wave icon sizing */
.voice-wave-icon {
    width: 20px !important;
    height: 20px !important;
    transition: all 0.2s ease;
}

/* Import Lato font for RTV modal */
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap');

/* Simple visualizer circle animation */
#rtv-visualizer-circle.is-speaking {
    animation: simple-pulse 1.5s infinite;
}

@keyframes simple-pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4); }
    70% { box-shadow: 0 0 0 20px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

/* Ensure chat bubble styles exist */
.chat-bubble { 
    max-width: 75%; 
    padding: 10px 15px; 
    border-radius: 20px; 
    margin-bottom: 10px; 
}
.user-bubble { 
    background-color: #3b82f6; 
    color: white; 
    align-self: flex-end; 
}
.ai-bubble { 
    background-color: #e9ecef; 
    color: #333; 
    align-self: flex-start; 
}

/* RTV Modal Styles */
#rtv-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
}

#rtv-modal.hidden {
    display: none !important;
}

#rtv-visualizer-circle.is-speaking {
    animation: simple-pulse 1.5s infinite;
}

@keyframes simple-pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4); }
    70% { box-shadow: 0 0 0 20px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

/* === Phase 1 UI Enhancements: Chat Bubble Width Constraints & Text Wrapping === */

/* 1a. Target each chat bubble so it never stretches full‑width */
.chat-messages .chat-bubble,
.chat-messages .ai-bubble,
.chat-messages .user-bubble {
    max-width: 70%;              /* or whatever % you prefer */
    margin-bottom: 0.75rem;      /* keep your vertical gutter */
    white-space: pre-wrap;       /* preserve newlines */
    overflow-wrap: break-word;   /* break long words/URLs */
}

/* 1b. Ensure the outer container centres its content */
.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
}

/* Legacy chat bubble styles (updated with new constraints) */
.chat-bubble { 
    max-width: 70%; 
    padding: 10px 15px; 
    border-radius: 20px; 
    margin-bottom: 10px; 
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-wrap: break-word; 
}
.user-bubble { 
    background-color: #3b82f6; 
    color: white; 
    align-self: flex-end; 
}
.ai-bubble { 
    background-color: #e9ecef; 
    color: #333; 
    align-self: flex-start; 
}

/* 2. Remove Underline from "New Conversation" Link */
.new-conversation-btn a,
.new-conversation-btn {
    text-decoration: none !important;
}

/* Alternative selectors for chat sidebar panel */
.chat-history-panel .new-conversation-btn,
.chat-history-panel .new-conversation-btn a {
    text-decoration: none !important;
}

/* Chat history panel new conversation button styling */
#chatHistoryPanel .new-conversation-btn,
#chatHistoryPanel .new-conversation-btn a {
    text-decoration: none !important;
}

#rtv-modal.flex {
    display: flex !important;
}

#rtv-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#rtv-instruction-text {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 2.5rem;
    color: white;
    text-align: center;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    max-width: 80%;
    line-height: 1.2;
}

#close-rtv-button, #mute-rtv-button {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

#close-rtv-button {
    background: rgba(220, 53, 69, 0.7) !important;
    color: var(--raisin-black) !important;
    width: 48px !important;
    height: 48px !important;
    font-size: 1rem !important;
    font-weight: normal !important;
}

#close-rtv-button:hover {
    background: rgba(220, 53, 69, 0.9) !important;
    transform: scale(1.05) !important;
}

#mute-rtv-button {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

#mute-rtv-button:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Responsive adjustments for RTV modal */
@media (max-width: 768px) {
    #rtv-instruction-text {
        font-size: 1.8rem;
        max-width: 90%;
    }
    
    #close-rtv-button, #mute-rtv-button {
        width: 56px;
        height: 56px;
        font-size: 1.25rem;
    }
}

/* File Upload Styling */
.upload-progress {
    margin: 0.5rem 0;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    animation: fadeIn 0.3s ease-in;
}

.upload-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.upload-icon {
    color: var(--accent-teal);
    font-size: 1.2rem;
}

.upload-details {
    flex: 1;
}

.upload-filename {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.upload-status {
    font-size: 0.8rem;
    color: var(--text-sub-color);
    margin-top: 0.25rem;
}

.upload-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--purple-accent), var(--blue-accent));
    border-radius: 2px;
    animation: progress-animation 1.5s ease-in-out infinite;
}

@keyframes progress-animation {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* Uploaded File Info */
.uploaded-file-info {
    margin: 0.5rem 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    animation: fadeIn 0.3s ease-in;
}

.file-info-header {
    padding: 0.75rem 1rem;
    background: rgba(var(--accent-teal-rgb), 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--accent-teal);
}

.file-info-content {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.file-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 1.2rem;
    color: var(--accent-teal);
}

.file-details {
    flex: 1;
}

.file-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.file-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-sub-color);
}

.file-actions {
    display: flex;
    gap: 0.5rem;
}

.file-action-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-sub-color);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.file-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.file-error {
    padding: 0.75rem 1rem;
    background: rgba(255, 107, 107, 0.1);
    border-top: 1px solid rgba(255, 107, 107, 0.2);
    color: #ff9999;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.file-ready-notice {
    padding: 0.75rem 1rem;
    background: rgba(var(--accent-teal-rgb), 0.1);
    border-top: 1px solid rgba(var(--accent-teal-rgb), 0.2);
    color: var(--accent-teal);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

/* Light theme file upload styles */
body.light-theme .upload-progress,
body.light-theme .uploaded-file-info {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-theme .file-info-header {
    background: rgba(var(--accent-teal-rgb), 0.1);
}

body.light-theme .file-icon,
body.light-theme .file-action-btn {
    background: rgba(0, 0, 0, 0.1);
}

body.light-theme .file-action-btn:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* File Upload in Input Area */
.uploaded-file-info-input {
    margin: 0 0 1rem 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    animation: fadeIn 0.3s ease-in;
}

.uploaded-file-info-input .file-info-content {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.uploaded-file-info-input .file-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 1rem;
    color: var(--accent-teal);
}

.uploaded-file-info-input .file-details {
    flex: 1;
}

.uploaded-file-info-input .file-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.uploaded-file-info-input .file-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-sub-color);
}

.uploaded-file-info-input .file-actions {
    display: flex;
    gap: 0.5rem;
}

.uploaded-file-info-input .file-action-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-sub-color);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 0.8rem;
}

.uploaded-file-info-input .file-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.uploaded-file-info-input .file-error {
    padding: 0.75rem 1rem;
    background: rgba(255, 107, 107, 0.1);
    border-top: 1px solid rgba(255, 107, 107, 0.2);
    color: #ff9999;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Chat input container adjustments when file is attached */
.chat-input-container.has-file-attached {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1rem;
}

/* Light theme file upload in input area */
body.light-theme .uploaded-file-info-input {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-theme .uploaded-file-info-input .file-icon,
body.light-theme .uploaded-file-info-input .file-action-btn {
    background: rgba(0, 0, 0, 0.1);
}

body.light-theme .uploaded-file-info-input .file-action-btn:hover {
    background: rgba(0, 0, 0, 0.2);
}

body.light-theme .chat-input-container.has-file-attached {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* File Pill Styling */
.uploaded-file-pill {
    margin: 0 0 1rem 0;
    animation: fadeIn 0.3s ease-in;
}

.loading-pill {
    opacity: 0.8;
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #3a3f5c;
    border-top: 2px solid #72c9ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.file-pill-content {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 8px 12px 8px 8px;
    gap: 8px;
    max-width: 300px;
}

.file-pill-icon {
    width: 32px;
    height: 32px;
    background: #e74c3c;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
}

.file-pill-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.file-pill-type {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.file-pill-name {
    font-size: 12px;
    color: white;
    font-weight: bold;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-pill-close {
    width: 20px;
    height: 20px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-sub-color);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 10px;
    flex-shrink: 0;
}

.file-pill-close:hover {
    background: rgba(255, 255, 255, 0.3);
    color: var(--text-primary);
}

/* Light theme file pill */
body.light-theme .file-pill-content {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-theme .file-pill-close {
    background: rgba(0, 0, 0, 0.1);
}

body.light-theme .file-pill-close:hover {
    background: rgba(0, 0, 0, 0.2);
}

body.light-theme .message-content p {
    color: var(--text-primary);
}

/* Light theme markdown formatting */
body.light-theme .message-text h1,
body.light-theme .message-text h2,
body.light-theme .message-text h3,
body.light-theme .message-text h4 {
    color: var(--text-primary);
}

body.light-theme .message-text strong {
    color: var(--text-primary);
}

body.light-theme .message-text li {
    color: var(--text-primary);
}

body.light-theme .message-text code {
    background: rgba(0, 0, 0, 0.1);
    color: var(--accent-teal);
}

body.light-theme .message-text pre {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-theme .message-text pre code {
    color: var(--text-primary);
}

/* Message File Attachments */
.message-file-attachment {
    margin-bottom: 8px;
}

.file-attachment-content {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 8px 12px;
    gap: 8px;
    max-width: 280px;
}

.file-attachment-icon {
    width: 32px;
    height: 32px;
    background: #e74c3c;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
}

.file-attachment-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.file-attachment-name {
    font-size: 12px;
    color: white;
    font-weight: bold;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-attachment-type {
    font-size: 11px;
    color: var(--text-sub-color);
    line-height: 1;
}

/* Light theme file attachments */
body.light-theme .file-attachment-content {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-theme .file-attachment-name {
    color: var(--text-primary);
}

/* === NEW CHAT ROW STYLES FOR INSTANT MESSAGING === */
/* Chat Row Styles - Match server-rendered markup */
.chat-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    max-width: min(85%, 42rem);
    min-width: 0;
    animation: fadeIn 0.3s ease-in;
    margin-bottom: 1.5rem;
}

.chat-row.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-row.ai {
    align-self: flex-start;
}

.chat-row .chat-content {
    padding: 0.75rem 1rem;
    border-radius: 16px;
    line-height: 1.6;
    word-wrap: break-word;
}

.chat-row.user .chat-content {
    background: linear-gradient(135deg, rgba(114, 201, 255, 0.2), rgba(178, 216, 194, 0.2));
    color: white;
    border-radius: 16px;
    font-weight: 400;
    padding: 12px 16px;
    line-height: 1.5;
    width: auto;
    max-width: 100%;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.chat-row.ai .chat-content {
    background: transparent;
    border: none;
    color: var(--text-primary);
    border-radius: 16px 16px 16px 4px;
}

/* Markdown styling within AI responses */
.chat-row.ai .chat-content h1 {
    font-size: 1.5rem;
    margin: 0.5rem 0 1rem 0;
    color: var(--accent-purple);
    font-weight: 700;
}

.chat-row.ai .chat-content h2 {
    font-size: 1.25rem;
    margin: 0.5rem 0 0.75rem 0;
    color: var(--accent-blue);
    font-weight: 700;
}

.chat-row.ai .chat-content h3 {
    font-size: 1.1rem;
    margin: 0.5rem 0 0.5rem 0;
    color: var(--text-primary);
    font-weight: 700;
}

.chat-row.ai .chat-content ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.chat-row.ai .chat-content li {
    margin: 0.25rem 0;
    color: var(--text-primary);
}

.chat-row.ai .chat-content strong {
    color: var(--accent-purple);
    font-weight: 700;
}

.chat-row.ai .chat-content em {
    color: var(--accent-blue);
    font-style: italic;
}

.chat-row.ai .chat-content p {
    margin: 0.5rem 0;
    color: var(--text-primary);
}

/* Light mode adjustments */
[data-theme="light"] .chat-row.ai .chat-content {
    background: transparent;
    border: none;
    color: var(--text-primary);
}

[data-theme="light"] .chat-row.ai .chat-content h1 {
    color: var(--accent-purple);
}

[data-theme="light"] .chat-row.ai .chat-content h2 {
    color: var(--accent-blue);
}

[data-theme="light"] .chat-row.ai .chat-content strong {
    color: var(--accent-purple);
}

[data-theme="light"] .chat-row.ai .chat-content em {
    color: var(--accent-blue);
}

/* View Selector Dropdown */
.view-selector-dropdown {
    position: relative;
    display: inline-block;
    margin-right: 12px;
}

.view-selector-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.view-selector-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-purple);
}

.view-selector-btn i:last-child {
    font-size: 12px;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.view-selector-btn.active i:last-child {
    transform: rotate(180deg);
}

.view-selector-menu {
    position: absolute;
    top: 54%;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 120px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.view-selector-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.view-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.view-option:hover {
    background: var(--bg-hover);
}

.view-option:first-child {
    border-radius: 7px 7px 0 0;
}

.view-option:last-child {
    border-radius: 0 0 7px 7px;
}

.view-option i {
    width: 16px;
    font-size: 14px;
    color: var(--text-sub-color);
}

.view-option.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-purple);
}

.view-option.active i {
    color: var(--accent-purple);
}

/* Light theme view selector */
body.light-theme .view-selector-btn {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .view-selector-btn:hover {
    background: rgba(255, 255, 255, 1);
    border-color: var(--accent-purple);
}

body.light-theme .view-selector-menu {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

body.light-theme .view-option:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Cases Grid Container - True Grid Layout */
#cases.list-view {
    display: grid;
    grid-template-columns: 
        2fr   /* Client */
        1.5fr /* Point of Contact */
        1.2fr /* Type */
        1fr   /* Start Date */
        1fr   /* Last Updated */
        1.2fr /* Next Action Due */
        1fr   /* Stage */
        1fr   /* Progress */
        1fr;  /* Actions */
    gap: 0;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

/* Every direct child becomes a "row" cell */
#cases.list-view > .case-item {
    display: contents;
}

/* Table headers styling */
.table-header {
    padding: 12px 16px;
    background: rgba(55, 65, 81, 0.8);
    color: var(--text-sub-color);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

/* Each individual case field gets its own cell */
.case-item .field {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    min-height: 60px;
    transition: background-color 0.2s ease;
}

/* Hover effect for entire case row */
.case-item:hover .field {
    background-color: rgba(255, 255, 255, 0.03);
}

/* Case title and number styling */
.case-client {
    justify-content: flex-start !important;
    align-items: flex-start !important;
    flex-direction: column;
}

.case-client .case-title {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
    text-align: left;
}

.case-client .case-number {
    font-size: 12px;
    color: var(--text-sub-color);
    opacity: 0.8;
    text-align: left;
}

/* Last Updated field font size fix */
.case-last-updated {
    font-size: 13px !important;
}

/* Cards View (Alternative Layout) */
#cases.cards-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    padding: 1rem;
}

#cases.cards-view .case-item {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Hide grid layout styles when in cards view */
#cases.cards-view .case-item .field {
    border-bottom: none;
    padding: 0;
}

/* Case Title Styling */
.case-title {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.case-number {
    font-size: 0.75rem;
    color: var(--text-sub-color);
    opacity: 0.8;
}

/* Priority Badge Styling */
.priority-high {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.priority-medium {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.priority-low {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

/* Status Badge Styling */
.status-badge.status-active {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-badge.status-pending {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-badge.status-completed {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

/* Type Badge Styling - improved contrast */
.type-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: capitalize;
}

/* Dark Mode Badge Styles */
[data-theme="dark"] .type-badge.estate-planning,
:root .type-badge.estate-planning {
    background: rgba(139, 92, 246, 0.3);
    color: #e0e7ff;
}

[data-theme="dark"] .type-badge.personal-injury,
:root .type-badge.personal-injury {
    background: rgba(239, 68, 68, 0.3);
    color: #fecaca;
}

[data-theme="dark"] .type-badge.corporate,
:root .type-badge.corporate {
    background: rgba(59, 130, 246, 0.3);
    color: #dbeafe;
}

[data-theme="dark"] .type-badge.family-law,
:root .type-badge.family-law {
    background: rgba(34, 197, 94, 0.3);
    color: #dcfce7;
}

[data-theme="dark"] .type-badge.real-estate,
:root .type-badge.real-estate {
    background: rgba(249, 115, 22, 0.3);
    color: #fed7aa;
}

[data-theme="dark"] .type-badge.criminal-defense,
:root .type-badge.criminal-defense {
    background: rgba(168, 85, 247, 0.3);
    color: #f3e8ff;
}

[data-theme="dark"] .type-badge.intellectual-property,
:root .type-badge.intellectual-property {
    background: rgba(168, 85, 247, 0.3);
    color: #f3e8ff;
}

/* Light Mode Badge Styles */
[data-theme="light"] .type-badge.estate-planning {
    background: rgba(139, 92, 246, 0.2);
    color: #6b21a8;
}

[data-theme="light"] .type-badge.personal-injury {
    background: rgba(239, 68, 68, 0.2);
    color: #991b1b;
}

[data-theme="light"] .type-badge.corporate {
    background: rgba(59, 130, 246, 0.2);
    color: #1e40af;
}

[data-theme="light"] .type-badge.family-law {
    background: rgba(34, 197, 94, 0.2);
    color: #166534;
}

[data-theme="light"] .type-badge.real-estate {
    background: rgba(249, 115, 22, 0.2);
    color: #c2410c;
}

[data-theme="light"] .type-badge.criminal-defense {
    background: rgba(168, 85, 247, 0.2);
    color: #7c2d12;
}

[data-theme="light"] .type-badge.intellectual-property {
    background: rgba(168, 85, 247, 0.2);
    color: #7c2d12;
}

/* Stage Badge Styling - improved contrast */
.stage-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

/* Dark Mode Stage Badge Styles */
[data-theme="dark"] .stage-badge.pending,
:root .stage-badge.pending {
    background: rgba(245, 158, 11, 0.3);
    color: #fef3c7;
}

[data-theme="dark"] .stage-badge.active,
:root .stage-badge.active {
    background: rgba(34, 197, 94, 0.3);
    color: #dcfce7;
}

[data-theme="dark"] .stage-badge.completed,
:root .stage-badge.completed {
    background: rgba(59, 130, 246, 0.3);
    color: #dbeafe;
}

[data-theme="dark"] .stage-badge.on-hold,
:root .stage-badge.on-hold {
    background: rgba(156, 163, 175, 0.3);
    color: #f9fafb;
}

/* Light Mode Stage Badge Styles */
[data-theme="light"] .stage-badge.pending {
    background: rgba(245, 158, 11, 0.2);
    color: #92400e;
}

[data-theme="light"] .stage-badge.active {
    background: rgba(34, 197, 94, 0.2);
    color: #166534;
}

[data-theme="light"] .stage-badge.completed {
    background: rgba(59, 130, 246, 0.2);
    color: #1e40af;
}

[data-theme="light"] .stage-badge.on-hold {
    background: rgba(156, 163, 175, 0.2);
    color: #374151;
}

/* Profile Dropdown Styling */
.profile-dropdown {
    position: relative;
    display: inline-block;
}

.profile-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.profile-trigger:hover {
    opacity: 0.8;
}

.profile-avatar {
    width: 36px;
    height: 36px;
    background: var(--accent-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
}

.profile-chevron {
    font-size: 12px;
    color: var(--text-sub-color);
    transition: transform 0.2s ease;
}

.profile-dropdown.active .profile-chevron {
    transform: rotate(180deg);
}

.profile-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    padding: 8px 0;
}

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

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

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.profile-menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.profile-menu-item i {
    width: 16px;
    font-size: 14px;
}

.profile-menu-item.logout {
    color: #ef4444;
}

.profile-menu-item.logout:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Account Settings Page Styling */
.account-layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg-primary);
}

.account-sidebar {
    width: 240px;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    padding: 24px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.account-nav {
    padding: 0 16px;
}

.account-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-sub-color);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
}

.account-nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.account-nav-item.active {
    background: rgba(118, 85, 233, 0.12);
    color: #E6DFF2;
}

.account-nav-item i {
    width: 16px;
    font-size: 14px;
}

.account-content {
    flex: 1;
    padding: 40px;
    max-width: 800px;
}

.account-section {
    margin-bottom: 48px;
    scroll-margin-top: 24px;
}

.account-section h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.account-section p {
    color: var(--text-sub-color);
    margin-bottom: 24px;
    line-height: 1.6;
}

.settings-group {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.settings-group h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

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

.settings-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.settings-item-info {
    flex: 1;
}

.settings-item-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.settings-item-desc {
    font-size: 13px;
    color: var(--text-sub-color);
    line-height: 1.4;
}

.settings-action {
    margin-left: 16px;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-hover);
}

.btn-danger {
    background: transparent;
    border: 1px solid #ef4444;
    color: #ef4444;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Profile Photo Upload */
.profile-photo-upload {
    display: flex;
    align-items: center;
    gap: 16px;
}

.current-photo {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    font-weight: 700;
    text-transform: uppercase;
}

.photo-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.photo-actions .btn-secondary {
    padding: 6px 12px;
    font-size: 12px;
}

/* Referral Modal */
.referral-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.referral-modal.show {
    opacity: 1;
    visibility: visible;
}

.referral-modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    padding: 32px;
    position: relative;
}

.referral-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-sub-color);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.referral-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.referral-header {
    text-align: center;
    margin-bottom: 24px;
}

.referral-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.referral-header p {
    color: var(--text-sub-color);
    font-size: 14px;
}

.referral-link-section {
    margin-bottom: 24px;
}

.referral-link-input {
    display: flex;
    gap: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 4px;
}

.referral-link-input input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    padding: 8px 12px;
    font-size: 13px;
    outline: none;
}

.copy-link-btn {
    background: var(--accent-gradient);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.copy-link-btn:hover {
    opacity: 0.9;
}

.referral-stats {
    display: flex;
    gap: 16px;
}

.referral-stat {
    flex: 1;
    text-align: center;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

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

.referral-stat-label {
    font-size: 12px;
    color: var(--text-sub-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Account Settings Layout - Clone Dashboard Structure */
.account-settings-container {
    display: flex;
    width: 100%;
    padding: 20px;
    gap: 20px;
    flex: 1;
    overflow-y: auto;
}

.account-sidebar {
    width: 250px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 20px;
    height: fit-content;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
}

.account-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.account-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-sub-color);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
}

.account-nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    text-decoration: none;
}

.account-nav-item.active {
    background: rgba(118, 85, 233, 0.12);
    color: #E6DFF2;
    border-left: 0;
    margin-left: 0;
    padding-left: 16px;
}

.account-nav-item.active i {
    color: #C3B3F1;
}

.account-nav-item i {
    width: 16px;
    font-size: 14px;
}

.account-content {
    flex: 1;
    background: rgba(26, 32, 44, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
}

/* Team Management Styles */
.team-container {
    padding: 20px;
    width: 1000px;
    min-width: 1000px;
    max-width: 1000px;
    margin: 0 auto;
}

.team-invite-section {
    background: rgba(26, 32, 44, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
}

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

.section-header h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-sub-color);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.invite-content h3 {
    color: var(--text-sub-color);
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 16px;
}

.invite-emails {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    min-height: 60px;
    align-items: flex-start;
    width: 100%;
    box-sizing: border-box;
}

.email-tag {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.email-tag span {
    color: var(--text-primary);
}

.remove-email {
    background: none;
    border: none;
    color: var(--text-sub-color);
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    transition: color 0.2s ease;
}

.remove-email:hover {
    color: var(--error-color);
}

.email-input-container {
    width: 100%;
    margin-bottom: 20px;
    position: relative;
}

.email-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: var(--text-primary);
    outline: none;
    padding: 16px;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.email-input:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 2px rgba(178, 216, 194, 0.2);
}

.email-input::placeholder {
    color: var(--text-sub-color);
}

.email-error {
    display: none;
    color: var(--error-color);
    font-size: 12px;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid rgba(255, 71, 87, 0.3);
    border-radius: 6px;
}

.invite-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.role-selector {
    flex: 1;
    max-width: 200px;
}

.role-dropdown {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.role-dropdown:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 2px rgba(178, 216, 194, 0.2);
}

.role-dropdown option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 8px 12px;
}

.send-invite-btn {
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-blue) 100%);
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.send-invite-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(178, 216, 194, 0.3);
}

.members-list-section {
    background: rgba(26, 32, 44, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
}

.members-list-section h2 {
    color: var(--text-sub-color);
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 20px;
}

.members-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.member-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.member-row:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.member-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.member-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--jade-green), var(--maya-blue));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: 700;
}

.member-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.member-name {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}

.member-email {
    color: var(--text-sub-color);
    font-size: 12px;
}

.member-role-selector {
    display: flex;
    align-items: center;
    gap: 12px;
}

.role-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-badge.owner {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.role-dropdown-container {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.custom-role-dropdown {
    position: relative;
    min-width: 120px;
}

.role-dropdown-selected {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-dropdown-selected:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.role-dropdown-selected .fas {
    font-size: 10px;
    margin-left: 8px;
    transition: transform 0.2s ease;
}

.custom-role-dropdown.open .role-dropdown-selected .fas {
    transform: rotate(180deg);
}

.role-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(45, 55, 72, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
    backdrop-filter: blur(20px);
    margin-top: 4px;
}

.custom-role-dropdown.open .role-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.role-option {
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.role-option.selected {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.role-option .fas {
    font-size: 10px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.role-option.selected .fas {
    opacity: 1;
}

.member-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.member-actions-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 6px;
    padding: 8px 10px;
    color: var(--text-sub-color);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.member-actions-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.member-actions-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: rgba(45, 55, 72, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
    min-width: 120px;
    backdrop-filter: blur(20px);
}

.member-actions-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.action-item {
    background: none;
    border: none;
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    transition: all 0.2s ease;
    text-align: left;
}

.action-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.action-item.remove-action:hover {
    background: rgba(255, 71, 87, 0.1);
    color: var(--error-color);
}

.account-section {
    margin-bottom: 48px;
}

.account-section:last-child {
    margin-bottom: 0;
}

.account-section h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.account-section > p {
    color: var(--text-sub-color);
    margin: 0 0 32px 0;
    font-size: 14px;
}

.settings-group {
    margin-bottom: 32px;
}

.settings-group:last-child {
    margin-bottom: 0;
}

.settings-group h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 16px 0;
}

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

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

.settings-item-info {
    flex: 1;
}

.settings-item-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.settings-item-desc {
    font-size: 13px;
    color: var(--text-sub-color);
}

.settings-action {
    flex-shrink: 0;
}

/* Profile Photo Upload Styling */
.profile-photo-upload {
    display: flex;
    align-items: center;
    gap: 16px;
}

.current-photo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.photo-actions {
    display: flex;
    gap: 8px;
}

/* Toggle Switch Styling */
.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: 0.2s;
    border-radius: 24px;
    border: none;
    outline: none;
    box-shadow: none;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-sub-color);
    transition: 0.2s;
    border-radius: 50%;
}

.toggle input:checked + .toggle-slider {
    background: var(--accent-gradient);
    border-color: transparent;
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(20px);
    background-color: white;
}

.toggle:hover .toggle-slider {
    opacity: 0.8;
}

/* Case Actions Styling */
.case-actions i {
    font-size: 1rem;
    color: var(--text-sub-color);
    cursor: pointer;
    transition: color 0.2s ease;
    margin-right: 0.5rem;
}

.case-actions i:hover {
    color: var(--accent-purple);
}

.case-actions i:last-child {
    margin-right: 0;
}

/* Date Picker Calendar Day Highlighting */
.calendar-day.selected-start,
.calendar-day.selected-end {
    border: 2px solid #8a3ffc;
    background: rgba(138, 63, 252, 0.2);
    color: white;
}

.calendar-day.in-range {
    background-color: rgba(111, 66, 193, 0.3);
    color: white;
}

.calendar-day:hover {
    background-color: rgba(138, 63, 252, 0.1);
    cursor: pointer;
}

body {
    font-family: "DM Sans", Arial, sans-serif;
}

/* === LawZen Branded Footer === */
.lawzen-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 3rem 0 2rem 0;
    width: 100%;
    font-family: 'Lato', sans-serif;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 4rem;
}

.footer-brand {
    flex: 0 0 300px;
}

.footer-logo {
    height: 40px;
    width: auto;
    margin-bottom: 1rem;
}

.footer-tagline {
    color: var(--text-sub-color);
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    font-family: 'Lato', sans-serif;
}

.footer-links {
    display: flex;
    gap: 4rem;
    flex: 1;
}

.footer-column {
    flex: 1;
}

.footer-column h4 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-family: 'Lato', sans-serif;
}

.footer-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-column li {
    margin-bottom: 0.75rem;
}

.footer-column a {
    color: var(--text-sub-color);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
    font-family: 'Poppins', sans-serif;
}

.footer-column a:hover {
    color: var(--jade-green);
    text-decoration: none;
}

/* Mobile responsive footer */
@media (max-width: 768px) {
    .footer-container {
        flex-direction: column;
        gap: 2rem;
        text-align: center;
    }
    
    .footer-brand {
        flex: none;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 2rem;
    }
}
}

/* Bottom bar styling for date picker */
.bottom-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 16px;
}

#bottom-range {
    font-weight: 700;
    color: var(--text-primary);
}

.date-picker-actions {
    display: flex;
    gap: 0.5rem;
}

.cases-list.cards-view .table-header {
    display: none;
}

.cases-list.list-view .list-header {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1.2fr 1fr 1.2fr 1fr 1fr 1fr;
    gap: 16px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-sub-color);
}

.cases-list.list-view .case-card {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1.2fr 1fr 1.2fr 1fr 1fr 1fr;
    grid-template-areas: "client contact type file-date next-action stage progress actions";
    gap: 16px;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: var(--text-primary);
    min-height: 60px;
}

.cases-list.list-view .case-client { grid-area: client; }
.cases-list.list-view .case-contact { grid-area: contact; }
.cases-list.list-view .case-type { grid-area: type; }
.cases-list.list-view .case-file-date { grid-area: file-date; }
.cases-list.list-view .case-next-action { grid-area: next-action; }
.cases-list.list-view .case-stage { grid-area: stage; }
.cases-list.list-view .case-progress { grid-area: progress; }
.cases-list.list-view .case-actions { grid-area: actions; }

.cases-list.list-view .case-card:hover {
    background: var(--bg-hover);
}

.cases-list.list-view .case-card:last-child {
    border-bottom: none;
}

.cases-list.list-view .case-client {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cases-list.list-view .case-client-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
    margin: 0;
}

.cases-list.list-view .case-title-small {
    font-size: 11px;
    color: var(--text-sub-color);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.cases-list.list-view .case-type-tag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.case-type-tag.personal-injury {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.case-type-tag.estate-planning {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.case-type-tag.corporate {
    background: rgba(99, 102, 241, 0.1);
    color: #72c9ff;
}

.cases-list.list-view .case-stage-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cases-list.list-view .case-stage {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cases-list.list-view .case-status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cases-list.list-view .case-progress-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cases-list.list-view .case-progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.cases-list.list-view .case-progress-fill {
    height: 100%;
    background: var(--accent-purple);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.cases-list.list-view .case-progress-text {
    font-size: 11px;
    color: var(--text-sub-color);
    font-weight: 500;
    min-width: 32px;
}

.cases-list.list-view .case-date {
    font-size: 12px;
    color: var(--text-sub-color);
}

.cases-list.list-view .case-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.cases-list.list-view .case-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-sub-color);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
}

.cases-list.list-view .case-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent-purple);
}

.cases-list.list-view .case-header,
.cases-list.list-view .case-details,
.cases-list.list-view .case-actions:first-of-type {
    display: none;
}

.cases-list.cards-view .case-client-info,
.cases-list.cards-view .case-stage-info,
.cases-list.cards-view .case-date,
.cases-list.cards-view .case-actions:last-of-type {
    display: none;
}

/* Status badge colors for list view */
.case-status-badge.status-active {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.case-status-badge.status-pending {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.case-status-badge.status-closed {
    background: rgba(107, 114, 128, 0.2);
    color: #6b7280;
}

/* Fix list view text colors */
.cases-list.list-view .case-card * {
    color: inherit;
}

.cases-list.list-view .case-client-name {
    color: var(--text-primary) !important;
}

.cases-list.list-view .case-title-small {
    color: var(--text-sub-color) !important;
}

.cases-list.list-view .case-date {
    color: var(--text-sub-color) !important;
}

.cases-list.list-view .case-progress-text {
    color: var(--text-sub-color) !important;
}

/* New Table Layout for List View */
.list-header {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1.2fr 1fr 1.2fr 1fr 1fr 1fr;
    gap: 16px;
    padding: 12px 20px;
    background: rgba(55, 65, 81, 0.8);
    border-bottom: 1px solid var(--border-color);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-sub-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.list-rows {
    background: var(--bg-secondary);
}

.case-row {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1.2fr 1fr 1.2fr 1fr 1fr 1fr;
    gap: 16px;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background-color 0.2s ease;
}

.case-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.case-row:last-child {
    border-bottom: none;
}

.case-client {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.case-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.case-number {
    font-size: 12px;
    color: var(--text-sub-color);
}

.case-contact {
    font-size: 14px;
    color: var(--text-primary);
}

.type-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.type-badge.estate-planning {
    background: rgba(147, 51, 234, 0.3);
    color: #9333ea;
}

.type-badge.personal-injury {
    background: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.type-badge.corporate {
    background: rgba(99, 102, 241, 0.3);
    color: #72c9ff;
}

.case-file-date,
.case-next-action {
    font-size: 13px;
    color: var(--text-primary);
}

.stage-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stage-badge.pending {
    background: rgba(251, 191, 36, 0.3);
    color: #f59e0b;
}

.stage-badge.discovery {
    background: rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.stage-badge.negotiation {
    background: rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    max-width: 80px;
}

.progress-fill {
    height: 100%;
    background: #3b82f6;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 12px;
    color: var(--text-primary);
    font-weight: 500;
    min-width: 35px;
}

.case-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: flex-end;
}

.case-actions i {
    font-size: 14px;
    color: var(--text-sub-color);
    cursor: pointer;
    transition: color 0.2s ease;
}

.case-actions i:hover {
    color: var(--accent-purple);
}

/* Light theme list view */
body.light-theme .cases-list.list-view {
    border-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .list-header {
    background: rgba(0, 0, 0, 0.03);
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .case-row {
    border-bottom-color: rgba(0, 0, 0, 0.05);
}

body.light-theme .case-row:hover {
    background: rgba(0, 0, 0, 0.02);
}

/* Cases Filter UI */
.cases-filters {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

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

.filter-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-sub-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.filter-dropdown {
    position: relative;
    display: inline-block;
}

.filter-select {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    width: 160px;
    min-width: 160px;
    transition: all 0.2s ease;
}

.filter-select:hover {
    background: var(--bg-hover);
    border-color: var(--accent-purple);
}

.filter-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1f2937 !important;
    background-color: #1f2937 !important;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: none;
    overflow: hidden;
    backdrop-filter: none;
}

.filter-menu.show {
    display: block;
}

.filter-option {
    padding: 10px 14px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.filter-option:last-child {
    border-bottom: none;
}

.filter-option:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.filter-option.active {
    background: var(--accent-purple);
    color: white;
}

.filter-option.active:hover {
    background: var(--accent-purple);
}

.filter-select i {
    font-size: 11px;
    opacity: 0.7;
    margin-left: auto;
}

.filter-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    margin-top: 4px;
}

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

.filter-option {
    padding: 10px 12px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.2s ease;
}

.filter-option:hover {
    background: var(--bg-hover);
}

.filter-option:first-child {
    border-radius: 7px 7px 0 0;
}

.filter-option:last-child {
    border-radius: 0 0 7px 7px;
}

.filter-option.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-purple);
}

/* Date Range Picker */
.date-range-picker {
    position: relative;
    display: inline-block;
}

.date-range-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(45, 55, 72, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    min-width: 200px;
    height: 40px;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.date-range-input:hover {
    background: var(--bg-hover);
    border-color: var(--accent-purple);
}

.date-range-input i {
    font-size: 12px;
    opacity: 0.7;
}

.date-range-text {
    flex: 1;
    text-align: left;
}

.date-picker-modal {
    position: absolute;
    top: 100%;
    left: 0;
    background: rgba(45, 55, 72, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    margin-top: 8px;
    min-width: 600px;
    backdrop-filter: blur(10px);
}

.date-picker-modal.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.date-picker-content {
    display: flex;
    max-height: 400px;
}

.date-picker-presets {
    width: 200px;
    border-right: 1px solid var(--border-color);
    padding: 16px;
}

.preset-header {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-sub-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.preset-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
}

.preset-tab {
    flex: 1;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-sub-color);
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    transition: all 0.2s ease;
}

.preset-tab:hover {
    background: var(--bg-hover);
}

.preset-tab.active {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    color: white;
}

.preset-options {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.preset-option {
    padding: 8px 12px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.preset-option:hover {
    background: rgba(178, 216, 194, 0.1);
    color: var(--accent-purple);
}

.preset-option.active {
    background: rgba(99, 102, 241, 0.2);
    color: var(--accent-purple);
}

.date-picker-calendars {
    flex: 1;
    padding: 16px;
    display: flex;
    gap: 20px;
}

.calendar-container {
    flex: 1;
}

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

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 8px;
}

.calendar-weekdays div {
    padding: 8px;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-sub-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-day {
    padding: 8px;
    text-align: center;
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.calendar-day:hover {
    background: rgba(99, 102, 241, 0.1);
}

.calendar-day.other-month {
    color: var(--text-sub-color);
    opacity: 0.5;
}

.calendar-day.selected {
    background: var(--accent-purple);
    color: white;
}

.calendar-day.start-date,
.calendar-day.end-date {
    background: #463273 !important;
    color: var(--raisin-black) !important;
    border: 1px solid #A076F9 !important;
}

.calendar-day.in-range {
    background: #463273 !important;
    color: var(--raisin-black) !important;
    border: none !important;
}

.calendar-nav {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.calendar-nav:hover {
    background: rgba(99, 102, 241, 0.1);
}

.calendar-month {
    font-weight: 700;
    color: var(--text-primary);
}

/* Results counter styles */
.results-counter {
    font-size: 14px;
    color: var(--text-sub-color);
    margin-left: 12px;
    padding: 4px 8px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 4px;
    display: none;
}

/* Date picker action buttons */
.date-picker-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    margin-top: 20px;
}

.date-picker-actions .btn {
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

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

.date-picker-actions .btn-secondary:hover {
    background: var(--bg-secondary);
}

.date-picker-actions .btn-primary {
    background: linear-gradient(135deg, var(--maya-blue), var(--jade-green));
    color: var(--raisin-black);
}

.date-picker-actions .btn-primary:hover {
    background: #5A1E8A;
}

/* Date picker actions positioned under right calendar */
.date-picker-actions {
    display: flex;
    gap: 8px;
}

/* Date picker main layout structure */
.date-picker-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.date-picker-main {
    display: flex;
    flex-grow: 1;
    overflow: hidden;
}

/* New date picker layout */
.calendars-row {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
}

.calendar-container {
    flex: 1;
    min-width: 280px;
}

/* Footer positioned at bottom of modal */
.date-picker-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-top: 1px solid #333;
    flex-shrink: 0;
    background: var(--bg-primary);
}

.selected-range {
    flex: 1;
    color: #d9d9d9;
    font-size: 14px;
    font-weight: normal;
}

.footer-buttons {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Apply button with brand color */
.footer-buttons .btn-primary {
    all: unset;
    box-sizing: border-box;
    background: linear-gradient(135deg, var(--maya-blue), var(--jade-green));
    color: var(--raisin-black);
    font-weight: 700;
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.footer-buttons .btn-primary:hover {
    background: linear-gradient(135deg, var(--jade-green), var(--maya-blue));
}

/* Cancel as text-only button */
.footer-buttons .btn-secondary {
    all: unset;
    box-sizing: border-box;
    color: #a0a0a0;
    font-weight: 700;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s ease;
}

.footer-buttons .btn-secondary:hover {
    color: #ffffff;
}

/* Fix preset options spacing to prevent text cutoff */
.preset-options {
    padding-bottom: 12px;
}

.preset-option {
    padding: 8px 12px;
    margin-bottom: 4px;
}

/* Calendar grid and day styling */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    margin-top: 8px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    border-radius: 4px;
    transition: all 0.2s ease;
    min-height: 36px;
}

.calendar-day:hover {
    background: rgba(255, 255, 255, 0.1);
}

.calendar-day.other-month {
    color: var(--text-secondary);
    cursor: default;
}

.calendar-day.selected-start,
.calendar-day.selected-end {
    background: var(--accent-purple);
    color: white;
}

.calendar-day.in-range {
    background: rgba(124, 58, 237, 0.3);
    color: white;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    margin-bottom: 8px;
}

.calendar-day-header {
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    padding: 8px 0;
}

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

.calendar-title {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 16px;
}

.calendar-nav {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.calendar-nav:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Main content area adjustments */
.date-picker-main {
    display: flex;
    flex: 1;
}

/* Improved sidebar spacing for better visual balance */
.preset-today {
    margin-bottom: 15px;
}

.preset-tabs-spaced {
    margin-top: 15px;
    margin-bottom: 15px;
}

.preset-options-spaced {
    margin-top: 15px;
}

.calendar-nav {
    background: none;
    border: none;
    color: var(--text-sub-color);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.calendar-nav:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.calendar-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-day-header {
    padding: 8px 4px;
    text-align: center;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-sub-color);
    text-transform: uppercase;
}

.calendar-day {
    padding: 8px 4px;
    text-align: center;
    font-size: 12px;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.calendar-day.other-month {
    color: var(--text-sub-color);
    opacity: 0.5;
}

.calendar-day.selected {
    background: var(--accent-purple);
    color: white;
}

.calendar-day.in-range {
    background: rgba(99, 102, 241, 0.2);
}

.calendar-day.today {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--accent-purple);
}

/* Light theme filters */
body.light-theme .cases-filters {
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .filter-select,
body.light-theme .date-range-input {
    background: white;
    border-color: #e2e8f0;
    color: var(--text-primary);
}

body.light-theme .filter-select:hover,
body.light-theme .date-range-input:hover {
    background: white;
    border-color: var(--accent-purple);
}

/* Light theme search section */
body.light-theme .search-section {
    background: white;
    border-color: #e2e8f0;
}

body.light-theme .search-section input {
    background: white;
    border-color: #e2e8f0;
    color: var(--text-primary);
}

body.light-theme .search-section input:focus {
    border-color: var(--purple-accent);
    box-shadow: 0 0 0 3px rgba(178, 216, 194, 0.1);
}

/* Light theme table headers */
body.light-theme .list-header {
    background: #f8fafc;
    color: var(--text-primary);
    border-bottom-color: #e2e8f0;
}

body.light-theme .table-header {
    background: #f8fafc;
    color: var(--text-primary);
    border-bottom-color: #e2e8f0;
}

/* Light theme dropdown menus */
body.light-theme .filter-dropdown-menu,
body.light-theme .dropdown-menu {
    background: white;
    border-color: #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body.light-theme .dropdown-option {
    color: var(--text-primary);
}

body.light-theme .dropdown-option:hover {
    background: #f8fafc;
}

/* Light theme top search bar */
body.light-theme .search-controls {
    background: white;
    border-color: #e2e8f0;
}

body.light-theme .search-controls input {
    background: white;
    border-color: #e2e8f0;
    color: var(--text-primary);
}

body.light-theme .search-controls button {
    background: white;
    border-color: #e2e8f0;
    color: var(--text-primary);
}

body.light-theme .search-controls button:hover {
    background: #f8fafc;
    border-color: var(--purple-accent);
}

/* Light theme date selector button */
body.light-theme .date-selector-btn,
body.light-theme .date-range-btn {
    background: white;
    border-color: #e2e8f0;
    color: var(--text-primary);
}

body.light-theme .date-selector-btn:hover,
body.light-theme .date-range-btn:hover {
    background: #f8fafc;
    border-color: var(--purple-accent);
}

/* Light theme cases header */
body.light-theme .cases-header {
    background: transparent;
}

body.light-theme .cases-title {
    color: var(--text-primary);
}

/* Light theme filter buttons */
body.light-theme .filter-btn {
    background: white;
    border-color: #e2e8f0;
    color: var(--text-primary);
}

body.light-theme .filter-btn:hover {
    background: #f8fafc;
    border-color: var(--purple-accent);
}

body.light-theme .filter-btn.active {
    background: var(--purple-accent);
    border-color: var(--purple-accent);
    color: white;
}

/* Light theme search input wrapper */
body.light-theme .search-input-wrapper {
    background: white;
    border-color: #e2e8f0;
}

body.light-theme .search-input-wrapper i {
    color: var(--text-sub-color);
}

body.light-theme .search-input {
    background: transparent;
    color: var(--text-primary);
}

body.light-theme .search-input:focus {
    border-color: var(--purple-accent);
}

/* Light theme search container */
body.light-theme .search-container {
    background: transparent;
}

body.light-theme .search-container .filter-select {
    background: white;
    border-color: #e2e8f0;
    color: var(--text-primary);
}

/* Light theme header actions */
body.light-theme .header-actions {
    background: transparent;
}

body.light-theme .view-selector-btn {
    background: white;
    border-color: #e2e8f0;
    color: var(--text-primary);
}

body.light-theme .view-selector-btn:hover {
    background: #f8fafc;
    border-color: var(--purple-accent);
}

body.light-theme .view-selector-menu {
    background: white;
    border-color: #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body.light-theme .view-option {
    color: var(--text-primary);
}

body.light-theme .view-option:hover {
    background: #f8fafc;
}

body.light-theme .view-option.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--purple-accent);
}

/* Light theme date picker and filter menus */
body.light-theme .filter-menu {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

body.light-theme .filter-option {
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    margin: 4px;
    transition: all 0.2s ease;
}

body.light-theme .filter-option:hover {
    background: #f1f5f9;
}

body.light-theme .filter-option.active {
    background: rgba(139, 92, 246, 0.1);
    color: var(--purple-accent);
    font-weight: 500;
}

/* Ensure date filter dropdown matches view selector dropdown exactly */
body.light-theme .filter-menu {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    padding: 4px;
}

body.light-theme .filter-option {
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    margin: 2px 0;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

body.light-theme .filter-option:hover {
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme .filter-option.active {
    background: rgba(139, 92, 246, 0.1);
    color: var(--purple-accent);
    font-weight: 500;
}

body.light-theme .date-picker-modal {
    background: white;
    border-color: #e2e8f0;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

body.light-theme .date-picker-content {
    background: white;
}

body.light-theme .date-picker-presets {
    background: #f8fafc;
    border-right-color: #e2e8f0;
}

body.light-theme .preset-header {
    color: var(--text-primary);
}

body.light-theme .preset-option {
    color: var(--text-primary);
}

body.light-theme .preset-option:hover {
    background: #e2e8f0;
}

body.light-theme .preset-option.active {
    background: var(--purple-accent);
    color: white;
}

body.light-theme .calendar-header {
    background: white;
    border-bottom-color: #e2e8f0;
}

body.light-theme .calendar-nav-btn {
    background: transparent;
    color: var(--text-primary);
}

body.light-theme .calendar-nav-btn:hover {
    background: #f8fafc;
}

body.light-theme .calendar-title {
    color: var(--text-primary);
}

body.light-theme .bottom-bar {
    background: white;
    border-top-color: #e2e8f0;
}

/* Light theme badge text contrast fixes */
body.light-theme .case-type-badge,
body.light-theme .case-stage-badge,
body.light-theme .status-badge,
body.light-theme .badge {
    color: #1f2937 !important;
    font-weight: 700;
}

body.light-theme .case-type-badge.type-estate,
body.light-theme .case-type-badge.type-family,
body.light-theme .case-type-badge.type-criminal,
body.light-theme .case-type-badge.type-corporate,
body.light-theme .case-type-badge.type-personal {
    background: rgba(99, 102, 241, 0.2);
    color: #4f46e5 !important;
}

body.light-theme .case-stage-badge.stage-active,
body.light-theme .case-stage-badge.stage-pending,
body.light-theme .case-stage-badge.stage-closed {
    background: rgba(75, 85, 99, 0.2);
    color: #374151 !important;
}

/* Enhanced New Case button styling for both themes */
.btn-primary {
    background: linear-gradient(135deg, #7655E9 0%, #A66DEB 100%) !important;
    border: none !important;
    color: #FFFFFF !important;
    font-weight: 700 !important;
    padding: 10px 20px !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 4px rgba(118, 85, 233, 0.2) !important;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #6848DF 0%, #985EDF 100%) !important;
    color: #FFFFFF !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 10px 24px rgba(118, 85, 233, 0.24) !important;
}

/* Light theme specific adjustments */
body.light-theme .btn-primary {
    background: linear-gradient(135deg, #7655E9 0%, #A66DEB 100%) !important;
    color: #FFFFFF !important;
    box-shadow: 0 2px 6px rgba(118, 85, 233, 0.24) !important;
}

body.light-theme .btn-primary:hover {
    background: linear-gradient(135deg, #6848DF 0%, #985EDF 100%) !important;
    color: #FFFFFF !important;
    box-shadow: 0 10px 24px rgba(118, 85, 233, 0.24) !important;
}

/* Voice Dictation Modal Styles */
#dictation-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

#dictation-modal.show {
    display: flex;
}

.dictation-header {
    text-align: center;
    margin-bottom: 2rem;
}

.dictation-header h2 {
    font-size: 2rem;
    font-weight: bold;
    color: white;
    margin-bottom: 0.5rem;
}

.dictation-header p {
    color: #d1d5db;
    font-size: 1rem;
}

#dictation-visualizer {
    width: 12rem;
    height: 12rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-bottom: 1.5rem;
    transition: box-shadow 0.1s ease-out;
    box-shadow: 0 0 0 0px rgba(20, 184, 166, 0);
}

#close-dictation-button {
    width: 3rem;
    height: 3rem;
    background: #dc2626;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

#dictation-visualizer-text {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    letter-spacing: 0.5px;
}

#close-dictation-button {
    transition: all 0.2s ease;
}

#close-dictation-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

/* Transcribing Spinner */
#transcribing-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Light theme voice modal */
body.light-theme #dictation-modal {
    background: rgba(0, 0, 0, 0.7);
}

body.light-theme #dictation-visualizer {
    background: linear-gradient(135deg, var(--purple-accent), #b2d8c2);
}

body.light-theme #close-dictation-button {
    background: #dc2626;
}

body.light-theme #close-dictation-button:hover {
    background: #b91c1c;
}

body.light-theme .filter-menu,
body.light-theme .date-picker-modal {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

body.light-theme .date-picker-presets {
    border-right-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .preset-tab {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .preset-tab:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Typing Indicator */
.typing-indicator {
    opacity: 0.8;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 8px 0;
}

/* Voice Loading Styles for Input Field */
.input-wrapper {
    position: relative;
}

.voice-loading-overlay {
    position: absolute;
    z-index: 10;
    pointer-events: none;
}

.voice-loading-gif-input {
    width: 36px;
    height: 36px;
    border-radius: 4px;
}

/* Button visibility controls */
.hidden {
    display: none !important;
}

/* Voice wave button styling */
.voice-wave-btn {
    background: linear-gradient(135deg, var(--maya-blue), var(--jade-green));
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.voice-wave-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(178, 216, 194, 0.3);
}

.voice-wave-btn.recording {
    background: linear-gradient(135deg, #ff4757, #ff6b7d);
    animation: pulse 1.5s infinite;
}

.voice-wave-btn i {
    font-size: 16px;
}

.voice-wave-icon {
    width: 24px;
    height: 24px;
    transition: all 0.2s ease;
}

/* Theme-responsive voice wave icon */
body:not(.light-theme) .voice-wave-icon {
    content: url('/static/images/sound-icon-dark.png');
}

body.light-theme .voice-wave-icon {
    content: url('/static/images/sound-icon-light.png');
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 71, 87, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 71, 87, 0);
    }
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-sub-color);
    animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing-bounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.message-input:focus {
    outline: none;
}

.message-input::placeholder {
    color: var(--text-sub-color);
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--maya-blue), var(--jade-green));
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(178, 216, 194, 0.3);
}

/* === Documents Page === */
.documents-container {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.documents-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 2rem;
}

.search-container {
    display: flex;
    flex: 1;
    gap: 1rem;
    align-items: center;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-sub-color);
    font-size: 0.9rem;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--purple-accent);
    box-shadow: 0 0 0 3px rgba(178, 216, 194, 0.1);
}

.filter-controls {
    display: flex;
    gap: 0.75rem;
}

.filter-select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.9rem;
    min-width: 120px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-select:focus {
    outline: none;
    border-color: var(--purple-accent);
    box-shadow: 0 0 0 3px rgba(178, 216, 194, 0.1);
}

.action-buttons {
    display: flex;
    gap: 0.75rem;
}

.btn-primary, .btn-secondary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--maya-blue), var(--jade-green));
    color: var(--raisin-black);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(178, 216, 194, 0.3);
}

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

.btn-secondary:hover {
    background: var(--hover-bg);
    border-color: var(--purple-accent);
}

.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.document-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.document-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: var(--purple-accent);
}

.document-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.document-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
}

.document-icon.contract {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.document-icon.legal-brief {
    background: linear-gradient(135deg, #b2d8c2, #6d28d9);
}

.document-icon.memo {
    background: linear-gradient(135deg, #10b981, #047857);
}

.document-icon.correspondence {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.document-icon.pleading {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.document-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.document-status.draft {
    background: rgba(107, 114, 128, 0.2);
    color: #9ca3af;
}

.document-status.review {
    background: rgba(251, 191, 36, 0.2);
    color: #f59e0b;
}

.document-status.final {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.document-status.archived {
    background: rgba(107, 114, 128, 0.2);
    color: #6b7280;
}

.document-content {
    margin-bottom: 1.5rem;
}

.document-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.document-description {
    color: var(--text-sub-color);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.document-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-sub-color);
}

.document-type {
    background: rgba(178, 216, 194, 0.1);
    color: var(--purple-accent);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.document-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    padding: 0.5rem;
    border: none;
    background: transparent;
    color: var(--text-sub-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background: var(--hover-bg);
    color: var(--purple-accent);
}

/* === Light Mode Support for Documents === */
body.light-theme .documents-container {
    background: var(--bg-color);
}

body.light-theme .top-nav {
    background: rgba(255, 255, 255, 0.9);
    border-bottom-color: #e2e8f0;
}

body.light-theme .nav-left h1 {
    color: var(--text-primary);
}

/* === Cases Page Styles === */
.cases-container {
    padding: 2rem;
    height: 100%;
    overflow-y: auto;
    background: var(--bg-primary);
}

.cases-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.cases-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Ensure list view displays properly */
.list-view .cases-table-container {
    display: block;
}

.case-card {
    background: rgba(45, 55, 72, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    text-decoration: none;
    color: var(--text-primary);
}

.case-card:hover {
    border-color: var(--purple-accent);
    box-shadow: 0 8px 32px rgba(178, 216, 194, 0.15);
    transform: translateY(-2px);
}

.case-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.case-title h3 {
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
    font-size: 1.2rem;
    font-weight: 700;
}

.case-number {
    color: var(--text-sub-color);
    font-size: 0.9rem;
    font-weight: 500;
}

.case-status {
    flex-shrink: 0;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-active {
    background: rgba(46, 213, 115, 0.2);
    color: #2ed573;
    border: 1px solid rgba(46, 213, 115, 0.3);
}

.status-pending {
    background: rgba(255, 165, 2, 0.2);
    color: #ffa502;
    border: 1px solid rgba(255, 165, 2, 0.3);
}

.status-closed {
    background: rgba(163, 163, 174, 0.2);
    color: var(--text-sub-color);
    border: 1px solid var(--border-color);
}

.case-details {
    margin-bottom: 1.5rem;
}

.case-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-sub-color);
    font-size: 0.9rem;
}

.meta-item i {
    color: var(--purple-accent);
    width: 16px;
}

.case-description {
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.case-progress {
    margin-bottom: 1rem;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.progress-info span:first-child {
    color: var(--text-primary);
    font-weight: 500;
}

.progress-info span:last-child {
    color: var(--purple-accent);
    font-weight: 700;
}

.progress-bar {
    height: 6px;
    background: rgba(163, 163, 174, 0.2);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--maya-blue), var(--jade-green));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.case-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* === New Case Modal === */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--form-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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

.modal-header h2 {
    color: var(--text-primary);
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-sub-color);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.modal-form {
    padding: 1.5rem;
}

.modal-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.modal-form .form-group {
    display: flex;
    flex-direction: column;
}

.modal-form .form-group:last-child {
    grid-column: 1 / -1;
}

.modal-form label {
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.modal-form input,
.modal-form select,
.modal-form textarea {
    background: rgba(45, 55, 72, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.modal-form input:focus,
.modal-form select:focus,
.modal-form textarea:focus {
    outline: none;
    border-color: var(--purple-accent);
    box-shadow: 0 0 0 3px rgba(178, 216, 194, 0.1);
}

.modal-form textarea {
    resize: vertical;
    font-family: inherit;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* === Light Mode Support for Cases === */
body.light-theme .cases-container {
    background: var(--bg-primary);
}

body.light-theme .case-card {
    background: rgba(255, 255, 255, 0.9);
    border-color: #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

body.light-theme .case-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: var(--purple-accent);
}

body.light-theme .case-title h3 {
    color: var(--text-primary);
}

body.light-theme .case-description {
    color: var(--text-primary);
}

body.light-theme .modal-content {
    background: white;
    border-color: #e2e8f0;
}

body.light-theme .modal-form input,
body.light-theme .modal-form select,
body.light-theme .modal-form textarea {
    background: white;
    border-color: #e2e8f0;
    color: var(--text-primary);
}

body.light-theme .modal-form input:focus,
body.light-theme .modal-form select:focus,
body.light-theme .modal-form textarea:focus {
    border-color: var(--purple-accent);
    box-shadow: 0 0 0 3px rgba(178, 216, 194, 0.1);
}

/* === Responsive Design for Cases === */
@media (max-width: 768px) {
    .cases-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .case-meta {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .modal-form .form-row {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
}

body.light-theme .search-input,
body.light-theme .filter-select {
    background: white;
    border-color: #e2e8f0;
    color: var(--text-primary);
}

/* === Toast Notification System === */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.toast {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1rem 1.4rem;
    border-radius: 10px;
    font-size: 0.95rem;
    line-height: 1.4;
    max-width: 320px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
    opacity: 1;
    animation: slideToast 0.6s ease-out both;
    overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .toast {
        animation: none;
    }
}

.toast i {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.toast-glow {
    position: absolute;
    inset: -20px;
    border-radius: 20px;
    background: radial-gradient(
        circle,
        rgba(178, 216, 194, 0.2),
        transparent 70%
    );
    pointer-events: none;
    filter: blur(16px);
    z-index: -1;
}

/* Toast Professional Theme */
.toast.professional {
    background: #2e2e2e;
    color: #eee;
}

.toast.success {
    background: #1e3a1e;
    color: #4ade80;
    border: 1px solid #4ade80;
}

.toast.success .toast-glow {
    background: radial-gradient(
        circle,
        rgba(74, 222, 128, 0.2),
        transparent 70%
    );
}

.toast.error {
    background: #3a1e1e;
    color: #ef4444;
    border: 1px solid #ef4444;
}

.toast.error .toast-glow {
    background: radial-gradient(
        circle,
        rgba(239, 68, 68, 0.2),
        transparent 70%
    );
}

.toast.info {
    background: #1e2a3a;
    color: #3b82f6;
    border: 1px solid #3b82f6;
}

.toast.info .toast-glow {
    background: radial-gradient(
        circle,
        rgba(59, 130, 246, 0.2),
        transparent 70%
    );
}

/* Light Theme Toast Styles */
body.light-theme .toast.professional {
    background: #f8f9fa;
    color: #2d3748;
    border: 1px solid #e2e8f0;
}

body.light-theme .toast.success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #22c55e;
}

body.light-theme .toast.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

body.light-theme .toast.info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #3b82f6;
}

/* Toast Animation */
@keyframes slideToast {
    0% {
        opacity: 0;
        transform: translateY(40px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Toast Styles */
@media (max-width: 768px) {
    #toast-container {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
    }
    
    .toast {
        max-width: none;
        width: 100%;
    }
}

body.light-theme .search-input:focus,
body.light-theme .filter-select:focus {
    border-color: var(--purple-accent);
    box-shadow: 0 0 0 3px rgba(178, 216, 194, 0.1);
}

body.light-theme .btn-secondary {
    background: white;
    border-color: #e2e8f0;
    color: var(--text-primary);
}

body.light-theme .btn-secondary:hover {
    background: #f8fafc;
    border-color: var(--purple-accent);
}

body.light-theme .document-card {
    background: white;
    border-color: #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

body.light-theme .document-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: var(--purple-accent);
}

body.light-theme .document-title {
    color: var(--text-primary);
}

body.light-theme .document-description {
    color: var(--text-sub-color);
}

body.light-theme .document-meta {
    color: var(--text-sub-color);
}

body.light-theme .action-btn {
    color: var(--text-sub-color);
}

body.light-theme .action-btn:hover {
    background: #f1f5f9;
    color: var(--purple-accent);
}

/* === Mobile Navigation and Dashboard Responsive Design === */

/* Mobile Navigation Overlay */
.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-nav-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: background-color 0.2s ease;
}

.mobile-menu-btn:hover {
    background: var(--bg-hover);
}

/* Mobile Agent Selector */
.mobile-agent-selector {
    display: none;
    position: relative;
    margin-left: 1rem;
}

.mobile-agent-selector-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 140px;
}

.mobile-agent-selector-trigger:hover {
    background: var(--bg-tertiary);
}

.mobile-selected-agent {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.mobile-agent-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
}

.mobile-selected-agent-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-agent-selector-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    margin-top: 0.5rem;
    max-width: 280px;
}

.mobile-agent-selector-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mobile-agent-options {
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
}

.mobile-agent-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.mobile-agent-option:hover {
    background: var(--bg-hover);
}

.mobile-agent-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    flex: 1;
}

.mobile-agent-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.mobile-agent-description {
    font-size: 0.75rem;
    color: var(--text-sub-color);
}

/* Desktop Title - Hide on Mobile */
.desktop-title {
    display: block;
}

/* Desktop Only Elements */
.desktop-only {
    display: block;
}

/* Mobile Responsive Breakpoints */
@media (max-width: 768px) {
    .dashboard-layout {
        display: block;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
        background: var(--sidebar-bg);
        border-right: 1px solid var(--sidebar-border);
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .main-content {
        width: 100%;
        margin-left: 0;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }
    
    .top-nav {
        position: sticky;
        top: 0;
        z-index: 100;
        background: var(--bg-primary);
        border-bottom: 1px solid var(--border-color);
        backdrop-filter: blur(10px);
    }
    
    .nav-left {
        display: flex;
        align-items: center;
        gap: 0;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .mobile-agent-selector {
        display: block;
    }
    
    .desktop-title {
        display: none;
    }
    
    .desktop-only {
        display: none !important;
    }
    
    /* Chat Container Mobile Layout */
    .chat-container {
        display: flex;
        flex-direction: column;
        height: calc(100vh - 70px);
        overflow: hidden;
    }
    
    .chat-sidebar {
        display: none;
    }
    
    .chat-main {
        display: flex;
        flex-direction: column;
        height: 100%;
        flex: 1;
    }
    
    .chat-header-main {
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
        background: var(--bg-primary);
    }
    
    .chat-messages {
        flex: 1;
        overflow-y: auto;
        padding: 1rem;
        padding-bottom: 120px; /* Space for fixed input */
    }
    
    /* Fixed Chat Input for Mobile */
    .chat-input-container {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-primary);
        border-top: 1px solid var(--border-color);
        padding: 1rem;
        backdrop-filter: blur(10px);
        z-index: 50;
    }
    
    .chat-input {
        max-width: 100%;
        margin: 0;
    }
    
    .input-wrapper {
        margin-bottom: 0.75rem;
    }
    
    .message-input {
        min-height: 44px;
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 0.75rem;
    }
    
    .input-controls-bottom {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .input-controls-left {
        flex: 1;
        min-width: 0;
    }
    
    .input-controls-right {
        gap: 0.5rem;
    }
    
    .input-btn {
        min-width: 44px;
        height: 44px;
    }
    
    .chat-disclaimer {
        font-size: 0.75rem;
        text-align: center;
        margin-top: 0.5rem;
        padding: 0.5rem;
    }
    
    /* Profile Dropdown Mobile */
    .profile-dropdown {
        position: relative;
    }
    
    .profile-menu {
        position: absolute;
        right: 0;
        top: 100%;
        min-width: 200px;
        max-width: 90vw;
    }
    
    /* Agent Selector in Chat - Desktop Only */
    .agent-selector-dropdown {
        display: none;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 100vw;
        left: -100vw;
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .mobile-agent-selector-trigger {
        min-width: 100px;
        padding: 0.4rem 0.6rem;
    }
    
    .mobile-selected-agent-title {
        font-size: 0.8rem;
    }
    
    .chat-input-container {
        padding: 0.75rem;
    }
    
    .input-controls-bottom {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .input-controls-left,
    .input-controls-right {
        justify-content: center;
    }
    
    .message-input {
        font-size: 16px;
        padding: 0.875rem;
    }
}

/* Smooth transitions for mobile navigation */
@media (prefers-reduced-motion: no-preference) {
    .sidebar,
    .mobile-nav-overlay,
    .mobile-agent-selector-menu {
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
}

/* === Tab Navigation Styles === */
.tab-navigation {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 2rem;
    gap: 0.5rem;
}

.tab-btn {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

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

.tab-btn.active {
    color: var(--accent-purple);
    background: var(--card-bg);
    border-bottom: 2px solid var(--accent-purple);
    margin-bottom: -2px;
}

.tab-btn i {
    font-size: 0.9rem;
}

/* === Tab Content Styles === */
.tab-content {
    width: 100%;
}

.tab-panel {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* === Chat History Styles === */
.chat-history-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    border: 1px solid var(--border-color);
}

.chat-history-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.chat-history-header h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-history-header h3 i {
    color: var(--accent-purple);
    font-size: 1.25rem;
}

.chat-history-subtitle {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.95rem;
}

.chat-history-content {
    max-height: 600px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Chat Message Styles */
.chat-message {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.25rem;
    border-radius: 12px;
    border:none;
    background: none;
}

.chat-message.user {
    background: var(--bg-tertiary);
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
    color: white;
}

.chat-message.user .message-avatar {
    background: var(--accent-purple);
}

.chat-message.ai .message-avatar {
    background: var(--accent-blue);
}

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

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    gap: 1rem;
}

.message-sender {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.message-timestamp {
    color: var(--text-secondary);
    font-size: 0.85rem;
    white-space: nowrap;
}

.message-text {
    color: var(--text-primary);
    line-height: 1.6;
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    color: var(--accent-purple);
    margin-bottom: 1rem;
    opacity: 0.7;
}

.empty-state h4 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

.empty-state p {
    margin: 0;
    font-size: 0.95rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .tab-btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .chat-history-container {
        padding: 1.5rem;
    }
    
    .chat-message {
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .message-avatar {
        width: 36px;
        height: 36px;
        font-size: 0.8rem;
    }
    
    .message-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
}


/* === AI Title Status Indicators === */
.title-status {
    font-size: 12px;
    margin-left: 5px;
    display: inline-block;
}

.title-status.generating {
    animation: spin 1s linear infinite;
    color: #3b82f6;
}

.title-status.failed {
    color: #ef4444;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== Chat Menu Hover Effects and Fly-out Menu ===== */

/* Chat item hover effect - show ellipsis, hide timestamp */
.chat-item:hover .chat-timestamp {
    display: none !important;
}

.chat-item:hover .chat-ellipsis {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

/* Ellipsis button styling */
.chat-ellipsis {
    position: relative;
}

.ellipsis-btn {
    background: none;
    border: none;
    color: white; /* White dots in dark mode */
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ellipsis-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Global actions menu - positioned by JavaScript */
.global-actions-menu {
    position: fixed;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    min-width: 180px;
    padding: 4px 0;
    display: none;
}

/* Show the menu when visible class is added */
.global-actions-menu.is-visible {
    display: block;
}

/* Chat fly-out menu - keeping for backwards compatibility */
.chat-menu {
    position: absolute;
    top: 54%;
    right: -9px; /* Move menu outside sidebar */
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    min-width: 140px;
    padding: 4px 0;
    margin-top: 4px;
    display: none; /* Hidden by default */
}

.chat-menu.visible {
    display: block; /* Show when visible class is added */
}

/* Menu items */
.chat-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 13px;
    color: var(--text-primary);
}

.chat-menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chat-menu-item i {
    width: 14px;
    text-align: center;
    flex-shrink: 0;
    color: white; /* White icons for share/rename */
}

/* Menu divider */
.menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 4px 0;
}

/* Delete item special styling */
.chat-menu-item.delete-item {
    color: #ef4444;
}

.chat-menu-item.delete-item:hover {
    background: rgba(239, 68, 68, 0.1);
}

.chat-menu-item.delete-item i {
    color: #ef4444;
}

/* Light theme adjustments */
body.light-theme .chat-menu,
body.light-theme .global-actions-menu {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Styles for inline title editing */
.chat-title-edit {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    padding: 4px 8px;
    font-size: 14px;
    width: 100%;
    max-width: 180px;
    font-family: inherit;
}

.chat-title-edit:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Case Information Display Styles */
.case-info-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 16px;
    min-width: 180px;
}

.case-info-display:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

.case-info-display.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.case-info-content {
    flex: 1;
}

.case-info-content .case-name {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 2px;
}

.case-info-content .case-type {
    font-size: 12px;
    opacity: 0.8;
    line-height: 1.2;
}

.case-info-chevron {
    font-size: 12px;
    transition: transform 0.2s ease;
    opacity: 0.7;
}

.case-info-display.active .case-info-chevron {
    transform: rotate(180deg);
}

/* Case Information Dropdown */
.case-info-dropdown {
    position: absolute;
    top: 100%;
    right: 280px; /* Adjust based on theme switcher and profile dropdown width */
    width: 320px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    margin-top: 8px;
}

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

.case-dropdown-header {
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border-color);
}

.case-dropdown-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.case-dropdown-content {
    padding: 16px 20px;
}

.case-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.case-detail-row:last-child {
    margin-bottom: 0;
}

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

.detail-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
}

/* Priority and Status Badges */
.priority-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.priority-badge.low {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.priority-badge.medium {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
}

.priority-badge.high {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.priority-badge.urgent {
    background: rgba(147, 51, 234, 0.1);
    color: #9333ea;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.status-badge.active {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.status-badge.completed {
    background: rgba(99, 102, 241, 0.1);
    color: #72c9ff;
}

.status-badge.on_hold {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
}

.status-badge.cancelled {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
}

.case-dropdown-actions {
    padding: 12px 20px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
}

.action-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.action-btn.primary {
    background: var(--accent-primary);
    color: white;
}

.action-btn.primary:hover {
    background: var(--accent-hover);
}

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

.action-btn.secondary:hover {
    background: var(--bg-hover);
}

/* Light theme adjustments for case info */
body.light-theme .case-info-dropdown {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Light theme ellipsis button - black dots */
body.light-theme .ellipsis-btn {
    color: black !important;
}

body.light-theme .ellipsis-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

body.light-theme .chat-menu-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme .chat-menu-item.delete-item:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Active chat item styling (current conversation) */
.chat-item.active {
    border-left: 3px solid #b2d8c2; /* Brand purple */
    background-color: rgba(255, 255, 255, 0.05);
}



/* Light theme active styling */
body.light-theme .chat-item.active {
    background: rgba(178, 216, 194, 0.03);
    border-left-color: #b2d8c2;
}

/* Custom Delete Confirmation Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: #1A202C;
    padding: 2rem;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-content h3 {
    color: #ffffff;
    font-size: 1.75rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.modal-content h3 i {
    font-size: 1.1rem;
}

.modal-content p {
    color: #a3a3ae;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-danger {
    background: #ff4757;
    color: white;
    border: 1px solid #ff4757;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-danger:hover {
    background: #ff3838;
    border-color: #ff3838;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.3);
}

/* Light theme overrides for modal */
body.light-theme .modal-content {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .modal-content h3 {
    color: #dc2626;
}

body.light-theme .modal-content p {
    color: #64748b;
}

body.light-theme .btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border-color: #e2e8f0;
}

body.light-theme .btn-secondary:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}
/* Remove this duplicate - replaced above with active styling */

/* New Slide-Out Panel Styles */
.slide-out-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    height: 100vh;
    background: var(--sidebar-bg, #1a1a2e);
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.slide-out-panel.is-open {
    transform: translateX(0);
}

.panel-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-header h3 {
    color: var(--text-primary);
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.panel-close-btn {
    background: none;
    border: none;
    color: var(--text-sub-color);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.panel-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.panel-content-wrapper {
    box-sizing: border-box;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
}

.empty-panel-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-sub-color);
    text-align: center;
}

.empty-panel-message i {
    font-size: 2rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-panel-message p {
    margin: 0;
    font-size: 0.9rem;
}

/* Animated Hamburger Menu Button */
.hamburger-menu-btn {
    position: relative;
    background: transparent;
    border: none;
    cursor: pointer;
    width: 42px;
    height: 42px;
    padding: 0;
    margin: 0;
    margin-right: 1rem;
    border-radius: 8px;
    transition: background 0.2s ease;
}



.hamburger-menu-btn span {
    display: block;
    height: 2px;
    transition: all 0.15s ease-in-out;
    position: absolute;
    transform: rotate(0deg);
    left: 8px;
}

/* Light & Dark mode colors for the lines */
body:not(.light-theme) .hamburger-menu-btn span { 
    background: white; 
}

body.light-theme .hamburger-menu-btn span { 
    background: black; 
}

/* Default (Hamburger) state */
.hamburger-menu-btn span:first-child {
    width: 24px;
    top: 18px;
}

.hamburger-menu-btn span:last-child {
    width: 18px;
    top: 27px;
}

/* Active (X) state */
.hamburger-menu-btn[aria-expanded="true"] span {
    top: 23px;
    width: 25px;
}

.hamburger-menu-btn[aria-expanded="true"] span:first-child {
    transform: rotate(45deg);
}

.hamburger-menu-btn[aria-expanded="true"] span:last-child {
    transform: rotate(-45deg);
}

/* Updated Chat Header Layout - Proper Flexbox Implementation */
.chat-header-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    z-index: 20;
    height: 76px;
    box-sizing: border-box;
}

/* Left Group Container - Hamburger + Agent Selector */
.header-group-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Right Group Container - Case Selector + Other Elements */
.header-group-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.case-selector-header {
    margin-left: auto;
    margin-right: 1rem; /* Add space from right edge */
}

/* Fix case selector height to match agent selector */
.case-selector-header .case-selector-dropdown {
    height: 52px; /* Match agent selector height */
}

.case-selector-header .case-selector-trigger {
    height: 100%;
    display: flex;
    align-items: center;
}

/* Panel chat list styling */
.panel-content .chat-list {
    padding: 0;
    margin: 0;
}

.panel-content .new-conversation-btn {
    margin: auto;
    width: 60%;
}

/* Light theme panel styles */
body.light-theme .slide-out-panel {
    background: #ffffff;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.15);
}

body.light-theme .panel-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-theme .panel-close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* ===== ANIMATED DROPDOWN HISTORY PANEL ===== */
.history-dropdown-panel {
    position: absolute;
    top: 80px; /* Below header */
    left: 20px; /* Aligned with left side */
    width: 380px;
    height: calc(100vh - 120px); /* Full height minus header and padding */
    max-height: 800px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    
    /* Flex container for proper layout */
    display: flex;
    flex-direction: column;
    
    /* Hidden state */
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
    transform-origin: top left;
    pointer-events: none;
    
    /* Smooth animation */
    transition: all 0.2s ease-in-out;
}

/* When panel is open - Updated to use .is-open class */
.history-dropdown-panel.is-open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

/* Icon swap for hamburger button */
.chat-container.history-panel-open .hamburger-menu-btn .fa-bars {
    display: none;
}

.chat-container.history-panel-open .hamburger-menu-btn .fa-times {
    display: block !important;
}

/* ===== NEW CONVERSATION BUTTON ===== */
.new-conversation-btn {
    position: sticky;
    bottom: 45px;
    width: 60%;
    height: 50px;
    background: rgba(178, 216, 194, 0.15);
    border: 1px solid rgba(178, 216, 194, 0.3);
    color: white;
    border-radius: 12px;
    padding: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    backdrop-filter: blur(6px);
    cursor: pointer;
    box-shadow: 0px 0px 25px 9px #00000073 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin: 12px auto 16px auto;
    z-index: 10;
}

.new-conversation-btn:hover {
    background: rgba(178, 216, 194, 0.25);
    border-color: rgba(178, 216, 194, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(178, 216, 194, 0.2);
}

/* ===== CASE DETAILS PAGE REDESIGN STYLES ===== */

/* Custom Case Details Variables - extending existing brand colors */
:root {
    --neon-teal: #64f0d4;
    --case-card-bg: rgba(17, 19, 26, 0.8);
    --case-card-border: #2A2D35;
    --case-card-hover-border: #4A4D55;
    --case-text-primary: #e2e8f0;
    --case-text-secondary: #94a3b8;
    --case-text-muted: #64748b;
}

/* Custom scrollbar for case details */
.case-details-container ::-webkit-scrollbar {
    width: 8px;
}
.case-details-container ::-webkit-scrollbar-track {
    background: #1e293b;
}
.case-details-container ::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}
.case-details-container ::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Case Details Layout - Harmonious with Dashboard */
.case-details-wrapper {
    flex: 1;
    height: 100%;
    overflow-y: auto;
    background: linear-gradient(135deg, 
        rgba(26, 32, 44, 1) 0%, 
        rgba(45, 55, 72, 0.95) 25%, 
        rgba(26, 32, 44, 0.98) 50%, 
        rgba(45, 55, 72, 0.95) 75%, 
        rgba(26, 32, 44, 1) 100%);
}

.case-details-inner {
    height: 100vh;
    margin: 0 auto;
    padding: 2rem;
    background: rgba(30, 41, 59, 0.4);
    margin: 1.5rem;
    border-radius: 16px;
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.4),
        0 10px 10px -5px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.case-main-content {
    color: var(--case-text-secondary);
    font-family: 'Inter', sans-serif;
    padding: 1.5rem;
    height: calc(100vh - 160px); /* Adjust for top nav and padding */
    display: flex;
    flex-direction: column;
}

/* Card components for case details */
.case-card {
    background-color: var(--case-card-bg);
    border: 1px solid var(--case-card-border);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: border-color 0.3s ease;
}
.case-card:hover {
    border-color: var(--case-card-hover-border);
}

.case-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--case-card-border);
}

.case-card-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--case-text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.case-edit-button {
    background: none;
    border: none;
    color: var(--case-text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s ease-in-out;
}
.case-edit-button:hover {
    color: var(--case-text-primary);
    background-color: var(--case-card-border);
}

.case-subtle-gradient-text {
    background: linear-gradient(180deg, #FFFFFF, var(--case-text-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.case-primary-button {
    background-image: linear-gradient(to right, #6d28d9, #4f46e5);
    color: white;
    font-weight: 700;
    padding: 10px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(109, 40, 217, 0.3);
    border: none;
    text-decoration: none;
}
.case-primary-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(109, 40, 217, 0.5);
    color: white;
    text-decoration: none;
}

.case-secondary-button {
    background: transparent;
    color: #94a3b8;
    font-weight: 700;
    padding: 10px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    border: 1px solid #475569;
    text-decoration: none;
}
.case-secondary-button:hover {
    background: rgba(178, 216, 194, 0.1);
    border-color: #6d28d9;
    color: #b2d8c2;
    text-decoration: none;
    transform: translateY(-1px);
}

/* Case Hub navigation buttons */
.hub-nav-button {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--case-text-secondary);
    border: 1px solid transparent;
    background: none;
}
.hub-nav-button.active {
    background-color: #6d28d9;
    color: white;
    box-shadow: 0 2px 10px rgba(109, 40, 217, 0.4);
}

.hub-content-wrapper {
    border-radius: 10px;
    transition: background-image 0.5s ease;
}
.bg-gradient-purple { background-image: linear-gradient(145deg, rgba(139, 92, 246, 0.3), rgba(124, 58, 237, 0.2)); }
.bg-gradient-blue { background-image: linear-gradient(145deg, rgba(59, 130, 246, 0.3), rgba(37, 99, 235, 0.2)); }
.bg-gradient-teal { background-image: linear-gradient(145deg, rgba(20, 184, 166, 0.3), rgba(13, 148, 136, 0.2)); }
.bg-gradient-green { background-image: linear-gradient(145deg, rgba(6, 78, 59, 0.4), rgba(5, 150, 105, 0.3)); }

/* Hub Views */
.hub-view {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 24px;
    border-radius: 10px;
}

.hub-view.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

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

/* Background gradients from working example */
.bg-gradient-gold { 
    background-image: linear-gradient(145deg, rgba(202, 138, 4, 0.3), rgba(245, 158, 11, 0.2)); 
}
.bg-gradient-blue { 
    background-image: linear-gradient(145deg, rgba(59, 130, 246, 0.3), rgba(37, 99, 235, 0.2)); 
}

/* Hub Navigation Button Styles */
.hub-nav-button {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #94a3b8;
    border: 1px solid transparent;
}

.hub-nav-button.active {
    background-color: #6d28d9;
    color: white;
    box-shadow: 0 2px 10px rgba(109, 40, 217, 0.4);
    border: 1px solid #b2d8c2;
}

/* File Upload Dropzone Styles */
.dropzone-container {
    width: 100%;
}

.file-dropzone {
    width: 100%;
    height: 150px;
    border: 2px dashed #6d28d9;
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(109, 40, 217, 0.05), rgba(139, 92, 246, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.file-dropzone:hover {
    border-color: #b2d8c2;
    background: linear-gradient(145deg, rgba(109, 40, 217, 0.1), rgba(139, 92, 246, 0.15));
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(109, 40, 217, 0.2);
}

.file-dropzone.dragover {
    border-color: #c084fc;
    background: linear-gradient(145deg, rgba(139, 92, 246, 0.2), rgba(196, 132, 252, 0.25));
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.4);
}

.dropzone-content {
    text-align: center;
    z-index: 2;
    position: relative;
}

.file-dropzone::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.6s ease;
}

.file-dropzone:hover::before {
    left: 100%;
}

/* Main Tab Content Styles */
.main-tab-content {
    display: none;
}

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

/* Documents Tab Styles */
.documents-container {
    padding: 0;
}

.folder-item {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(71, 85, 105, 0.3);
    border-radius: 8px;
    padding: 16px;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.folder-item:hover {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(139, 92, 246, 0.5);
    transform: translateY(-1px);
}

.folder-icon {
    margin-bottom: 8px;
}

.folder-name {
    color: #f1f5f9;
    font-weight: 700;
    font-size: 0.875rem;
    margin-bottom: 4px;
}

.folder-meta {
    color: #94a3b8;
    font-size: 0.75rem;
}

.folder-menu {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px;
    border-radius: 4px;
    color: #94a3b8;
    transition: all 0.2s ease;
}

.folder-menu:hover {
    background: rgba(71, 85, 105, 0.5);
    color: #f1f5f9;
}

.file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Compact Folder Styles */
.folder-item-compact {
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 6px;
    padding: 8px 12px;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
}

.folder-item-compact:hover {
    background: rgba(148, 163, 184, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
}

.folder-details-compact {
    flex: 1;
    min-width: 0;
}

.folder-name-compact {
    color: #f1f5f9;
    font-weight: 500;
    font-size: 0.75rem;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-meta-compact {
    color: #94a3b8;
    font-size: 0.6875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-menu-compact {
    padding: 2px;
    border-radius: 4px;
    color: #94a3b8;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.folder-menu-compact:hover {
    background: rgba(71, 85, 105, 0.5);
    color: #f1f5f9;
}

/* Vault Breadcrumb Navigation */
.vault-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 0.875rem;
}

.breadcrumb-segment {
    color: #94a3b8;
    background: none;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
}

.breadcrumb-segment:hover {
    color: #f1f5f9;
    background: rgba(139, 92, 246, 0.15);
}

.breadcrumb-separator {
    color: #64748b;
    font-weight: 400;
    user-select: none;
}

.breadcrumb-current {
    color: #f1f5f9;
    font-weight: 500;
    font-size: 0.875rem;
}

/* Mobile Responsive Styles for Case Details */
@media (max-width: 768px) {
    .case-details-mobile {
        display: block !important;
    }
    
    .case-details-desktop {
        display: none !important;
    }
    
    .case-mobile-header {
        padding: 16px;
        background: var(--bg-primary);
    }
    
    .case-mobile-tabs {
        display: flex;
        border-bottom: 1px solid rgba(71, 85, 105, 0.3);
        margin-bottom: 0;
        padding: 0 16px;
    }
    
    .case-mobile-tab {
        padding: 12px 0;
        margin-right: 32px;
        color: #94a3b8;
        font-weight: 500;
        border-bottom: 2px solid transparent;
        text-decoration: none;
        font-size: 0.875rem;
    }
    
    .case-mobile-tab.active {
        color: #b2d8c2;
        border-bottom-color: #b2d8c2;
    }
    
    .case-mobile-title {
        font-size: 1.5rem;
        font-weight: 700;
        color: #f1f5f9;
        margin-bottom: 4px;
    }
    
    .case-mobile-meta {
        color: #94a3b8;
        font-size: 0.875rem;
        margin-bottom: 16px;
    }
    
    .case-mobile-status-row {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 16px;
    }
    
    .case-mobile-content {
        padding: 16px;
    }
    
    .case-info-card {
        background: rgba(30, 41, 59, 0.4);
        border: 1px solid rgba(71, 85, 105, 0.3);
        border-radius: 12px;
        padding: 20px;
        margin-bottom: 20px;
    }
    
    .case-info-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 16px;
    }
    
    .case-info-title {
        display: flex;
        align-items: center;
        gap: 8px;
        color: #f1f5f9;
        font-weight: 700;
        font-size: 1rem;
    }
    
    .case-info-edit {
        color: #94a3b8;
        padding: 4px;
    }
    
    .case-info-grid {
        display: grid;
        gap: 16px;
    }
    
    .case-info-item {
        
    }
    
    .case-info-label {
        color: #94a3b8;
        font-size: 0.875rem;
        margin-bottom: 4px;
    }
    
    .case-info-value {
        color: #f1f5f9;
        font-weight: 700;
        font-size: 1rem;
    }
    
    .case-info-description {
        color: #cbd5e1;
        font-size: 0.875rem;
        line-height: 1.5;
    }
    
    .recent-docs-card {
        background: rgba(30, 41, 59, 0.4);
        border: 1px solid rgba(71, 85, 105, 0.3);
        border-radius: 12px;
        padding: 20px;
    }
    
    .recent-docs-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 16px;
    }
    
    .recent-docs-title {
        display: flex;
        align-items: center;
        gap: 8px;
        color: #f1f5f9;
        font-weight: 700;
        font-size: 1rem;
    }
    
    .recent-docs-upload {
        color: #94a3b8;
        padding: 4px;
    }
    
    .doc-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 0;
        border-bottom: 1px solid rgba(71, 85, 105, 0.2);
    }
    
    .doc-item:last-child {
        border-bottom: none;
    }
    
    .doc-icon {
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 6px;
        flex-shrink: 0;
    }
    
    .doc-icon.pdf {
        background: rgba(239, 68, 68, 0.2);
        color: #ef4444;
    }
    
    .doc-icon.doc {
        background: rgba(59, 130, 246, 0.2);
        color: #3b82f6;
    }
    
    .doc-details {
        flex: 1;
        min-width: 0;
    }
    
    .doc-name {
        color: #f1f5f9;
        font-weight: 500;
        font-size: 0.875rem;
        margin-bottom: 2px;
    }
    
    .doc-meta {
        color: #94a3b8;
        font-size: 0.75rem;
    }
    
    .doc-status {
        padding: 4px 8px;
        border-radius: 12px;
        font-size: 0.6875rem;
        font-weight: 500;
        flex-shrink: 0;
    }
    
    .doc-status.analyzing {
        background: rgba(245, 158, 11, 0.2);
        color: #f59e0b;
    }
    
    .doc-status.processed {
        background: rgba(34, 197, 94, 0.2);
        color: #22c55e;
    }
}

@media (min-width: 769px) {
    .case-details-mobile {
        display: none !important;
    }
    
    .case-details-desktop {
        display: block !important;
    }
}

.hub-view {
    display: none;
    padding: 24px;
}
.hub-view.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

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

/* Case main tab navigation */
.case-main-tab {
    padding: 8px 4px;
    font-weight: 700;
    color: var(--case-text-muted);
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    text-decoration: none;
}
.case-main-tab:hover {
    color: var(--case-text-primary);
    text-decoration: none;
}
.case-main-tab.active {
    color: #c084fc;
    border-bottom-color: #c084fc;
}

/* Sonar animation for timeline */
.sonar-emitter::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #38bdf8;
    z-index: -1;
    animation: sonar-effect 1.5s ease-out infinite;
}
@keyframes sonar-effect {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }
    100% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0;
    }
}

/* Task list styling */
.task-row {
    cursor: pointer;
}
.task-row input[type="checkbox"]:checked ~ .custom-checkbox {
    background-color: #b2d8c2;
    border-color: #b2d8c2;
}
.task-row input[type="checkbox"]:checked ~ .custom-checkbox svg {
    display: block;
}
.task-row input[type="checkbox"]:checked ~ .task-text {
    text-decoration: line-through;
    color: var(--case-text-muted);
}

.processing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.05);
}

/* Branded DNA Loader Styles */
.ai-loader {
    width: 32px;
    height: 16px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}
.background-glow {
    position: absolute;
    width: 32px; 
    height: 32px;
    background: radial-gradient(circle, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 70%);
    filter: blur(8px);
    animation: pulse-glow 1.5s ease-in-out infinite alternate;
}
@keyframes pulse-glow {
    from { opacity: 0.7; transform: scale(0.8); }
    to { opacity: 1.0; transform: scale(1.0); }
}
.nodes-container {
    position: relative;
    width: 100%;
    height: 100%;
}
.node {
    position: absolute;
    top: 50%;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    transform-origin: center;
    animation-name: dna-rotate;
    animation-duration: 1.2s; 
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}
@keyframes dna-rotate {
    0% { transform: translate(-50%, -50%) translateY(0px) scale(1); z-index: 10; }
    25% { transform: translate(-50%, -50%) translateY(5px) scale(0.6); }
    50% { transform: translate(-50%, -50%) translateY(0px) scale(0.4); z-index: 1; }
    75% { transform: translate(-50%, -50%) translateY(-5px) scale(0.6); }
    100% { transform: translate(-50%, -50%) translateY(0px) scale(1); z-index: 10; }
}

/* Atom Icon Animation */
.atom {
    position: relative;
    display: flex;
    width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
}
.atom::before {
    content: "";
    position: absolute;
    width: 3px;
    height: 3px;
    background: transparent;
    box-shadow: inset 0 0 10px #fff;
    border-radius: 50%;
}
.atom .line {
    width: 100%;
    height: 100%;
    position: absolute;
    opacity: 0.7;
}
.line-1 {
    --color: #64f0d4;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border-bottom: 3px solid var(--color);
    border-top: 3px solid var(--color);
    animation: line1 2s linear infinite;
    filter:drop-shadow( 0 0 10px var(--color));
}
@keyframes line1 {
    0% { transform: rotateY(70deg) rotateZ(0deg); }
    100% { transform: rotateY(70deg) rotateZ(360deg); }
}
.line-2 {
    --color: #b2d8c2;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border-right: 3px solid var(--color);
    border-left: 3px solid var(--color);
    animation: line2 3s linear infinite;
    filter:drop-shadow( 0 0 10px var(--color));
}
@keyframes line2 {
    0% { transform: rotateX(80deg) rotateY(25deg) rotateZ(0deg); }
    100% { transform: rotateX(80deg) rotateY(25deg) rotateZ(360deg); }
}
.line-3 {
    --color: #00bfff;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border-right: 3px solid var(--color);
    border-left: 3px solid var(--color);
    animation: line3 3s linear infinite;
    filter:drop-shadow( 0 0 10px var(--color));
}
@keyframes line3 {
    0% { transform: rotateX(-80deg) rotateY(25deg) rotateZ(0deg); }
    100% { transform: rotateX(-80deg) rotateY(25deg) rotateZ(360deg); }
}

/* Document status badges */
.doc-status-analyzing {
    background: rgba(234, 179, 8, 0.1);
    color: #facc15;
    border: 1px solid rgba(234, 179, 8, 0.2);
    padding: 4px 8px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}
.doc-status-processed {
    background: rgba(34, 197, 94, 0.1);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.2);
    padding: 4px 8px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}
.doc-status-failed {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 4px 8px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Legal Scales Animation for Chat Messages */
.typing-indicator .container {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
}

.scales {
    position: relative;
    width: 50px;
    height: 65px;
    transform: scale(0.4);
}

.scales .base {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background-color: var(--scales-color, #ffffff);
    border-radius: 2px 2px 0 0;
}

.scales .stand {
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 51px;
    background-color: var(--scales-color, #ffffff);
}

.scales .stand::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    background-color: var(--scales-color, #ffffff);
    border-radius: 50%;
}

.scales .stand::after {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 5px;
    background-color: var(--scales-color, #ffffff);
    border-radius: 2px 2px 0 0;
}

.scales .beam-container {
    position: absolute;
    top: 7px;
    left: 50%;
    width: 50px;
    height: 10px;
    transform-origin: center;
    animation: balance 2.76s ease-in-out infinite;
}

.beam {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 3px;
    background: var(--scales-color, #ffffff);
    border-radius: 3px;
}

.beam::before, .beam::after {
    content: '';
    position: absolute;
    top: -4px;
    width: 8px;
    height: 5px;
    background: var(--scales-color, #ffffff);
    border-radius: 8px 8px 0 0;
}

.beam::before {
    right: 98%;
}

.beam::after {
    left: 98%;
}

.beam .center-deco {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 6px;
    background: var(--scales-color, #ffffff);
    border-radius: 8px 8px 0 0;
}

.scales .pan {
    position: absolute;
    top: 6px;
    width: 16px;
    height: 28px;
    transform-origin: top center;
}

.scales .pan.left { left: -6px; }
.scales .pan.right { right: -6px; }

.scales .pan .bowl {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 16px;
    height: 4px;
    background-color: var(--scales-color, #ffffff);
    border-radius: 0 0 8px 8px / 0 0 10px 10px;
}

.scales .pan .chain {
    position: absolute;
    bottom: 2px;
    width: 1px;
    height: 22px;
    background-color: var(--scales-color, #ffffff);
    transform-origin: bottom center;
}

.chain.middle {
    left: 50%;
    transform: translateX(-50%);
}

.chain.left {
    left: 2px;
    transform: rotate(15deg);
}

.chain.right {
    right: 2px;
    transform: rotate(-15deg);
}

@keyframes balance {
    0% { transform: translateX(-50%) rotate(0deg); }
    25% { transform: translateX(-50%) rotate(8deg); }
    50% { transform: translateX(-50%) rotate(0deg); }
    75% { transform: translateX(-50%) rotate(-8deg); }
    100% { transform: translateX(-50%) rotate(0deg); }
}

.loading {
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    color: var(--text-color);
}

.loading span {
    display: inline-block;
    margin: 0 -0.09em;
    letter-spacing:4px;
    animation: loading-text 1s infinite alternate;
}

.loading span:nth-child(1) { animation-delay: 0.0s; }
.loading span:nth-child(2) { animation-delay: 0.2s; }
.loading span:nth-child(3) { animation-delay: 0.4s; }
.loading span:nth-child(4) { animation-delay: 0.6s; }
.loading span:nth-child(5) { animation-delay: 0.8s; }
.loading span:nth-child(6) { animation-delay: 1.0s; }
.loading span:nth-child(7) { animation-delay: 1.2s; }
.loading span:nth-child(8) { animation-delay: 1.4s; }
.loading span:nth-child(9) { animation-delay: 1.6s; }

@keyframes loading-text {
    0% {
        filter: blur(0);
        opacity: 1;
    }
    100% {
        filter: blur(2px);
        opacity: .1;
    }
}

/* Legal Scales Animation for Thinking Indicator */
.legal-scales-animation {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.scales-container {
    position: relative;
    width: 60px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scale-arm {
    width: 50px;
    height: 2px;
    background: var(--text-color);
    border-radius: 1px;
    position: relative;
    animation: scaleBalance 2s ease-in-out infinite;
    transform-origin: center;
}

.scale-plate {
    position: absolute;
    width: 12px;
    height: 8px;
    background: var(--text-color);
    border-radius: 50% 50% 0 0;
    top: 2px;
}

.scale-plate.left {
    left: -6px;
    animation: plateLeft 2s ease-in-out infinite;
}

.scale-plate.right {
    right: -6px;
    animation: plateRight 2s ease-in-out infinite;
}

.thinking-text {
    font-size: 14px;
    color: var(--text-sub-color);
    margin: 0;
    animation: thinkingPulse 1.5s ease-in-out infinite;
}

@keyframes scaleBalance {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(3deg); }
    75% { transform: rotate(-3deg); }
}

@keyframes plateLeft {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-2px); }
}

@keyframes plateRight {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(2px); }
}

@keyframes thinkingPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
/* Folder layout improvements */
.folder-details-compact {
    flex: 1;
    min-width: 0;
}

.folder-description-compact {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.3;
}

.folder-meta-right {
    margin-left: auto;
    margin-right: 8px;
}

.folder-stats {
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Case color dot for folders */
.case-color-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-right: 8px;
}

/* Ensure modal case selector is clickable */
#modal-case-selector {
    cursor: pointer !important;
    pointer-events: auto !important;
    user-select: none !important;
}

#modal-case-selector * {
    pointer-events: none !important;
}

/* Modal overflow fixes - remove clipping constraints */
#new-folder-modal {
    overflow: visible !important;
}

/* Original compact folder card styling */
.folder-item-compact {
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 6px;
    padding: 8px 12px;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
}

.folder-details-compact {
    flex: 1;
    min-width: 0;
}

.folder-name-compact {
    color: #f1f5f9;
    font-weight: 500;
    font-size: 0.75rem;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-meta-compact {
    color: #94a3b8;
    font-size: 0.6875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-menu-compact {
    padding: 2px;
    border-radius: 4px;
    color: #94a3b8;
    transition: all 0.2s ease;
    flex-shrink: 0;
    background: transparent;
    border: none;
}

.folder-menu-compact:hover {
    color: #f1f5f9;
    background: rgba(148, 163, 184, 0.1);
}

/* Green drag overlay - brand green with gradient */
.drag-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(5, 150, 105, 0.08) 100%);
    border: 2px dashed #10B981;
    border-radius: 6px;
    display: none;
    pointer-events: none;
    transition: all 0.1s ease;
}

/* show it when dragging over */
.folder-item-compact.drag-over .drag-indicator {
    display: block;
}

/* Responsive grid layout */
#folders-container {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

@media (min-width: 768px) {
    #folders-container {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    #folders-container {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 1280px) {
    #folders-container {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

/* Utility classes for larger color dots */
.w-3 {
    width: 0.75rem;
}

.h-3 {
    height: 0.75rem;
}

#new-folder-modal .modal-content {
    overflow: visible !important;
    max-height: none !important;
}

.case-selector-dropdown {
    overflow: visible !important;
}

/* Portal dropdown styling */
#modal-case-portal {
    position: fixed !important;
    z-index: 100000 !important;
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    max-height: 300px !important;
    overflow-y: auto !important;
    pointer-events: auto !important;
}

/* Selected state styling for case options */
.case-option.selected {
    background-color: var(--accent-color) !important;
    opacity: 0.9;
}

.case-option:hover {
    background-color: var(--bg-tertiary);
    cursor: pointer;
}

/* === LawZen Universal Button Gradient Styles === */

/* Primary buttons stay in the purple family on hover and press. */
.btn-primary, 
.btn, 
button[type="submit"]:not(.profile-action):not(.profile-menu-item), 
input[type="submit"], 
.submit-btn, 
.create-btn, 
.save-btn, 
.send-btn, 
.confirm-btn, 
.action-btn,
.auth-submit-btn,
.invitation-btn,
.lz-btn-submit,
.new-conversation-btn,
.mobile-new-conversation .new-conversation-btn {
    background-image: var(--interactive-gradient, var(--button-gradient)) !important;
    background: var(--interactive-gradient, var(--button-gradient)) !important;
    color: #FFFFFF !important;
    border: none !important;
    font-weight: 500;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    border-radius: 8px;
    padding: 12px 24px;
}

.btn-primary:hover, 
.btn:hover, 
button[type="submit"]:not(.profile-action):not(.profile-menu-item):hover, 
input[type="submit"]:hover, 
.submit-btn:hover, 
.create-btn:hover, 
.save-btn:hover, 
.send-btn:hover, 
.confirm-btn:hover, 
.action-btn:hover,
.auth-submit-btn:hover,
.invitation-btn:hover,
.lz-btn-submit:hover,
.new-conversation-btn:hover {
    background-image: var(--interactive-gradient-hover, linear-gradient(135deg, #6848DF 0%, #985EDF 100%)) !important;
    background: var(--interactive-gradient-hover, linear-gradient(135deg, #6848DF 0%, #985EDF 100%)) !important;
    color: #FFFFFF !important;
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(118, 85, 233, 0.24);
}

.btn-primary:active,
.btn:active,
button[type="submit"]:not(.profile-action):not(.profile-menu-item):active,
input[type="submit"]:active,
.submit-btn:active,
.create-btn:active,
.save-btn:active,
.send-btn:active,
.confirm-btn:active,
.lz-btn-submit:active,
.lz-btn-primary:active,
.modal-button-primary:active,
.new-conversation-btn:active {
    background-image: linear-gradient(135deg, #5F40D4 0%, #8D55D4 100%) !important;
    background: linear-gradient(135deg, #5F40D4 0%, #8D55D4 100%) !important;
    color: #FFFFFF !important;
    transform: translateY(0);
    box-shadow: none;
}

/* Secondary buttons stay neutral. Purple is reserved for primary actions. */
.btn-secondary, 
.btn-outline, 
.cancel-btn {
    background: var(--surface-control, rgba(255, 255, 255, 0.08)) !important;
    border: none !important;
    color: var(--text-primary) !important;
    font-weight: 600;
    transition: background 0.2s ease, color 0.2s ease;
    border-radius: 14px;
    padding: 10px 18px;
}

.btn-secondary:hover, 
.btn-outline:hover, 
.cancel-btn:hover {
    background-image: var(--button-gradient) !important;
    background: var(--button-gradient) !important;
    color: var(--button-text-color) !important;
    border-color: transparent !important;
}

/* Case creation modal buttons */
.modal-button-primary,
.folder-button-primary {
    background-image: var(--button-gradient) !important;
    background: var(--button-gradient) !important;
    color: var(--button-text-color) !important;
    border: none !important;
}

.modal-button-primary:hover,
.folder-button-primary:hover {
    background-image: linear-gradient(135deg, #6848DF 0%, #985EDF 100%) !important;
    background: linear-gradient(135deg, #6848DF 0%, #985EDF 100%) !important;
    color: #FFFFFF !important;
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(118, 85, 233, 0.24);
}

/* Login page specific buttons */
.lz-btn-primary {
    background-image: var(--button-gradient) !important;
    background: var(--button-gradient) !important;
    color: var(--button-text-color) !important;
    border: none !important;
}

.lz-btn-primary:hover {
    background-image: linear-gradient(135deg, #6848DF 0%, #985EDF 100%) !important;
    background: linear-gradient(135deg, #6848DF 0%, #985EDF 100%) !important;
    color: #FFFFFF !important;
    box-shadow: 0 10px 24px rgba(118, 85, 233, 0.24);
}

/* End of LawZen Button Styles */

/* Dynamic Navigation Styling */
.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.breadcrumb-item {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

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

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

.breadcrumb-separator {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Loading and Error States for Dynamic Navigation */
.loading-state, .error-state, .empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.loading-state .fas {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.error-state {
    color: var(--color-error);
}

.empty-state .fas {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}
