/* ==========================================================================
   Configuração Base e Variáveis
   ========================================================================== */
:root {
    --bg-dark: #07070c;
    --card-bg: rgba(18, 18, 29, 0.65);
    --card-border: rgba(255, 255, 255, 0.07);
    --card-hover-border: rgba(99, 102, 241, 0.25);
    
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #d946ef 100%);
    --accent-gradient: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    --danger-gradient: linear-gradient(135deg, #ef4444 0%, #f43f5e 100%);
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dark: #6b7280;
    
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --glow-primary: 0 0 20px rgba(99, 102, 241, 0.2);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow-x: hidden;
}

/* ==========================================================================
   Elementos Decorativos e Efeito Glow
   ========================================================================== */
.background-decor {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    animation: float 20s infinite alternate ease-in-out;
}

.orb-1 {
    top: -10%;
    left: 10%;
    width: 50vw;
    height: 50vw;
    background: #6366f1;
}

.orb-2 {
    bottom: -10%;
    right: 5%;
    width: 45vw;
    height: 45vw;
    background: #a855f7;
    animation-delay: -5s;
}

.orb-3 {
    top: 40%;
    left: 50%;
    width: 30vw;
    height: 30vw;
    background: #06b6d4;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(5%, 10%) scale(1.1); }
}

/* ==========================================================================
   Layout Principal da App
   ========================================================================== */
.app-container {
    width: 100%;
    max-width: 1200px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    z-index: 10;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 1.5rem;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--glow-primary);
}

.logo-icon i {
    color: white;
    width: 24px;
    height: 24px;
}

.logo-area h1 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    background: linear-gradient(to right, #ffffff, #d1d5db);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tagline {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.host-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-indicator.online {
    background-color: #10b981;
    box-shadow: 0 0 8px #10b981;
}

/* Grid Layout */
.app-main {
    display: grid;
    grid-template-columns: 1.1fr 1.9fr;
    gap: 2rem;
}

@media (max-width: 900px) {
    .app-main {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Componentes Estilizados (Cards de Vidro)
   ========================================================================== */
.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--shadow-premium);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    border-color: var(--card-hover-border);
}

.panel-left {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.panel-right {
    display: flex;
    flex-direction: column;
    height: 100%;
}

h2 {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.header-icon {
    color: var(--primary);
    width: 20px;
    height: 20px;
}

.card-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-dark);
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    margin: 1.25rem 0;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--card-border);
}

.divider::before {
    margin-right: .75em;
}

.divider::after {
    margin-left: .75em;
}

/* ==========================================================================
   Zona de Upload / Dropzone
   ========================================================================== */
.drop-zone {
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.02);
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-icon-wrapper {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: var(--text-muted);
    transition: transform 0.3s ease, color 0.3s ease;
}

.drop-zone:hover .upload-icon-wrapper {
    transform: translateY(-4px);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.upload-text-main {
    font-size: 0.925rem;
    font-weight: 500;
}

.browse-link {
    color: var(--primary);
    text-decoration: underline;
    font-weight: 600;
}

.upload-text-sub {
    font-size: 0.75rem;
    color: var(--text-dark);
    margin-top: 0.5rem;
}

/* Selected File UI */
.selected-file-view {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 12px;
    padding: 1rem;
    text-align: left;
}

.music-icon {
    color: var(--primary);
    width: 28px;
    height: 28px;
}

.file-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.file-name {
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ==========================================================================
   Botões e Controles
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    border: none;
    border-radius: 14px;
    font-family: var(--font-sans);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--glow-primary);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.35);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dark);
    box-shadow: none;
    cursor: not-allowed;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--card-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    padding: 0.25rem;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.btn-remove:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.btn-sm {
    padding: 0.5rem 0.875rem;
    font-size: 0.85rem;
    border-radius: 10px;
    gap: 0.5rem;
}

.btn-sm i {
    width: 14px;
    height: 14px;
}

/* Botão de Gravação */
.btn-record {
    width: 100%;
    padding: 1rem;
    background: rgba(239, 68, 68, 0.1);
    color: #f3f4f6;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-record:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

.btn-record.recording {
    background: var(--danger-gradient);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
    animation: pulse 1.5s infinite alternate;
}

@keyframes pulse {
    0% { transform: scale(1); }
    100% { transform: scale(0.99); }
}

.record-dot {
    width: 8px;
    height: 8px;
    background-color: #ef4444;
    border-radius: 50%;
}

.btn-record.recording .record-dot {
    background-color: white;
    animation: flash 1s infinite;
}

@keyframes flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.record-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.record-timer {
    font-size: 1.125rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #ef4444;
}

/* Audio waves animation */
.wave-visualizer {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 24px;
}

.wave-visualizer .bar {
    width: 3px;
    height: 100%;
    background-color: #ef4444;
    border-radius: 3px;
    animation: bounce 0.6s infinite alternate;
}

.wave-visualizer .bar:nth-child(2) { animation-delay: 0.15s; }
.wave-visualizer .bar:nth-child(3) { animation-delay: 0.3s; }
.wave-visualizer .bar:nth-child(4) { animation-delay: 0.45s; }
.wave-visualizer .bar:nth-child(5) { animation-delay: 0.6s; }

@keyframes bounce {
    0% { height: 4px; }
    100% { height: 24px; }
}

/* ==========================================================================
   Formulários e Ajustes
   ========================================================================== */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.field-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

select option {
    background-color: #12121d;
    color: var(--text-main);
}

.field-helper {
    font-size: 0.75rem;
    color: var(--text-dark);
}

.btn-submit {
    width: 100%;
    padding: 1rem;
    margin-top: 0.5rem;
}

/* ==========================================================================
   Painel de Resultados (Direita)
   ========================================================================== */
.result-card {
    flex: 1;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Empty State */
.empty-state {
    justify-content: center;
    align-items: center;
    text-align: center;
}

.empty-state-content {
    max-width: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.empty-icon-wrapper {
    width: 72px;
    height: 72px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.empty-icon-wrapper i {
    width: 32px;
    height: 32px;
}

.empty-state-content h3 {
    font-size: 1.15rem;
    font-weight: 700;
}

.empty-state-content p {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Processing State */
.processing-state-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 1.25rem;
    text-align: center;
}

.spinner-container {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.premium-spinner {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--primary);
    border-bottom-color: #06b6d4;
    animation: spin 1.5s linear infinite;
}

.spinner-icon {
    color: var(--primary);
    animation: pulseGlow 2s infinite alternate;
}

.spinner-icon i {
    width: 28px;
    height: 28px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulseGlow {
    0% { transform: scale(0.9); opacity: 0.6; }
    100% { transform: scale(1.1); opacity: 1; }
}

.processing-state-content h3 {
    font-size: 1.25rem;
    font-weight: 700;
}

.processing-state-content p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.progress-bar-wrapper {
    width: 100%;
    max-width: 300px;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 999px;
    width: 0%;
    transition: width 0.4s ease;
}

.progress-percent {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
}

/* Success State */
.success-state-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex: 1;
    min-height: 0;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.badge {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.25);
    padding: 0.25rem 0.75rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    margin-right: 0.5rem;
}

.badge-outline {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--card-border);
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Custom Audio Player */
.audio-player-preview {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1rem;
}

.custom-player {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.player-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.player-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.player-btn i {
    width: 18px;
    height: 18px;
}

.player-timeline {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.time-display {
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    font-weight: 500;
    min-width: 32px;
}

.player-slider-container {
    flex: 1;
    display: flex;
    align-items: center;
}

.player-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.player-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    transition: transform 0.1s;
}

.player-slider::-webkit-slider-thumb:hover {
    transform: scale(1.3);
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--card-border);
    gap: 1rem;
}

.tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    padding: 0.75rem 0.5rem;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Tab Content */
.tab-content-container {
    flex: 1;
    min-height: 0; /* Permite scroll */
    display: flex;
    flex-direction: column;
}

.tab-pane {
    display: none;
    height: 100%;
}

.tab-pane.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.transcript-text {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.25rem;
    line-height: 1.7;
    font-size: 0.95rem;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    white-space: pre-wrap;
    text-align: justify;
}

.transcript-segments {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.segment-item {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.segment-item:hover {
    background: rgba(99, 102, 241, 0.05);
    border-color: rgba(99, 102, 241, 0.2);
}

.segment-time {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
    background: rgba(99, 102, 241, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    height: fit-content;
}

.segment-text {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ==========================================================================
   Dropdowns
   ========================================================================== */
.dropdown-wrapper {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #12121d;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    min-width: 180px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 50;
}

.dropdown-menu.active {
    display: flex;
}

.dropdown-item {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.75rem 1rem;
    text-align: left;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

/* Scrollbars customizados */
::-webkit-scrollbar {
    width: 6px;
}

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

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

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

/* Footer Credits */
.app-footer-credits {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-dark);
    margin-top: 1rem;
}

/* ==========================================================================
   Painel de Histórico
   ========================================================================== */
.history-card {
    margin-top: 0.5rem;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-item:hover {
    background: rgba(99, 102, 241, 0.05);
    border-color: rgba(99, 102, 241, 0.2);
}

.history-item-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
    flex: 1;
}

.history-item-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-main);
}

.history-item-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.history-item-meta .dot {
    width: 3px;
    height: 3px;
    background-color: var(--text-dark);
    border-radius: 50%;
}

.history-item-actions {
    display: flex;
    align-items: center;
    margin-left: 0.5rem;
}

.btn-history-delete:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.history-empty {
    text-align: center;
    padding: 1.5rem 1rem;
    color: var(--text-dark);
    font-size: 0.8rem;
    border: 1px dashed var(--card-border);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.1);
}
