/* ==================== VARIÁVEIS CSS ==================== */
:root {
    --primary-color: #2563eb;
    --danger-color: #dc2626;
    --secondary-color: #6b7280;
    --success-color: #16a34a;
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --border-color: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --radius: 12px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

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

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: linear-gradient(135deg, var(--bg-color) 0%, #1a0f2e 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
}

/* ==================== CONTAINER ==================== */
.container {
    max-width: 1000px;
    margin: 0 auto;
}

/* ==================== HEADER ==================== */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
    border-bottom: 2px solid var(--border-color);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* ==================== SEÇÕES ==================== */
section {
    margin-bottom: 30px;
}

.status-section {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.status-box, .model-status {
    flex: 1;
    min-width: 250px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.1rem;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-indicator.connecting {
    background-color: #f59e0b;
}

.status-indicator.connected {
    background-color: var(--success-color);
}

.status-indicator.disconnected {
    background-color: var(--danger-color);
}

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

/* ==================== AUTENTICAÇÃO ==================== */
.auth-section {
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
}

.auth-box {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    max-width: 400px;
    width: 100%;
}

.auth-box label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.token-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #334155;
    border-radius: 12px;
    background: #0f172a;
    color: #f1f5f9;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    outline: none; /* Ensure no default outline */
}

.token-input:focus {
    outline: none;
    border-color: #2563eb;
}

.token-hint {
    display: block;
    margin-top: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ==================== BOTÕES ==================== */
.controls-section {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 30px;
}

.btn {
    padding: 14px 28px;
    font-size: 1rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

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

.btn-primary:hover:not(:disabled) {
    background: #1d4ed8;
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.5);
    transform: translateY(-2px);
}

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

.btn-danger:hover:not(:disabled) {
    background: #b91c1c;
    box-shadow: 0 0 20px rgba(220, 38, 38, 0.5);
    transform: translateY(-2px);
}

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

.btn-secondary:hover:not(:disabled) {
    background: #4b5563;
    transform: translateY(-2px);
}

.icon {
    font-size: 1.2rem;
}

/* ==================== SEÇÃO DE TRANSCRIÇÃO ==================== */
.transcription-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.transcription-box {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
}

.transcription-box h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.final-text {
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100px;
    padding: 10px;
}

.partial-text {
    color: var(--text-secondary);
    line-height: 1.6;
    min-height: 100px;
    padding: 10px;
    font-style: italic;
}

@media (max-width: 768px) {
    .transcription-section {
        grid-template-columns: 1fr;
    }
}

/* ==================== ESTATÍSTICAS ==================== */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 15px;
    text-align: center;
}

.stat-item label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.stat-item span {
    display: block;
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
}

/* ==================== HISTÓRICO ==================== */
.history-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
}

.history-section h3 {
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.history-box {
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    background: rgba(0, 0, 0, 0.3);
    border-left: 4px solid var(--primary-color);
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 4px;
    animation: slideIn 0.3s ease;
}

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

.history-item .timestamp {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.history-item .text {
    color: var(--text-primary);
    word-break: break-word;
}

.empty-message {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
    font-style: italic;
}

/* ==================== SCROLLBAR CUSTOMIZADO ==================== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--card-bg);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* ==================== ANIMAÇÕES ==================== */
@keyframes recordingPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.btn.recording {
    animation: recordingPulse 0.6s infinite;
}

/* ==================== RESPONSIVIDADE ==================== */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }

    .controls-section {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .status-section {
        flex-direction: column;
    }

    .stats-section {
        grid-template-columns: 1fr;
    }
}
