/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

/* Header Section */
.header {
    background-color: #212529;
    color: white;
    padding: 3rem 6rem;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-button {
    position: absolute;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255,255,255,0.1);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.back-button:hover {
    background-color: rgba(255,255,255,0.2);
}

.header h1 {
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    flex: 1;
}

.logout-btn {
    position: absolute;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid rgba(220, 53, 69, 0.3);
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: rgba(220, 53, 69, 0.2);
    border-color: #dc3545;
    color: #dc3545;
    text-decoration: none;
}

/* === STATISTICS CARDS === */
.stats-container {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 2rem;
    padding: 2rem;
    margin: 2rem 2rem 2rem;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Individual Cards */
.stat-card {
    margin: 0 2px;
    flex: 1;
    background: white;
    border: 1px solid #2e2e2d;
    border-radius: 6px;
    text-align: center;
    padding: 2rem 1rem 1.5rem;
    position: relative;
    overflow: visible;
}

/* Icon Container (Hexagon shape) */
.stat-icon {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%) rotate(0deg);
    width: 60px;
    height: 60px;
    clip-path: polygon(25% 6%, 75% 6%, 100% 50%, 75% 94%, 25% 94%, 0% 50%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
}

/* Color Variants */
.stat-icon.completed {
    background: #cddc39; /* Lime Green */
}
.stat-icon.abandoned {
    background: #4b4b4b; /* Dark Gray */
}
.stat-icon.in-progress {
    background: #ff9800; /* Orange */
}

/* Labels and Numbers */
.stat-label {
    margin-top: 2.5rem;
    font-weight: 700;
    font-size: 1.1rem;
}

.stat-label.completed {
    color: #cddc39;
}
.stat-label.abandoned {
    color: #4b4b4b;
}
.stat-label.in-progress {
    color: #ff9800;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: #000;
    margin-top: 0.5rem;
}

/* Main Content Area */
.main-content {
    margin: 0 2rem 2rem;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

.content-header {
    background-color: #efefef;
    padding: 1.5rem 2rem;
    border-bottom: 1.5px solid #7a7a7a;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.call-identifier {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
}

/* Two Column Layout */
.content-columns {
    display: flex;
    min-height: 500px;
}

.transcription-column {
    flex: 1;
    padding: 2rem;
    border-right: 1.5px solid #7a7a7a;
}

.call-history-column {
    flex: 1;
    padding: 2rem;
}

.column-header {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #333;
}

/* Transcription Content */
.transcription-content {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    min-height: 300px;
    line-height: 1.8;
    color: #555;
}

/* Call History */
.call-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.current-call-icon {
    width: 12px;
    height: 12px;
    background-color: #FF9800;
    border-radius: 50%;
}

.call-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.call-status.completed {
    background-color: #e8f5e8;
    color: #8BC34A;
}

.call-status.in-progress {
    background-color: #fff3e0;
    color: #FF9800;
}

.call-status.abandoned {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.call-action {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
}

.call-action:hover {
    text-decoration: underline;
}

/* Branding */
.branding {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-text {
    font-weight: 700;
    font-size: 1.1rem;
}

.brand-text.eu {
    color: #333;
}

.brand-logo {
    background-color: #FF9800;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-weight: 700;
}

/* Call Table Styles */

.call-table {
    background-color: rgb(255, 255, 255);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

#phone-number{
    font-weight: bold;
}

.table-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 80px;
    background-color: #efefef;
    border-bottom: 2px solid #e9ecef;
}

.header-cell {
    padding: 1rem;
    font-weight: 700;
    color: #495057;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    border-right: 1px solid #e9ecef;
}

.header-cell:last-child {
    border-right: none;
}

.table-body {
    background-color: rgb(255, 255, 255);
}

.table-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 80px;
    border-bottom: 1px solid #2d2d2d;
    transition: background-color 0.2s ease;
}

.table-row:hover {
    background-color: #f8f9fa;
}

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

.table-cell {
    padding: 1rem;
    display: flex;
    align-items: center;
    border-right: 1px solid #e9ecef;
    min-height: 60px;
}

.table-cell:last-child {
    border-right: none;
    justify-content: center;
}

/* Status styling within table cells */
.table-cell .call-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Responsive table */
@media (max-width: 768px) {
    .table-header,
    .table-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .header-cell,
    .table-cell {
        border-right: none;
        border-bottom: 1px solid #2b2b2b;
        padding: 0.75rem;
    }
    
    .header-cell:last-child,
    .table-cell:last-child {
        border-bottom: none;
    }
    
    .table-cell:last-child {
        justify-content: flex-start;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .stats-container {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .content-columns {
        flex-direction: column;
    }
    
    .transcription-column {
        border-right: none;
        border-right: 1px solid #2b2b2b;
    }
    
    .call-info {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .header {
        padding: 1rem;
    }
    
    .main-content {
        margin: 0 1rem 1rem;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* Visibility Utilities */
.hidden { display: none !important; }

.transcript-entry {
    padding: 0.5rem 0;
    border-bottom: 1px solid #e9ecef;
}

.transcript-entry:last-child {
    border-bottom: none;
}

/* Live transcript styles */
.live-indicator {
    background: #ff4444;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    margin-left: 10px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.live-transcript-section {
    margin-top: 20px;
    border: 2px solid #ff4444;
    border-radius: 8px;
    background: #fff5f5;
}

.live-transcript-header {
    background: #ff4444;
    color: white;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 6px 6px 0 0;
}

.live-transcript-header h4 {
    margin: 0;
    font-size: 14px;
}

.live-status {
    font-size: 12px;
    font-weight: bold;
}

.live-transcript-content {
    max-height: 300px;
    overflow-y: auto;
    padding: 15px;
}

.live-transcript-entry {
    padding: 8px 0;
    border-bottom: 1px solid #ffe0e0;
    animation: slideIn 0.3s ease-in;
}

.live-transcript-entry:last-child {
    border-bottom: none;
}

.live-transcript-entry.new {
    background: #fff0f0;
    padding: 8px 12px;
    border-radius: 4px;
    margin: 4px 0;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#refresh-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #4CAF50;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    z-index: 1000;
    display: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Audio Waveform Styles */
.audio-waveform-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.audio-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.play-pause-btn {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    border: 2px solid #e9ecef;
    background: white;
    color: #495057;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.play-pause-btn:hover {
    border-color: #007bff;
    color: #007bff;
    box-shadow: 0 2px 6px rgba(0,123,255,0.15);
}

.play-pause-btn.playing {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

.play-pause-btn.playing:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.waveform-container {
    flex: 1;
    height: 60px;
    background: white;
    border-radius: 8px;
    padding: 10px;
    border: 1px solid #e9ecef;
}

.audio-waveform {
    height: 100%;
    display: flex;
    align-items: end;
    gap: 3px;
    padding: 5px 0;
}

.waveform-bar {
    background: #6c757d;
    border-radius: 2px;
    min-width: 4px;
    transition: height 0.3s ease;
}

.waveform-container.playing .waveform-bar {
    background: #007bff;
}

.waveform-bar:nth-child(1) { height: 30%; }
.waveform-bar:nth-child(2) { height: 60%; }
.waveform-bar:nth-child(3) { height: 45%; }
.waveform-bar:nth-child(4) { height: 80%; }
.waveform-bar:nth-child(5) { height: 25%; }
.waveform-bar:nth-child(6) { height: 70%; }
.waveform-bar:nth-child(7) { height: 55%; }
.waveform-bar:nth-child(8) { height: 40%; }

/* Spinning icon for in-progress status */
.spinning-icon {
    display: inline-block;
    animation: spin 1s linear infinite;
    margin-right: 5px;
}

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

/* Call History Table (page-specific variants) */
.call-history-table {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.call-history-table .table-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 80px;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

.call-history-table .table-body {
    background: white;
    border-bottom: 1px solid #2b2b2b;
}

.call-history-table .table-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 80px;
    border-bottom: 1px solid #2b2b2b;
    transition: background-color 0.2s ease;
}

.call-history-table .table-row:hover {
    background: #f8f9fa;
}

.call-history-table .table-row:last-child {
    border-bottom: none;
}

.call-history-table .table-cell {
    padding: 1rem;
    display: flex;
    align-items: center;
    border-right: 1px solid #e9ecef;
    min-height: 60px;
}

.call-history-table .table-cell:last-child {
    border-right: none;
    justify-content: center;
}

/* Specific column widths for call details page only */
body.call-details-page .content-columns .transcription-column { flex: 0 0 40%; }
body.call-details-page .content-columns .call-history-column { flex: 0 0 60%; }

/* Login Page */
body.login-page {
    background: #000; /* Fondo negro sólido */
    color: white;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    text-align: center;
    width: 100%;
    max-width: 360px;
}

/* Título */
.login-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #ff9800;
}

/* Display de PIN (los puntitos o input visual) */
.pin-display {
    margin-bottom: 1.5rem;
}

.pin-dots {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.pin-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: background 0.3s ease;
}

.pin-dot.filled {
    background: #ff9800;
}

/* Teclado numérico */
.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    justify-items: center;
}

.keypad-btn {
    width: 80px;
    height: 80px;
    font-size: 1.8rem;
    font-weight: bold;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.keypad-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #ff9800;
    transform: translateY(-2px);
}

/* Botones especiales */
.keypad-btn.clear {
    background: rgba(220, 53, 69, 0.2);
    border-color: #dc3545;
}

.keypad-btn.clear:hover {
    background: rgba(220, 53, 69, 0.3);
}

.keypad-btn.submit {
    background: rgba(40, 167, 69, 0.2);
    border-color: #28a745;
}

.keypad-btn.submit:hover {
    background: rgba(40, 167, 69, 0.3);
}


.filters-bar {
    display: flex;
    justify-content: space-between; /* separates filters (left) and title (right) */
    align-items: center;
    margin-bottom: 1rem;
    padding: 2rem 2rem 0 2rem;
  }
  
  .filters {
    display: flex;
    gap: 1rem;
    align-items: center;
  }
  
  .call-history-title {
    font-weight: 700;
    font-size: 1.2rem;
    color: #2e2e2d;
  }

.filter-input {
    font-size: 1rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    outline: none;
    min-width: 170px;
}
#clear-filters {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    background: #efefef;
    border: 1px solid #bbbbbb;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.15s;
}
#clear-filters:hover {
    background: #e0e0e0;
}

/* Stat cards interactivity */
.stat-card.clickable { cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.stat-card.clickable:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.stat-card.clickable.active { outline: 2px solid #007bff; box-shadow: 0 0 0 4px rgba(0,123,255,0.15); }
