/* FNF Call Portal - Dashboard Theme
   Based on D:\.00\crm\frontend\css\theme.css
*/

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

:root {
    /* Primary colors */
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #60a5fa;

    /* Dark theme - Main palette */
    --bg-page: #0f172a;
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --border-subtle: #334155;

    /* Light backgrounds (for inputs on dark) */
    --bg-light: #1e293b;
    --bg-white: #1e293b;
    --bg-input: #0f172a;

    /* Semantic colors */
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.15);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.15);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.15);

    /* Text colors - Dark mode */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-light: #ffffff;

    /* Spacing */
    --sidebar-width: 260px;
    --header-height: 64px;

    /* Typography Scale */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Courier New', monospace;
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;

    /* Border Radius - Simplified */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    /* Shadows - Refined */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);
    --shadow-focus: 0 0 0 3px rgba(102, 126, 234, 0.25);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.5;
}

/* Screen Management */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ===========================================
   LOGIN PAGE - Refined shadcn-style
   =========================================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-darker);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(59, 130, 246, 0.15), transparent),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(139, 92, 246, 0.1), transparent);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 40px 48px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    text-align: center;
}

.login-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.25);
}

.login-icon svg {
    width: 28px;
    height: 28px;
    stroke: white;
}

.login-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.login-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0;
}

.login-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 24px 0;
}

.login-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 16px;
}

/* Dev login styling */
.dev-login {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.dev-login input {
    background: var(--bg-darker);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 0.95rem;
    color: var(--text-primary);
    width: 100%;
    transition: all var(--transition-fast);
}

.dev-login input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.dev-login input::placeholder {
    color: var(--text-muted);
}

.dev-login button {
    margin-top: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, #2563eb 100%);
    border: none;
    border-radius: 10px;
    padding: 14px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.dev-login button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
}

/* ===========================================
   SIDEBAR
   =========================================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-dark);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.2);
}

.sidebar-icon svg {
    width: 18px;
    height: 18px;
    stroke: white;
}

.sidebar-logo {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.sidebar-subtitle {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 1px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

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

.nav-section-title {
    padding: 0 20px 8px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all var(--transition-fast);
    cursor: pointer;
}

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

.nav-item.active {
    background: rgba(102, 126, 234, 0.2);
    color: var(--primary-light);
    border-left: 3px solid var(--primary);
}

.nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-icon svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
}

.user-name {
    font-weight: 500;
    font-size: 0.9rem;
}

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

/* ===========================================
   MAIN CONTENT
   =========================================== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    background: var(--bg-page);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
    margin-right: 8px;
}

.mobile-menu-toggle:hover {
    background: var(--bg-light);
}

.mobile-menu-toggle:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Top Bar */
.top-bar {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sync-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
}

.sync-status.pending .sync-dot {
    background: var(--warning);
    animation: pulse 1.5s ease-in-out infinite;
}

/* Dashboard Content */
.dashboard-content {
    padding: 24px;
    max-width: 1400px;
}

/* Page Management */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* ===========================================
   STATS GRID
   =========================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stats-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all var(--transition-normal);
}

.stats-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(59, 130, 246, 0.2);
}

.stats-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stats-icon svg {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

.stats-icon.blue svg { stroke: #3b82f6; }
.stats-icon.green svg { stroke: #10b981; }
.stats-icon.purple svg { stroke: #8b5cf6; }
.stats-icon.orange svg { stroke: #f97316; }

.stats-icon.blue { background: rgba(59, 130, 246, 0.15); }
.stats-icon.green { background: rgba(16, 185, 129, 0.15); }
.stats-icon.purple { background: rgba(139, 92, 246, 0.15); }
.stats-icon.orange { background: rgba(249, 115, 22, 0.15); }

.stats-info {
    flex: 1;
}

.stats-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.stats-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

/* ===========================================
   CARDS
   =========================================== */
.card {
    background: var(--bg-card);
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    margin-bottom: 12px;
}

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

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 20px;
}

/* ===========================================
   QUICK ACTIONS
   =========================================== */
.quick-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.quick-action {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.9rem;
    font-weight: 500;
}

.quick-action svg {
    width: 18px;
    height: 18px;
    stroke: var(--text-secondary);
    transition: stroke var(--transition-fast);
}

.quick-action:hover {
    background: var(--primary);
    color: white;
}

.quick-action:hover svg {
    stroke: white;
}

/* ===========================================
   LIVE TEAM BOARD
   =========================================== */
.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 4px;
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.live-indicator.disconnected {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.live-indicator .pulse {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse-dot 1.5s ease-in-out infinite;
}

.pulse-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse-dot 1.5s ease-in-out infinite;
}

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

.live-team-board {
    min-height: 120px;
}

.team-section {
    margin-bottom: 20px;
}

.team-section h4 {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.team-member {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-light);
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all var(--transition-fast);
}

.team-member.active {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.team-member.idle {
    opacity: 0.7;
}

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

.member-name {
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-customer {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.member-status {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.member-timer {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    padding: 4px 8px;
    border-radius: 6px;
}

/* ===========================================
   CALL TRACKER PAGE - 2-Column Layout
   =========================================== */
.call-tracker-layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 12px;
    margin-bottom: 12px;
    margin-top: 8px;
}

/* Customer Card */
.call-tracker-layout .card.customer-card {
    padding: 14px 16px;
    height: fit-content;
}

/* Controls + Result Card */
.controls-result-card {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 400px;
}

.controls-result-card .call-timer {
    text-align: center;
}

.controls-result-card .timer-value {
    font-size: 1.6rem;
    font-weight: 600;
}

.controls-result-card .call-buttons {
    justify-content: center;
    gap: 10px;
}

.controls-result-card .call-buttons .btn {
    padding: 6px 18px;
    font-size: 0.8rem;
}

.controls-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 4px 0;
}

.controls-result-card .form-group {
    margin-bottom: 0;
}

.controls-result-card .form-group label {
    margin-bottom: 3px;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.controls-result-card .form-control {
    padding: 6px 10px;
    font-size: 0.85rem;
}

.controls-result-card textarea.form-control {
    min-height: 50px;
    resize: none;
}

/* Submit Button */
.btn-submit {
    width: 100%;
    padding: 8px 14px;
    font-size: 0.85rem;
}

/* Navigation - stacked under submit */
.controls-result-card .call-nav {
    padding-top: 6px;
    border-top: 1px solid var(--border-subtle);
}

.controls-result-card .call-nav .btn {
    padding: 5px 12px;
    font-size: 0.75rem;
}

.followup-card textarea.form-control {
    min-height: 50px;
    resize: none;
}

/* Team Activity Bottom Bar */
.team-activity-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    min-height: 80px;
}

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

.team-bar-title {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.team-bar-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.team-bar-content {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.team-bar-content .team-member {
    flex: 0 0 auto;
    min-width: 200px;
}

/* Progress Bar - Compact */
.progress-bar-container {
    background: var(--bg-card);
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-darker);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 3px;
    transition: width var(--transition-normal);
}

/* Customer Card - Compact & Clean */
.card.customer-card {
    padding: 14px 16px !important;
    margin-bottom: 0 !important;
}

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

.customer-info-main {
    flex: 1;
}

.customer-card .customer-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    line-height: 1.3;
}

.customer-vehicle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0;
}

.customer-uuid {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.customer-uuid code {
    background: var(--bg-darker);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
}

.phone-numbers {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.phone-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-darker);
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.phone-row:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
}

.phone-row:active {
    transform: scale(0.99);
}

.phone-row.copied {
    background: var(--success-bg);
    border-color: rgba(16, 185, 129, 0.25);
}

.phone-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    width: 45px;
    flex-shrink: 0;
}

.phone-number {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.phone-row .btn-copy {
    opacity: 0;
    transition: opacity var(--transition-fast);
    padding: 2px 6px;
    font-size: 0.65rem;
}

.phone-row:hover .btn-copy {
    opacity: 1;
}

/* Call Controls - Enhanced */
.card.controls-card {
    text-align: center;
    padding: 16px 20px !important;
    margin-bottom: 12px !important;
    transition: all var(--transition-normal);
    border: 2px solid transparent;
}

.controls-card.call-active {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.04) 0%, rgba(16, 185, 129, 0.01) 100%);
    border-color: rgba(16, 185, 129, 0.15);
}

.controls-card.timer-warning {
    border-color: rgba(234, 179, 8, 0.25);
    box-shadow: 0 0 24px rgba(234, 179, 8, 0.08);
}

.controls-card.timer-danger {
    border-color: rgba(239, 68, 68, 0.25);
    box-shadow: 0 0 32px rgba(239, 68, 68, 0.1);
}

.call-timer {
    margin-bottom: 14px;
}

.timer-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

.timer-value {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.02em;
    transition: color var(--transition-fast);
}

.call-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
}

/* Start Call Button - Prominent CTA */
#btn-call-start {
    padding: 10px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(16, 185, 129, 0.2);
    transition: all var(--transition-fast);
}

#btn-call-start:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

#btn-call-start:disabled {
    transform: scale(0.95);
    box-shadow: none;
    background: var(--bg-light);
    color: var(--text-muted);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

/* End Call Button - Becomes prominent during call */
#btn-call-end {
    padding: 10px 20px;
    transition: all var(--transition-fast);
}

#btn-call-end:not(:disabled) {
    padding: 10px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(239, 68, 68, 0.2);
    animation: pulse-danger 2s ease-in-out infinite;
}

#btn-call-end:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

#btn-call-end:disabled {
    padding: 10px 20px;
    font-size: var(--text-sm);
    background: var(--bg-light);
    color: var(--text-muted);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

@keyframes pulse-danger {
    0%, 100% { box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3); }
    50% { box-shadow: 0 4px 24px rgba(239, 68, 68, 0.45); }
}

/* Call Navigation */
.call-nav {
    display: flex;
    justify-content: space-between;
    padding: 12px 0 0 0;
}

/* ===========================================
   FILTER BAR - Compact Toolbar
   =========================================== */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    margin-bottom: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
}

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

.filter-group:not(:last-of-type)::after {
    content: '';
    width: 1px;
    height: 20px;
    background: var(--border-subtle);
    margin-left: 4px;
}

.form-control-sm {
    padding: 5px 8px;
    font-size: 0.8rem;
    min-width: 100px;
    border-radius: 4px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-darker);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.form-control-sm:hover {
    border-color: var(--primary);
}

.form-control-sm:focus {
    background: var(--bg-darker);
    border-color: var(--primary);
    box-shadow: var(--shadow-focus);
    outline: none;
}

.filter-count {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    margin-left: auto;
    padding: 4px 10px;
    background: var(--bg-light);
    border-radius: var(--radius-full);
    font-weight: 500;
}

#btn-clear-filters {
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: transparent;
    padding: 8px 12px;
}

#btn-clear-filters:hover {
    background: var(--bg-light);
    border-color: var(--primary);
    color: var(--primary);
}

/* ===========================================
   TIMER COLOR PROGRESSION
   =========================================== */
.timer-value.timer-green {
    color: var(--success);
}

.timer-value.timer-yellow {
    color: #eab308;
}

.timer-value.timer-orange {
    color: #f97316;
}

.timer-value.timer-red {
    color: var(--error);
    animation: timer-pulse 1s ease-in-out infinite;
}

@keyframes timer-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Result Form */
.result-card {
    padding: 16px 20px;
}

.result-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.validation-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--error);
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 0.85rem;
}

.validation-error.hidden {
    display: none;
}

/* ===========================================
   BUTTONS
   =========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

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

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

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-text {
    background: transparent;
    color: var(--text-muted);
}

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

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

.btn-large {
    padding: 14px 28px;
    font-size: 1rem;
}

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

/* ===========================================
   FORMS
   =========================================== */
.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.form-group label .required {
    color: var(--error);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--bg-input);
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

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

select.form-control {
    cursor: pointer;
}

/* ===========================================
   UPLOAD ZONE
   =========================================== */
.upload-zone {
    border: 2px dashed var(--border-subtle);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--bg-darker);
}

.upload-zone:hover {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

.upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
    border-style: solid;
}

.upload-icon {
    color: var(--text-muted);
    margin-bottom: 16px;
}

.upload-content p {
    margin-bottom: 4px;
    color: var(--text-secondary);
}

.upload-content .hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.requirements {
    background: var(--bg-light);
    padding: 16px 20px;
    border-radius: 8px;
}

.requirements h4 {
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.requirements ul {
    margin-left: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.requirements li {
    margin-bottom: 4px;
}

.requirements code {
    background: var(--bg-white);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

/* Help Content */
.help-content h4 {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin: 20px 0 10px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-subtle);
}

.help-content h4:first-of-type {
    margin-top: 0;
}

.help-content ol,
.help-content ul {
    margin-left: 20px;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.help-content li {
    margin-bottom: 4px;
}

.help-content p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.help-content strong {
    color: var(--text-primary);
}

/* Error Box */
.error-box {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--error);
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 16px;
    font-size: 0.9rem;
}

.error-box.hidden {
    display: none;
}

/* ===========================================
   RESULTS SUMMARY
   =========================================== */
.results-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.result-row:last-child {
    border-bottom: none;
}

.result-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.result-count {
    font-weight: 600;
    color: var(--text-primary);
}

/* ===========================================
   HISTORY TABLE
   =========================================== */
.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th,
.history-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.history-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
    background: var(--bg-light);
}

.history-table td {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.history-table tr:hover td {
    background: rgba(102, 126, 234, 0.04);
}

/* ===========================================
   TOAST NOTIFICATIONS
   =========================================== */
.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: var(--bg-white);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 10px;
    padding: 14px 18px;
    min-width: 300px;
    max-width: 400px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: all;
    box-shadow: var(--shadow-lg);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.removing {
    transform: translateX(120%);
    opacity: 0;
}

.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    line-height: 1;
}

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

.toast-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.toast-message {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.toast-close:hover {
    opacity: 1;
}

/* Toast Types */
.toast-success { border-left: 4px solid var(--success); }
.toast-success .toast-icon { color: var(--success); }

.toast-error { border-left: 4px solid var(--error); }
.toast-error .toast-icon { color: var(--error); }

.toast-warning { border-left: 4px solid var(--warning); }
.toast-warning .toast-icon { color: var(--warning); }

.toast-info { border-left: 4px solid var(--info); }
.toast-info .toast-icon { color: var(--info); }

/* ===========================================
   EMPTY STATES
   =========================================== */
.empty-state {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===========================================
   UTILITIES
   =========================================== */
.hidden {
    display: none !important;
}

/* ===========================================
   PENDING INDICATOR
   =========================================== */
.pending-indicator {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--warning);
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    z-index: 1000;
}

/* ===========================================
   RESPONSIVE
   =========================================== */
@media (max-width: 1024px) {
    .call-tracker-layout {
        grid-template-columns: 1fr;
    }

    .call-tracker-sidebar {
        position: relative;
        top: 0;
    }
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
        box-shadow: var(--shadow-lg);
    }

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

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

    .top-bar {
        padding: 0 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .call-buttons {
        flex-direction: column;
    }

    .filter-bar {
        flex-wrap: wrap;
        padding: 12px 16px;
        gap: 10px;
    }

    .filter-group {
        flex: 1 1 calc(50% - 8px);
        min-width: 120px;
    }

    .filter-group::after {
        display: none;
    }

    .filter-group .form-control-sm {
        width: 100%;
        min-width: unset;
    }

    .filter-count {
        flex: 1 1 100%;
        text-align: center;
        margin-left: 0;
    }
}

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