:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a24;
    --accent: #00d4aa;
    --accent-dim: rgba(0, 212, 170, 0.15);
    --accent-glow: rgba(0, 212, 170, 0.4);
    --text-primary: #f0f0f0;
    --text-secondary: #8888a0;
    --text-muted: #555566;
    --danger: #ff5566;
    --warning: #ffaa33;
    --border: rgba(255, 255, 255, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

/* ===== HEADER ===== */
.header {
    position: sticky;
    top: 0;
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

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

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), #00a888);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

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

/* ===== BOTONES DE CONTROL ===== */
.control-buttons {
    display: flex;
    gap: 8px;
    margin-left: 8px;
}

.btn-start {
    background: var(--accent);
    color: var(--bg-primary);
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}

.btn-start:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--accent-glow);
}

.btn-start:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-stop {
    background: var(--danger);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}

.btn-stop:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 85, 102, 0.4);
}

.btn-stop:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== STATUS BADGE ===== */
.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--accent-dim);
    border: 1px solid rgba(0, 212, 170, 0.3);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
}

.status-badge.disconnected {
    background: rgba(255, 85, 102, 0.15);
    border-color: rgba(255, 85, 102, 0.3);
    color: var(--danger);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s infinite;
}

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

.header-stats {
    display: flex;
    gap: 24px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ===== LAYOUT ===== */
.app-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 69px);
}

@media (min-width: 1024px) {
    .app-container {
        flex-direction: row;
    }
    
    .header-stats {
        display: flex;
    }
}

@media (max-width: 1023px) {
    .header-stats {
        display: none;
    }
    
    .control-buttons {
        margin-left: auto;
    }
}

/* ===== PANEL TRANSCRIPCIÓN ===== */
.transcription-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

@media (min-width: 1024px) {
    .transcription-panel {
        flex: 1.2;
        border-right: 1px solid var(--border);
    }
}

.transcription-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.transcription-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(255, 85, 102, 0.15);
    border-radius: 4px;
    font-size: 11px;
    color: var(--danger);
    font-weight: 700;
    animation: liveGlow 2s infinite;
}

@keyframes liveGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 85, 102, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(255, 85, 102, 0); }
}

.live-dot {
    width: 6px;
    height: 6px;
    background: var(--danger);
    border-radius: 50%;
}

/* ===== ÁREA DE TRANSCRIPCIÓN ===== */
.lyrics-area {
    flex: 1;
    overflow-y: auto;
    padding: 30px 24px;
    background: 
        radial-gradient(ellipse at 20% 0%, rgba(0, 212, 170, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(0, 100, 212, 0.03) 0%, transparent 50%),
        var(--bg-primary);
}

.lyrics-area::-webkit-scrollbar {
    width: 6px;
}

.lyrics-area::-webkit-scrollbar-track {
    background: transparent;
}

.lyrics-area::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

/* Estado vacío */
.empty-state {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
}

.empty-icon {
    font-size: 72px;
    margin-bottom: 24px;
    opacity: 0.2;
    filter: grayscale(100%);
}

.empty-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-subtitle {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Utterance actual */
.current-utterance {
    font-size: 36px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-primary);
    text-align: center;
    margin: 20px 0 40px;
    padding: 30px;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    border: 1px solid var(--border);
    border-radius: 16px;
    position: relative;
    animation: fadeInScale 0.4s ease;
    box-shadow: 
        0 4px 30px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.current-utterance::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 20%;
    right: 20%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    border-radius: 2px;
}

.current-utterance.listening::after {
    content: '│';
    animation: cursorBlink 1s infinite;
    margin-left: 4px;
    color: var(--accent);
}

@keyframes cursorBlink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Historial */
.history-section {
    margin-top: 30px;
}

.history-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.history-item {
    padding: 14px 18px;
    margin-bottom: 10px;
    background: var(--bg-secondary);
    border-radius: 10px;
    border-left: 3px solid var(--accent);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-secondary);
    animation: slideIn 0.3s ease;
}

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

/* ===== PANEL NOTAS ===== */
.notes-panel {
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
}

@media (min-width: 1024px) {
    .notes-panel {
        flex: 1;
        min-width: 400px;
        max-width: 500px;
    }
    
    .notes-handle {
        display: none;
    }
}

@media (max-width: 1023px) {
    .notes-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 70vh;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.5);
        transform: translateY(calc(100% - 56px));
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 2000;
    }
    
    .notes-panel.expanded {
        transform: translateY(0);
    }
}

.notes-handle {
    padding: 14px 20px;
    text-align: center;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}

.handle-bar {
    width: 40px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 2px;
    margin: 0 auto 10px;
}

.handle-title {
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.notes-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-tertiary);
}

@media (max-width: 1023px) {
    .notes-header {
        display: none;
    }
}

.notes-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.notes-toolbar {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
}

.btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-copy {
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid rgba(0, 212, 170, 0.2);
}

.btn-copy:hover {
    background: rgba(0, 212, 170, 0.25);
    box-shadow: 0 0 20px var(--accent-glow);
}

.btn-save {
    background: rgba(100, 150, 255, 0.15);
    color: #6496ff;
    border: 1px solid rgba(100, 150, 255, 0.2);
}

.btn-save:hover {
    background: rgba(100, 150, 255, 0.25);
}

.btn-clear {
    background: rgba(255, 85, 102, 0.1);
    color: var(--danger);
    border: 1px solid rgba(255, 85, 102, 0.2);
}

.btn-clear:hover {
    background: rgba(255, 85, 102, 0.2);
}

.notes-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.notes-textarea {
    flex: 1;
    width: 100%;
    padding: 20px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.8;
    font-family: 'Outfit', sans-serif;
    resize: none;
    outline: none;
}

.notes-textarea::placeholder {
    color: var(--text-muted);
}

.notes-textarea::-webkit-scrollbar {
    width: 6px;
}

.notes-textarea::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

.notes-footer {
    padding: 12px 20px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    top: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--accent);
    color: var(--bg-primary);
    padding: 12px 28px;
    border-radius: 30px;
    box-shadow: 0 4px 30px var(--accent-glow);
    font-weight: 600;
    font-size: 14px;
    z-index: 10000;
    animation: toastIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.toast.error {
    background: var(--danger);
    box-shadow: 0 4px 30px rgba(255, 85, 102, 0.4);
}

@keyframes toastIn {
    to { transform: translateX(-50%) translateY(0); }
}

/* ===== MOBILE ===== */
@media (max-width: 767px) {
    .current-utterance {
        font-size: 26px;
        padding: 20px;
    }
    
    .logo-text {
        display: none;
    }
    
    .header {
        padding: 12px 16px;
    }
    
    .control-buttons {
        gap: 6px;
    }
    
    .btn-start,
    .btn-stop {
        padding: 6px 12px;
        font-size: 12px;
    }
}