/* RESET & ROOT VARIABLES */
:root {
    --bg-dark: #ffffff;
    --bg-panel: rgba(255, 255, 255, 0.95);
    --border-color: rgba(0, 0, 0, 0.08);
    --text-primary: #111827;
    --text-secondary: #4b5563;
    
    /* Brand Red & White accent colors */
    --color-cyan: #e11d48; /* Esyposteit brand red */
    --color-purple: #be123c; /* Darker red accent */
    --color-emerald: #10b981;
    --color-amber: #d97706;
    --color-danger: #dc2626;

    /* Glow shadows */
    --shadow-cyan: 0 4px 20px rgba(225, 29, 72, 0.15);
    --shadow-purple: 0 4px 20px rgba(0, 0, 0, 0.05);
    --shadow-emerald: 0 4px 20px rgba(16, 185, 129, 0.15);
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    overflow: hidden;
    height: 100vh;
}

/* APP CONTAINER LAYOUT */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* SIDEBAR STYLES (Light Off-white) */
.sidebar {
    width: 280px;
    background-color: #f9fafb;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.logo-icon {
    font-size: 24px;
    color: var(--color-cyan);
    filter: drop-shadow(var(--shadow-cyan));
    animation: pulse-glow 2s infinite ease-in-out;
}

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

.logo-text span {
    color: var(--color-cyan);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item {
    background: none;
    border: none;
    outline: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 500;
    text-align: left;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item i {
    font-size: 18px;
    width: 20px;
}

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

.nav-item.active {
    color: var(--color-cyan);
    background-color: rgba(225, 29, 72, 0.05);
    border: 1px solid rgba(225, 29, 72, 0.15);
    box-shadow: inset 0 0 10px rgba(225, 29, 72, 0.02);
}

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

.gcp-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 12px;
    font-family: var(--font-heading);
    font-weight: 500;
    background-color: rgba(0, 0, 0, 0.02);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.gcp-badge i {
    color: #4285f4;
}

/* MAIN CONTENT AREA */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 32px;
    position: relative;
    background-color: #ffffff;
}

/* HEADER STYLES */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

.header-title h1 {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
    color: #111827;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Status Indicator Bar */
.status-indicator-bar {
    display: flex;
    gap: 20px;
    background-color: rgba(0, 0, 0, 0.01);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 30px;
}

.status-dot-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-family: var(--font-heading);
    font-weight: 500;
}

.status-dot-item .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--color-danger);
    transition: background-color 0.5s ease;
}

.status-dot-item.online .dot {
    background-color: var(--color-emerald);
    box-shadow: var(--shadow-emerald);
}

.status-dot-item .label {
    color: var(--text-secondary);
}

.status-dot-item.online .label {
    color: var(--text-primary);
}

/* TAB DISPLAY LOGIC */
.tab-content {
    display: none;
    flex-grow: 1;
}

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

/* GLASS PANEL PANELS */
.glass-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.05);
    padding: 24px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.glass-panel:hover {
    box-shadow: 0 4px 25px 0 rgba(0, 0, 0, 0.08);
}

/* BUTTONS */
.btn {
    border: none;
    outline: none;
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease-in-out;
}

.btn-primary {
    background-color: var(--color-cyan);
    color: #ffffff;
    box-shadow: var(--shadow-cyan);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    background-color: var(--color-purple);
    box-shadow: 0 4px 25px rgba(225, 29, 72, 0.3);
}

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

.btn-danger:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2);
}

.btn.disabled, .btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* CARD DETAILS */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 14px;
}

.card-header h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #111827;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
}

#call-status-badge {
    background-color: rgba(0, 0, 0, 0.04);
    color: var(--text-secondary);
}

#call-status-badge.active {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--color-emerald);
    border: 1px solid rgba(16, 185, 129, 0.15);
    box-shadow: var(--shadow-emerald);
    animation: blink-status 1.5s infinite ease-in-out;
}

/* CALL SIMULATOR LAYOUT */
.grid-layout {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 32px;
    height: calc(100vh - 150px);
}

.call-controller-panel {
    display: flex;
    flex-direction: column;
}

.dialer-wrapper {
    background-color: #f9fafb;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.phone-display {
    text-align: center;
    margin-bottom: 16px;
}

.phone-number {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
    color: var(--color-cyan);
    margin-bottom: 4px;
}

.call-duration {
    font-size: 28px;
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--text-primary);
}

.dialer-buttons {
    display: flex;
    gap: 16px;
}

/* Waveform Visualizer */
.waveform-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 40px;
    margin: 10px 0 20px 0;
    width: 200px;
}

.wave-bar {
    width: 4px;
    height: 6px;
    background-color: var(--color-cyan);
    border-radius: 2px;
    transition: height 0.1s ease;
}

/* Animation classes triggered dynamically */
.waveform-container.playing .wave-bar {
    animation: wave-bounce 1s ease-in-out infinite;
}

.waveform-container.playing .wave-bar:nth-child(2)  { animation-delay: 0.1s; }
.waveform-container.playing .wave-bar:nth-child(3)  { animation-delay: 0.2s; }
.waveform-container.playing .wave-bar:nth-child(4)  { animation-delay: 0.3s; }
.waveform-container.playing .wave-bar:nth-child(5)  { animation-delay: 0.4s; }
.waveform-container.playing .wave-bar:nth-child(6)  { animation-delay: 0.5s; }
.waveform-container.playing .wave-bar:nth-child(7)  { animation-delay: 0.4s; }
.waveform-container.playing .wave-bar:nth-child(8)  { animation-delay: 0.3s; }
.waveform-container.playing .wave-bar:nth-child(9)  { animation-delay: 0.2s; }
.waveform-container.playing .wave-bar:nth-child(10) { animation-delay: 0.1s; }

/* CHAT BOX */
.chat-area {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background-color: #f9fafb;
    overflow: hidden;
}

.chat-header {
    background-color: rgba(0, 0, 0, 0.02);
    padding: 10px 16px;
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.chat-log-box {
    flex-grow: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    text-align: center;
    gap: 12px;
}

.chat-placeholder i {
    font-size: 32px;
    opacity: 0.3;
}

.bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.bubble.customer {
    align-self: flex-end;
    background-color: rgba(225, 29, 72, 0.08);
    border: 1px solid rgba(225, 29, 72, 0.15);
    color: #9f1239;
    border-bottom-right-radius: 4px;
}

.bubble.agent {
    align-self: flex-start;
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-top-left-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

/* Chat Input Bar */
.chat-input-area {
    display: flex;
    border-top: 1px solid var(--border-color);
    background-color: #ffffff;
}

.chat-input-area input {
    flex-grow: 1;
    background: none;
    border: none;
    outline: none;
    padding: 16px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
}

.btn-send {
    background: none;
    border: none;
    color: var(--color-cyan);
    padding: 16px;
    cursor: pointer;
    font-size: 16px;
}

.btn-send:hover:not(:disabled) {
    color: var(--color-purple);
    filter: drop-shadow(var(--shadow-cyan));
}

/* PIPELINE LOGS (Console Light) */
.logs-panel {
    display: flex;
    flex-direction: column;
}

.btn-clear {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    transition: color 0.2s;
}

.btn-clear:hover {
    color: var(--color-danger);
}

.pipeline-logs-container {
    flex-grow: 1;
    background-color: #f9fafb;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #374151;
}

.log-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    text-align: center;
    gap: 12px;
}

.log-placeholder i {
    font-size: 32px;
    opacity: 0.3;
}

/* Dynamic log messages styling */
.log-row {
    line-height: 1.4;
    word-break: break-all;
    border-left: 2px solid transparent;
    padding-left: 8px;
}

.log-row.telephony { color: #374151; border-left-color: #9ca3af; }
.log-row.gateway   { color: var(--color-cyan); border-left-color: var(--color-cyan); }
.log-row.rag       { color: #b45309; border-left-color: #b45309; }
.log-row.agent     { color: #111827; border-left-color: #111827; }
.log-row.tool      { color: #9f1239; border-left-color: #9f1239; }

/* CALL HISTORY LAYOUT */
.history-layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 32px;
    height: calc(100vh - 150px);
}

.history-list-card {
    display: flex;
    flex-direction: column;
}

.history-list {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    background-color: #f9fafb;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.history-item:hover {
    border-color: rgba(225, 29, 72, 0.3);
    background-color: rgba(225, 29, 72, 0.02);
}

.history-item.active {
    border-color: var(--color-cyan);
    background-color: rgba(225, 29, 72, 0.05);
}

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

.h-number {
    font-family: var(--font-heading);
    font-weight: 600;
}

.h-score {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-cyan);
}

.h-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
}

.btn-refresh {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
}

.btn-refresh:hover {
    color: var(--color-cyan);
}

/* Call Detail card view */
.history-details-card {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.details-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    text-align: center;
    gap: 12px;
}

.details-placeholder i {
    font-size: 40px;
    opacity: 0.3;
}

.hidden {
    display: none !important;
}

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

.caller-meta h4 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.detail-time {
    font-size: 13px;
    color: var(--text-secondary);
}

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

.badge-warning {
    background-color: rgba(217, 119, 6, 0.1);
    color: var(--color-amber);
    border: 1px solid rgba(217, 119, 6, 0.15);
}

/* Audio Player */
.audio-playback-box {
    background-color: #f9fafb;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
}

.audio-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.audio-playback-box audio {
    width: 100%;
    outline: none;
}

/* Scores */
.scores-section {
    margin-bottom: 24px;
}

.score-card-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.score-mini-card {
    background-color: #f9fafb;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}

.score-mini-card .val {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    color: var(--color-cyan);
    margin-bottom: 4px;
}

.score-mini-card .lbl {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.overall-progress-box {
    background-color: rgba(0, 0, 0, 0.005);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
}

.overall-lbl {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
}

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

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(to right, var(--color-cyan), var(--color-purple));
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Transcript + Analytics */
.transcript-notes-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.detail-sub-section h5 {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.transcript-box {
    border: 1px solid var(--border-color);
    background-color: #f9fafb;
    border-radius: 12px;
    height: 280px;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.transcript-row {
    font-size: 13px;
    line-height: 1.4;
}

.transcript-row .speaker {
    font-family: var(--font-heading);
    font-weight: 700;
    margin-right: 6px;
    text-transform: capitalize;
}

.transcript-row.customer .speaker { color: var(--color-cyan); }
.transcript-row.agent .speaker { color: #111827; }

.analysis-box {
    border: 1px solid var(--border-color);
    background-color: #f9fafb;
    border-radius: 12px;
    height: 280px;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.analysis-item strong {
    font-size: 12px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 6px;
}

.analysis-item p {
    font-size: 13px;
    line-height: 1.5;
}

/* LEADS TAB STYLES */
.leads-table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

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

.leads-table th {
    background-color: rgba(0, 0, 0, 0.02);
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-weight: 600;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

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

.leads-table tr:hover {
    background-color: rgba(0, 0, 0, 0.005);
}

/* SYSTEM STATUS TAB STYLES */
.status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

.status-details-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 20px;
    background-color: #f9fafb;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
}

.status-item .icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.text-cyan { color: var(--color-cyan); }
.text-purple { color: var(--color-purple); }
.text-yellow { color: var(--color-amber); }
.text-green { color: var(--color-emerald); }

.status-item h4 {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

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

.config-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.config-list li {
    font-size: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.config-list li code {
    background-color: rgba(0, 0, 0, 0.03);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--color-cyan);
    font-size: 13px;
}

/* SCROLLBAR CUSTOMIZATION */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* KEYFRAME ANIMATIONS */
@keyframes pulse-glow {
    0% { transform: scale(1); filter: drop-shadow(0 0 5px rgba(225, 29, 72, 0.2)); }
    50% { transform: scale(1.05); filter: drop-shadow(0 0 12px rgba(225, 29, 72, 0.45)); }
    100% { transform: scale(1); filter: drop-shadow(0 0 5px rgba(225, 29, 72, 0.2)); }
}

@keyframes blink-status {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

@keyframes wave-bounce {
    0%, 100% { height: 6px; }
    50% { height: 36px; }
}
