/* Global Styling Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #131c2e;
    --bg-card: #1c263c;
    --bg-card-hover: #24304a;
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --color-primary: #6366f1; /* Indigo */
    --color-primary-glow: rgba(99, 102, 241, 0.15);
    --color-secondary: #0ea5e9; /* Teal */
    
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #3b82f6;

    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(99, 102, 241, 0.3);

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.2);
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header Styling */
.app-header {
    background-color: rgba(19, 28, 46, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 72px;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
}

.logo-icon {
    font-size: 24px;
    color: var(--color-secondary);
    text-shadow: 0 0 10px rgba(14, 165, 233, 0.4);
}

.logo-text {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 20px;
    letter-spacing: -0.5px;
}

.logo-badge {
    font-size: 12px;
    font-weight: 500;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    padding: 2px 8px;
    border-radius: 9999px;
    margin-left: 6px;
    vertical-align: middle;
}

.header-nav {
    display: flex;
    gap: 16px;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: var(--transition-fast);
    border: 1px solid transparent;
}

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

.nav-btn.active {
    color: var(--text-primary);
    background-color: var(--color-primary-glow);
    border-color: rgba(99, 102, 241, 0.3);
}

/* Footer Styling */
.app-footer {
    margin-top: auto;
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 24px 0;
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
}

.footer-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

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

/* Main Content Wrapper */
.app-main {
    padding: 40px 0;
}

/* Dashboard Home Layout */
.dashboard-title-area {
    margin-bottom: 32px;
}

.dashboard-title-area h1 {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(to right, #ffffff, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.dashboard-title-area p {
    color: var(--text-secondary);
    font-size: 16px;
}

/* KPIs grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.kpi-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-md);
    transition: var(--transition-normal);
}

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

.kpi-icon-wrapper {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.kpi-icon-wrapper.calls {
    background-color: rgba(14, 165, 233, 0.15);
    color: var(--color-secondary);
}

.kpi-icon-wrapper.score {
    background-color: rgba(99, 102, 241, 0.15);
    color: var(--color-primary);
}

.kpi-icon-wrapper.ready {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
}

.kpi-info h3 {
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.kpi-value {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 700;
}

/* Sessions Table Area */
.section-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 28px;
    box-shadow: var(--shadow-lg);
}

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

.section-header h2 {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
}

/* Table Style */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.reports-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 15px;
}

.reports-table th {
    padding: 14px 16px;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

.reports-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.reports-table tr:last-child td {
    border-bottom: none;
}

.reports-table tr {
    transition: var(--transition-fast);
}

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

.col-job {
    font-family: monospace;
    font-size: 13px;
    color: var(--text-secondary);
}

.col-room {
    font-weight: 500;
}

.score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 13px;
}

.score-badge.high {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.score-badge.medium {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--color-warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.score-badge.low {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

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

.readiness-badge.ready {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
}

.readiness-badge.supervision {
    background-color: rgba(59, 130, 246, 0.15);
    color: var(--color-info);
}

.readiness-badge.developing {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--color-warning);
}

.readiness-badge.coaching,
.readiness-badge.notready {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition-fast);
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 0;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 16px;
}

/* Report Detail Layout */
.report-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 24px;
    transition: var(--transition-fast);
}

.report-back-btn:hover {
    color: var(--text-primary);
    transform: translateX(-3px);
}

.report-header-section {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 32px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 28px;
}

.report-meta-info h1 {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 12px;
}

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

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

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

.meta-value {
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 500;
}

.report-overall-score-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 12px 28px;
    background-color: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 16px;
    min-width: 180px;
    align-self: center;
}

/* Circular Gauge */
.circle-gauge {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: conic-gradient(
        var(--color) calc(var(--value) * 1%),
        rgba(255, 255, 255, 0.06) calc(var(--value) * 1%)
    );
    display: flex;
    align-items: center;
    justify-content: center;
}

.circle-gauge::before {
    content: "";
    position: absolute;
    width: 82px;
    height: 82px;
    border-radius: 50%;
    background-color: var(--bg-secondary);
}

.gauge-text {
    position: relative;
    font-family: var(--font-heading);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gauge-num {
    font-size: 26px;
    font-weight: 800;
}

.gauge-total {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: -4px;
}

/* Two Column Detail Grid */
.detail-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 32px;
    align-items: start;
}

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

/* Scores Breakdown Card */
.score-breakdown-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 28px;
    box-shadow: var(--shadow-md);
}

.score-breakdown-card h2 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.score-bar-item {
    margin-bottom: 18px;
}

.score-bar-item:last-child {
    margin-bottom: 0;
}

.score-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
}

.score-bar-name {
    color: var(--text-secondary);
}

.score-bar-val {
    color: var(--text-primary);
    font-weight: 600;
}

.progress-track {
    height: 8px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(to right, var(--color-primary), var(--color-secondary));
    border-radius: 4px;
}

/* Summary Markdown Area */
.summary-markdown-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 32px;
    box-shadow: var(--shadow-md);
}

.summary-content {
    font-size: 15px;
    line-height: 1.7;
    color: rgba(243, 244, 246, 0.9);
}

/* Style markdown output */
.summary-content h1, 
.summary-content h2, 
.summary-content h3 {
    font-family: var(--font-heading);
    margin-top: 24px;
    margin-bottom: 12px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 6px;
}

.summary-content h1 { font-size: 24px; }
.summary-content h2 { font-size: 20px; }
.summary-content h3 { 
    font-size: 17px; 
    color: var(--color-secondary);
    border-bottom: none;
    padding-bottom: 0;
}

.summary-content p {
    margin-bottom: 16px;
}

.summary-content ul, 
.summary-content ol {
    margin-bottom: 16px;
    padding-left: 20px;
}

.summary-content li {
    margin-bottom: 6px;
}

.summary-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 24px 0;
}

.summary-content strong {
    color: #ffffff;
    font-weight: 600;
}

/* Tab Navigation */
.tab-header {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 600;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition-fast);
}

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

.tab-btn.active {
    color: var(--color-secondary);
    background-color: rgba(14, 165, 233, 0.08);
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.1) inset;
}

.tab-pane {
    display: none;
}

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

/* Chat Transcript Styles */
.transcript-container {
    display: flex;
    flex-direction: column;
}

.transcript-scroll-area {
    height: 500px;
    overflow-y: auto;
    background-color: rgba(11, 15, 25, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

/* Customize scrollbar */
.transcript-scroll-area::-webkit-scrollbar {
    width: 6px;
}

.transcript-scroll-area::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.transcript-scroll-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.transcript-scroll-area::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chat-row {
    display: flex;
    width: 100%;
    align-items: flex-start;
    gap: 12px;
}

.chat-row.user {
    justify-content: flex-start; /* Customer aligned to left */
}

.chat-row.assistant {
    justify-content: flex-end; /* Rep aligned to right */
    flex-direction: row-reverse;
}

/* Chat Avatar */
.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.chat-row.user .chat-avatar {
    background: linear-gradient(135deg, #3b82f6, #0ea5e9);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.3);
}

.chat-row.assistant .chat-avatar {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

/* Chat Bubble */
.chat-bubble {
    max-width: 70%;
    padding: 12px 18px;
    border-radius: 16px;
    font-size: 14.5px;
    line-height: 1.5;
    position: relative;
    box-shadow: var(--shadow-md);
}

.chat-row.user .chat-bubble {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border-top-left-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-row.assistant .chat-bubble {
    background-color: #1e1b4b; /* Deep purple */
    background: linear-gradient(135deg, #1e1b4b, #2e1065);
    color: #ffffff;
    border-top-right-radius: 2px;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

/* Metadata & Interruptions */
.chat-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.chat-row.assistant .chat-meta {
    flex-direction: row-reverse;
}

.chat-sender-name {
    font-weight: 600;
    color: var(--text-secondary);
}

.badge-interrupted {
    font-size: 9px;
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: 600;
    text-transform: uppercase;
}

.chat-row.assistant .badge-interrupted {
    margin-left: 0;
    margin-right: 8px;
}
