:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.75);
    --bg-card-hover: rgba(31, 41, 55, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.15);
    
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --accent-primary: #6366f1;
    --accent-primary-hover: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.25);
    
    --sales-color: #3b82f6;
    --sales-bg: rgba(59, 130, 246, 0.12);
    --sales-border: rgba(59, 130, 246, 0.3);
    
    --customer-color: #10b981;
    --customer-bg: rgba(16, 185, 129, 0.12);
    --customer-border: rgba(16, 185, 129, 0.3);
    
    --warning: #f59e0b;
    --danger: #ef4444;
    --success: #10b981;
    --info: #06b6d4;

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.4);
    --glass-blur: blur(16px);
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: #1f2937;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #374151;
}

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

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-color);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.brand-title {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 20px;
    letter-spacing: -0.5px;
}

.brand-accent {
    color: #818cf8;
}

.brand-subtitle {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

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

.nav-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 1.2px;
    margin: 16px 0 8px 12px;
}

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

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

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

.nav-item.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(168, 85, 247, 0.2) 100%);
    border: 1px solid rgba(99, 102, 241, 0.4);
}

.nav-item.active i {
    color: #818cf8;
}

.recording-pulse {
    color: #ef4444;
    animation: pulse 1.5s infinite;
}

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

.badge-new {
    margin-left: auto;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 20px;
    font-weight: 700;
    text-transform: uppercase;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.voice-enrollment-card {
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.3) 0%, rgba(88, 28, 135, 0.3) 100%);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.voice-enrollment-card .card-icon {
    font-size: 20px;
    color: #818cf8;
}

.voice-enrollment-card strong {
    display: block;
    font-size: 12px;
    color: #e0e7ff;
}

.voice-enrollment-card p {
    font-size: 11px;
    color: #94a3b8;
    margin: 0;
}

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

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
}

.user-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
}

.user-role {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.08), transparent 40%),
                radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.05), transparent 40%),
                var(--bg-primary);
}

/* Topbar */
.topbar {
    height: 75px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background: rgba(11, 15, 25, 0.7);
    backdrop-filter: var(--glass-blur);
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-toggle-sidebar {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
}

.page-title {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
}

.page-description {
    font-size: 12px;
    color: var(--text-secondary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ai-status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 12px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 10px #10b981;
}

.status-text {
    color: #e5e7eb;
    font-weight: 500;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary) 0%, #8b5cf6 100%);
    color: #fff;
    box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-primary-hover) 0%, #7c3aed 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: #ef4444;
    color: #fff;
}

.btn-glow {
    animation: glow-pulse 3s infinite;
}

@keyframes glow-pulse {
    0%, 100% { box-shadow: 0 4px 14px var(--accent-glow); }
    50% { box-shadow: 0 4px 25px rgba(99, 102, 241, 0.6); }
}

/* Content Body */
.content-body {
    padding: 32px;
    flex: 1;
}

/* Cards & Glassmorphism */
.card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    border-color: var(--border-light);
}

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

.card-title {
    font-family: var(--font-heading);
    font-size: 17px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title i {
    color: var(--accent-primary);
}

/* Metric Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 18px;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary), transparent);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.icon-blue { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.icon-purple { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.icon-green { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.icon-amber { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 4px;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.stat-subtext {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 600;
}

.badge-blue { background: rgba(59, 130, 246, 0.15); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-green { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-amber { background: rgba(245, 158, 11, 0.15); color: #fde68a; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-purple { background: rgba(168, 85, 247, 0.15); color: #d8b4fe; border: 1px solid rgba(168, 85, 247, 0.3); }

/* Table */
.data-table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}

.data-table th {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: rgba(255, 255, 255, 0.07);
}

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

/* Audio Player & Waveform */
.audio-player-card {
    background: linear-gradient(135deg, rgba(17, 24, 39, 0.9) 0%, rgba(30, 27, 75, 0.7) 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
}

.audio-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-play-pause {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary) 0%, #8b5cf6 100%);
    border: none;
    color: #fff;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 14px var(--accent-glow);
    transition: transform 0.2s;
}

.btn-play-pause:hover {
    transform: scale(1.06);
}

.waveform-progress {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.timeline-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #818cf8;
    box-shadow: 0 0 8px #818cf8;
}

.time-display {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
}

/* Recording Visualizer Studio */
.recording-studio-box {
    text-align: center;
    padding: 40px 20px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px dashed rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-xl);
    margin-bottom: 24px;
    position: relative;
}

.recording-timer {
    font-family: var(--font-heading);
    font-size: 48px;
    font-weight: 800;
    letter-spacing: 2px;
    color: #f3f4f6;
    margin-bottom: 12px;
}

.recording-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    padding: 6px 16px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 20px;
}

#canvasVisualizer {
    width: 100%;
    max-width: 600px;
    height: 100px;
    display: block;
    margin: 0 auto 20px auto;
    border-radius: var(--radius-md);
}

.recording-action-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

/* Tabs */
.tabs-nav {
    display: flex;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.2s;
}

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

.tab-btn.active {
    color: #818cf8;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: #818cf8;
    box-shadow: 0 0 10px #818cf8;
}

.tab-pane {
    display: none;
}
.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Dialogue / Diarization Chat */
.transcript-timeline {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chat-entry {
    display: flex;
    gap: 16px;
    max-width: 85%;
}

.chat-entry.sales {
    align-self: flex-start;
}

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

.speaker-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.chat-entry.sales .speaker-avatar {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.4);
}

.chat-entry.customer .speaker-avatar {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #fff;
    box-shadow: 0 4px 10px rgba(5, 150, 105, 0.4);
}

.bubble-wrapper {
    display: flex;
    flex-direction: column;
}

.bubble-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 12px;
}

.chat-entry.customer .bubble-meta {
    justify-content: flex-end;
}

.speaker-name {
    font-weight: 700;
}

.time-stamp {
    color: var(--text-muted);
}

.tone-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: #d1d5db;
}

.dialogue-bubble {
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    line-height: 1.6;
}

.chat-entry.sales .dialogue-bubble {
    background: var(--sales-bg);
    border: 1px solid var(--sales-border);
    border-top-left-radius: 4px;
    color: #e0f2fe;
}

.chat-entry.customer .dialogue-bubble {
    background: var(--customer-bg);
    border: 1px solid var(--customer-border);
    border-top-right-radius: 4px;
    color: #d1fae5;
}

/* Coaching & Summary Elements */
.score-radial-box {
    display: flex;
    align-items: center;
    gap: 24px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.score-number {
    font-family: var(--font-heading);
    font-size: 54px;
    font-weight: 800;
    color: #818cf8;
    line-height: 1;
}

.score-details h4 {
    font-size: 18px;
    margin-bottom: 6px;
}

.score-details p {
    font-size: 13px;
    color: var(--text-secondary);
}

.feature-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: var(--radius-md);
}

.feature-item.positive i { color: #34d399; font-size: 16px; margin-top: 3px; }
.feature-item.improvement i { color: #f59e0b; font-size: 16px; margin-top: 3px; }
.feature-item.coaching i { color: #60a5fa; font-size: 16px; margin-top: 3px; }

.followup-box {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    font-family: inherit;
    font-size: 13px;
    white-space: pre-wrap;
    color: #e5e7eb;
    position: relative;
}

.btn-copy-script {
    position: absolute;
    top: 14px;
    right: 14px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}

.toast {
    background: #1f2937;
    border: 1px solid var(--border-light);
    color: #fff;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    min-width: 280px;
    animation: toastIn 0.3s ease;
}

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

.toast.success { border-left: 4px solid #10b981; }
.toast.error { border-left: 4px solid #ef4444; }
.toast.info { border-left: 4px solid #6366f1; }

/* Responsive */
@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: -280px;
    }
    .sidebar.open {
        left: 0;
    }
    .btn-toggle-sidebar {
        display: block;
    }
    .content-body {
        padding: 20px;
    }
    .chat-entry {
        max-width: 95%;
    }
}

/* Print View for Exporting Notulen */
@media print {
    .sidebar, .topbar, .tabs-nav, .btn, .audio-player-card {
        display: none !important;
    }
    .tab-pane {
        display: block !important;
        margin-bottom: 30px;
    }
    body {
        background: #fff !important;
        color: #000 !important;
    }
    .card {
        background: none !important;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        color: #000 !important;
    }
    .chat-entry.sales .dialogue-bubble,
    .chat-entry.customer .dialogue-bubble {
        background: #f3f4f6 !important;
        color: #000 !important;
        border: 1px solid #ddd !important;
    }
}
