/* Modern Dashboard Styles with Dark/Light Mode Support */

:root {
    /* Light mode colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --bg-card: #ffffff;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    --border-color: #dee2e6;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    
    /* Brand colors */
    --brand-primary: #0066cc;
    --brand-secondary: #00a8e8;
    --brand-success: #00c896;
    --brand-danger: #ff6b6b;
    --brand-warning: #feca57;
    --brand-info: #54a0ff;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #00c896 0%, #00a8e8 100%);
    --gradient-danger: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    --gradient-info: linear-gradient(135deg, #54a0ff 0%, #0066cc 100%);
}

[data-theme="dark"] {
    /* Dark mode colors */
    --bg-primary: #0b1220;
    --bg-secondary: #141c2c;
    --bg-tertiary: #1f2a3b;
    --bg-card: #172133;
    --text-primary: #f1f5fb;
    --text-secondary: #c7d4eb;
    --text-muted: #9cb3d0;
    --border-color: #2a3547;
    --shadow-sm: 0 0.125rem 0.25rem rgba(8, 11, 19, 0.35);
    --shadow-md: 0 0.5rem 1rem rgba(8, 11, 19, 0.45);
    --shadow-lg: 0 1rem 3rem rgba(8, 11, 19, 0.6);
}

[data-theme="dark"] .summary-card {
    background: rgba(23, 32, 49, 0.92);
    border-color: rgba(100, 116, 139, 0.3);
    box-shadow: 0 12px 30px rgba(8, 13, 24, 0.45);
}

[data-theme="dark"] .summary-card .summary-label {
    color: rgba(226, 232, 240, 0.82);
}

[data-theme="dark"] .summary-card .summary-value {
    color: #f8fafc;
}

[data-theme="dark"] .summary-card .summary-hint {
    color: rgba(203, 213, 225, 0.75);
}

[data-theme="dark"] .status-chip {
    background: rgba(21, 30, 46, 0.85);
    border-color: rgba(148, 163, 184, 0.35);
    color: #f1f5f9;
}

[data-theme="dark"] .status-chip .chip-label {
    color: rgba(203, 213, 225, 0.8);
}

/* Base styles */
body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Card system */
.card-shell {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    padding: 24px;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

[data-theme="dark"] .card-shell,
[data-theme="dark"] .card-shell p,
[data-theme="dark"] .card-shell span,
[data-theme="dark"] .card-shell li,
[data-theme="dark"] .card-shell label {
    color: rgba(241, 245, 249, 0.92);
}

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

.card-shell.compact {
    padding: 18px;
}

.card-header-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.card-header-inline h2,
.card-header-inline h3,
.card-header-inline h4,
.card-header-inline h5 {
    margin: 0;
    font-weight: 600;
    color: var(--text-primary);
}

.card-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

[data-theme="dark"] .card-header-inline h1,
[data-theme="dark"] .card-header-inline h2,
[data-theme="dark"] .card-header-inline h3,
[data-theme="dark"] .card-header-inline h4,
[data-theme="dark"] .card-header-inline h5 {
    color: #ffffff;
}

[data-theme="dark"] .card-subtitle {
    color: rgba(226, 235, 248, 0.9);
}

.grid-3 {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 992px) {
    .grid-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

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

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

.summary-card {
    border-radius: 14px;
    padding: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.summary-card .summary-label {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.summary-card .summary-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.summary-card .summary-hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

[data-theme="dark"] .summary-card .summary-label,
[data-theme="dark"] .summary-card .summary-value,
[data-theme="dark"] .summary-card .summary-hint {
    color: rgba(239, 246, 255, 0.92);
}

[data-theme="dark"] .summary-card .summary-label {
    color: rgba(235, 243, 255, 0.9);
}

[data-theme="dark"] .summary-card .summary-value {
    color: #ffffff;
}

[data-theme="dark"] .summary-card .summary-hint {
    color: rgba(210, 220, 238, 0.85);
}

.status-strip {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

@media (max-width: 768px) {
    .status-strip {
        gap: 8px;
    }
    .status-chip {
        flex: 1 1 140px;
    }
}

.status-chip {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-secondary);
    color: inherit;
    font-weight: 600;
    min-width: 160px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    text-align: left;
}

.status-chip:hover {
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-sm);
}

.status-chip .chip-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.status-chip .chip-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

[data-theme="dark"] .status-chip {
    background: rgba(21, 30, 46, 0.92);
    border-color: rgba(148, 163, 184, 0.45);
    color: #f8fafc;
    box-shadow: 0 12px 26px rgba(10, 14, 24, 0.4);
}

[data-theme="dark"] .status-chip .chip-label {
    color: rgba(236, 244, 255, 0.9);
}

[data-theme="dark"] .status-chip .chip-value {
    color: #ffffff;
}

.link-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.link-chip {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 999px;
    padding: 8px 16px;
    background: #ffffff;
    color: #0f172a;
    font-size: 0.92rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

@media (max-width: 768px) {
    .link-chip {
        flex: 1 1 45%;
        justify-content: center;
    }
}

[data-theme="dark"] .link-chip {
    background: rgba(30, 41, 59, 0.9);
    color: #f8fafc;
    border-color: rgba(148, 163, 184, 0.4);
    box-shadow: 0 12px 28px rgba(8, 12, 24, 0.45);
}

.link-chip:hover {
    border-color: rgba(99, 102, 241, 0.65);
    color: #1d4ed8;
    box-shadow: 0 12px 28px rgba(59, 130, 246, 0.25);
    transform: translateY(-1px);
}

.simple-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 12px 0;
}

.simple-summary-item {
    flex: 1 1 140px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: var(--text-secondary);
}

.simple-summary-item .summary-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.simple-status-inline {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    gap: 6px;
    align-items: center;
}

.summary-card.success {
    border-color: rgba(0, 200, 150, 0.35);
}

.summary-card.warning {
    border-color: rgba(254, 202, 87, 0.4);
}

.summary-card.neutral {
    border-color: rgba(102, 126, 234, 0.35);
}

.minutes-usage-box {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    font-size: 0.9rem;
}

.minutes-usage-box .progress {
    background: rgba(99, 102, 241, 0.1);
}

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

.inline-actions .btn {
    flex: 1 1 auto;
    min-width: 130px;
}

@media (max-width: 576px) {
    .inline-actions .btn {
        flex: 1 1 100%;
    }
}

.quick-actions-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.quick-actions-grid .btn {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.badge-pill {
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.plan-badge {
    background: rgba(0, 102, 204, 0.12);
    color: #004080;
}

[data-theme="dark"] .plan-badge {
    background: rgba(84, 160, 255, 0.15);
    color: #d0e2ff;
}

/* Logo watermark */
body::before {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 800px;
    height: 800px;
    background-image: url('/favicon.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.08;
    pointer-events: none;
    z-index: 0;
    /* Match brand primary color #0066cc */
    filter: sepia(1) saturate(2) hue-rotate(195deg) brightness(0.75);
    /* Epic 30-minute bounce and scale animation */
    animation: epicBounceAndScale 1800s linear infinite;
}

/* Circuit board trace container */
.circuit-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 800px;
    height: 800px;
    pointer-events: none;
    z-index: 0;
    animation: epicBounceAndScale 1800s linear infinite;
}

/* Circuit board trace styles */
.circuit-trace {
    position: absolute;
    background: #00ff88;
    opacity: 0;
    transform-origin: center;
    box-shadow: 0 0 3px #00ff88, inset 0 0 1px rgba(0, 255, 136, 0.5);
}

.circuit-trace.horizontal {
    height: 2px;
    width: 60px;
}

.circuit-trace.vertical {
    width: 2px;
    height: 60px;
}

.circuit-dot {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #00ff88;
    border-radius: 50%;
    box-shadow: 0 0 5px #00ff88, inset 0 0 2px rgba(0, 255, 136, 0.8);
    opacity: 0;
}

.circuit-corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid #00ff88;
    border-bottom: none;
    border-left: none;
    opacity: 0;
    box-shadow: 0 0 3px #00ff88;
}

/* Circuit trace animations */
@keyframes circuitFlow {
    0% {
        opacity: 0;
        transform: scaleX(0);
    }
    50% {
        opacity: 0.8;
        transform: scaleX(1);
    }
    100% {
        opacity: 0;
        transform: scaleX(1);
    }
}

@keyframes circuitDotPulse {
    0%, 100% {
        opacity: 0.4;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.3);
    }
}

@keyframes circuitPulse {
    0%, 100% { 
        opacity: 0.3;
        filter: brightness(1);
    }
    50% { 
        opacity: 0.8;
        filter: brightness(1.5) drop-shadow(0 0 5px #00ff88);
    }
}

/* Epic 30-minute bounce and scale animation */
@keyframes epicBounceAndScale {
    0% { transform: translate(-50%, -50%) scale(1); }
    5% { transform: translate(-30%, -30%) scale(0.9); }
    10% { transform: translate(-70%, -60%) scale(0.8); }
    15% { transform: translate(-20%, -80%) scale(0.7); }
    20% { transform: translate(-80%, -20%) scale(0.6); }
    25% { transform: translate(-40%, -40%) scale(0.5); }
    30% { transform: translate(-60%, -70%) scale(0.4); }
    35% { transform: translate(-30%, -20%) scale(0.3); }
    40% { transform: translate(-70%, -50%) scale(0.2); }
    45% { transform: translate(-50%, -50%) scale(0.1); }
    50% { transform: translate(-50%, -50%) scale(0.05); }
    55% { transform: translate(-30%, -70%) scale(0.1); }
    60% { transform: translate(-70%, -30%) scale(0.2); }
    65% { transform: translate(-20%, -40%) scale(0.3); }
    70% { transform: translate(-80%, -60%) scale(0.4); }
    75% { transform: translate(-40%, -80%) scale(0.5); }
    80% { transform: translate(-60%, -20%) scale(0.6); }
    85% { transform: translate(-30%, -50%) scale(0.7); }
    90% { transform: translate(-70%, -40%) scale(0.8); }
    95% { transform: translate(-40%, -60%) scale(0.9); }
    100% { transform: translate(-50%, -50%) scale(1); }
}


/* Adjust watermark for dark mode */
[data-theme="dark"] body::before {
    opacity: 0.06;
    /* Enhanced dark mode with electric effect */
    filter: sepia(1) saturate(2) hue-rotate(190deg) brightness(0.8) 
            drop-shadow(0 0 25px rgba(138, 43, 226, 0.6));
}
[data-theme="dark"] body::after {
    filter: brightness(2.5) contrast(2) 
            drop-shadow(0 0 4px #8a2be2)
            drop-shadow(0 0 8px #4169e1)
            drop-shadow(0 0 12px #8a2be2)
            drop-shadow(0 0 16px #4169e1);
}

/* Ensure content stays above watermark */
body > * {
    position: relative;
    z-index: 1;
}

/* Modern card design */
.modern-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    overflow: hidden;
}

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

.modern-card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem;
}

.modern-card-body {
    padding: 1.5rem;
}

/* Gradient headers */
.gradient-header {
    background: var(--gradient-primary);
    color: white;
    padding: 2rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.gradient-header h1,
.gradient-header h2,
.gradient-header h3,
.gradient-header p {
    color: white;
    margin: 0;
}

/* Stats cards */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.stat-card.success::before {
    background: var(--gradient-success);
}

.stat-card.danger::before {
    background: var(--gradient-danger);
}

.stat-card.info::before {
    background: var(--gradient-info);
}

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

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
}

.stat-icon.primary {
    background: var(--gradient-primary);
    color: white;
}

.stat-icon.success {
    background: var(--gradient-success);
    color: white;
}

.stat-icon.danger {
    background: var(--gradient-danger);
    color: white;
}

.stat-icon.info {
    background: var(--gradient-info);
    color: white;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Modern buttons */
.btn-modern {
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-modern::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-modern:hover::before {
    width: 300px;
    height: 300px;
}

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

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

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


/* Icon animations */
.icon-float {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Navbar styling */
.navbar-modern {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 1rem 0;
}

.navbar-modern .navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.navbar-modern .nav-link {
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.navbar-modern .nav-link:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Live call card */
.live-call-modern {
    background: var(--bg-card);
    border: 2px solid var(--brand-success);
    border-radius: 16px;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.live-call-modern::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 200, 150, 0.1) 0%, transparent 70%);
    animation: pulse-bg 2s ease-in-out infinite;
}

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

/* Form inputs */
.form-control-modern,
.form-select-modern {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.form-control-modern:focus,
.form-select-modern:focus {
    background: var(--bg-primary);
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 0.2rem rgba(0, 102, 204, 0.25);
    outline: none;
}

/* Alerts */
.alert-modern {
    border: none;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-sm);
}

.alert-success-modern {
    background: rgba(0, 200, 150, 0.1);
    color: var(--brand-success);
    border-left: 4px solid var(--brand-success);
}

.alert-danger-modern {
    background: rgba(255, 107, 107, 0.1);
    color: var(--brand-danger);
    border-left: 4px solid var(--brand-danger);
}

.alert-info-modern {
    background: rgba(84, 160, 255, 0.1);
    color: var(--brand-info);
    border-left: 4px solid var(--brand-info);
}

/* Charts container */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    height: 300px;
    position: relative;
}

/* Loading animation */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--brand-primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .gradient-header {
        padding: 1.5rem;
    }
    
    .stat-card {
        margin-bottom: 1rem;
    }
}
[data-theme="dark"] .metric-card {
    background: rgba(22, 32, 48, 0.92) !important;
    color: #eaf2ff !important;
    border: 1px solid rgba(100, 116, 139, 0.28);
    box-shadow: 0 14px 35px rgba(8, 13, 24, 0.45);
}

[data-theme="dark"] .metric-card .metric-label {
    color: rgba(226, 232, 240, 0.8) !important;
}

[data-theme="dark"] .metric-card .metric-value {
    color: #f8fafc !important;
}

[data-theme="dark"] .metric-change {
    color: rgba(203, 213, 225, 0.85) !important;
}


/* Sidebar layout for dashboard quick actions */
.dashboard-content-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-start;
    margin-top: 2rem;
}

.dashboard-main-column {
    flex: 1 1 600px;
    min-width: 0;
}

.dashboard-sidebar-column {
    flex: 0 1 360px;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.dashboard-sidebar-column .card {
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.dashboard-sidebar-column .card-header {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.08), rgba(59, 130, 246, 0.08));
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.sidebar-radio {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 10px;
    background: rgba(248, 250, 252, 0.9);
    font-size: 0.9rem;
}

.sidebar-radio input {
    accent-color: #2563eb;
}

.sip-credentials-list code {
    background: rgba(15, 23, 42, 0.06);
    border-radius: 6px;
    padding: 0.15rem 0.35rem;
    font-size: 0.85rem;
}

@media (min-width: 992px) {
    .dashboard-sidebar-column {
        position: sticky;
        top: 96px;
    }
}

@media (max-width: 991px) {
    .dashboard-content-layout {
        flex-direction: column;
    }
    .dashboard-sidebar-column {
        position: static;
        width: 100%;
    }
}
