* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
    -webkit-font-smoothing: antialiased;
    background: #ffffff;
    color: var(--color-text);
    overflow-x: hidden;
    /* Alinhado dinamicamente com a altura real do .top-header via
       js/header-height.js (--header-height). Não precisa mais medir
       e travar um valor fixo em pixel aqui. */
    padding-top: var(--header-height, 84px);
    min-height: 100vh;
}

/* ===== Header ===== */
/* Estilos compartilhados em css/header-shared.css — aqui só ajustes específicos */
.logo-icon img {
    width: 51px;
}

/* ===== Back Button == */
.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    padding: 0.75rem 1.5rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-pill);
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    animation: slideInRight 0.6s ease;
}

.back-button:hover {
    background-color: white;
    color: var(--color-primary);
    transform: translateX(-5px);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3);
}

.back-button svg {
    transition: transform 0.3s ease;
}

.back-button:hover svg {
    transform: translateX(-3px);
}

.container {
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* ===== Background ===== */
.background-animation {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.triangle {
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
}

.triangle-1 {
    top: 0;
    left: 0;
    border-width: 250px 250px 0 0;
    border-color: var(--color-primary) transparent transparent transparent;
    opacity: 0.06;
    transform: translateY(var(--header-height, 84px)); /* alinhado dinamicamente via js/header-height.js */
}

.triangle-2 {
    top: 0;
    right: 0;
    border-width: 0 250px 250px 0;
    border-color: transparent var(--color-primary) transparent transparent;
    opacity: 0.06;
    transform: translateY(var(--header-height, 84px)); /* alinhado dinamicamente via js/header-height.js */
}

.triangle-3 {
    bottom: 0;
    left: 0;
    border-width: 250px 0 0 250px;
    border-color: transparent transparent transparent var(--color-primary);
    opacity: 0.06;
}

.triangle-4 {
    bottom: 0;
    right: 0;
    border-width: 0 0 250px 250px;
    border-color: transparent transparent var(--color-primary) transparent;
    opacity: 0.06;
}

/* ===== Container ===== */
.main-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 10;
}

/* ===== Hero ===== */
.hero-section {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInUp 0.6s ease;
}

.hero-section h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-section p {
    font-size: 1.125rem;
    color: var(--color-text-muted);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Cards ===== */
.card {
    background: white;
    border-radius: 16px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.03);
    border: 1px solid var(--color-border);
    transition: all 0.3s ease;
    animation: fadeInUp 0.6s ease;
}

.card:hover {
    box-shadow: 0 8px 16px rgba(106, 62, 167, 0.1);
}

.card-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.success-icon {
    background: linear-gradient(135deg, #10b981, #34d399);
}

.card h2 {
    text-align: center;
    font-size: 1.75rem;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.card-description {
    text-align: center;
    color: var(--color-text-muted);
    margin-bottom: 2rem;
    font-size: 1rem;
}

/* ===== Upload Zone ===== */
.upload-zone {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    background: var(--color-surface-soft);
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-zone:hover {
    border-color: var(--color-primary);
    background: #faf5ff;
}

.upload-zone.dragover {
    border-color: var(--color-primary);
    background: #faf5ff;
    transform: scale(1.02);
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    color: var(--color-primary);
}

.upload-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text);
}

.upload-hint {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

/* ===== Video Container ===== */
.video-container {
    text-align: center;
}

.video-container video {
    width: 100%;
    max-width: 600px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

/* ===== Buttons ===== */
.btn-analyze, .btn-primary, .btn-secondary, .btn-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    outline: none;
    font-family: inherit;
}

.btn-analyze {
    width: 100%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: white;
    box-shadow: 0 4px 12px rgba(106, 62, 167, 0.3);
    padding: 1.25rem 2rem;
    font-size: 1.125rem;
    margin-bottom: 2rem;
}

.btn-analyze:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(106, 62, 167, 0.4);
}

.btn-analyze:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: white;
    box-shadow: 0 4px 12px rgba(106, 62, 167, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(106, 62, 167, 0.4);
}

.btn-secondary {
    background: white;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}

.btn-secondary:hover {
    background: var(--color-primary);
    color: white;
    transform: translateY(-2px);
}

.btn-remove {
    background: white;
    color: var(--color-danger);
    border: 2px solid var(--color-danger);
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
}

.btn-remove:hover {
    background: var(--color-danger);
    color: white;
}

/* ===== Processing ===== */
.processing-card {
    text-align: center;
}

.spinner-container {
    margin-bottom: 1.5rem;
}

.spinner {
    width: 64px;
    height: 64px;
    margin: 0 auto;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#status {
    font-size: 1.25rem;
    color: #4b5563;
    margin-bottom: 1rem;
}

.progress-bar {
    width: 100%;
    max-width: 400px;
    height: 8px;
    background: var(--color-border);
    border-radius: var(--radius-pill);
    overflow: hidden;
    margin: 0 auto 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light));
    width: 0%;
    transition: width 0.3s ease;
}

.processing-text {
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

/* ===== Results ===== */
.resultado-content {
    background: var(--color-surface-soft);
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    border-left: 4px solid var(--color-primary);
    text-align: left;
}

.resultado-content pre {
    white-space: pre-wrap;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.8;
    color: #374151;
    margin: 0;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.action-buttons button {
    flex: 1;
}

/* ===== Info Section ===== */
.info-section {
    margin: 4rem 0 2rem;
}

.info-section h3 {
    text-align: center;
    font-size: 2rem;
    color: var(--color-text);
    margin-bottom: 2rem;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.step-card {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    transition: all 0.3s ease;
}

.step-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(106, 62, 167, 0.15);
    border-color: var(--color-primary);
}

.step-number {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
}

.step-card h4 {
    font-size: 1.25rem;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.step-card p {
    color: var(--color-text-muted);
    line-height: 1.6;
}

/* ===== Features ===== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1.5rem;
}

.feature-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(106, 62, 167, 0.15);
    border-color: var(--color-primary);
}

.feature-card svg {
    color: var(--color-primary);
    margin-bottom: 1rem;
}

.feature-card h4 {
    font-size: 1.125rem;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .main-container {
        padding: 1rem;
    }

    .hero-section h1 {
        font-size: 2rem;
    }

    .hero-section p {
        font-size: 1rem;
    }

    .card {
        padding: 1.5rem;
    }

    .upload-zone {
        padding: 2rem 1rem;
    }

    .action-buttons {
        flex-direction: column;
    }

    .steps-grid, .features-grid {
        grid-template-columns: 1fr;
    }

    body {
        padding-top: 100px;
    }
}
/* ===== Abas Upload / Gravar ===== */
.video-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--color-border);
}

.tab-btn {
    padding: 0.6rem 1.4rem;
    border: none;
    background: none;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    font-family: inherit;
    border-radius: 0;
}

.tab-btn.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.tab-btn:hover { color: var(--color-primary); }

/* ===== Gravação ===== */
.gravacao-container { text-align: center; }

.camera-preview {
    width: 100%;
    max-width: 560px;
    border-radius: 12px;
    background: var(--color-text);
    margin-bottom: 1rem;
    min-height: 200px;
}

.gravacao-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-cam {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: 2px solid var(--color-primary);
    background: white;
    color: var(--color-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.btn-cam:hover { background: var(--color-primary); color: white; }

.btn-gravar { border-color: var(--color-danger); color: var(--color-danger); }
.btn-gravar:hover { background: var(--color-danger); color: white; }
.btn-gravar.gravando { background: var(--color-danger); color: white; animation: pulse 1.2s infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.7; }
}

.gravacao-timer {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-danger);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
}

/* ===== Diagnóstico ===== */
.diagnostico-box {
    background: var(--color-surface-soft);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    margin: 1.5rem 0;
    border: 1px solid var(--color-border);
}

.diag-resultado {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.diag-icone {
    font-size: 1.6rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.diag-texto {
    font-size: 1.4rem;
    font-weight: 700;
}

.diag-boa     .diag-icone { background: #d1fae5; color: var(--color-success); }
.diag-boa     .diag-texto { color: var(--color-success); }
.diag-mediana .diag-icone { background: #fef3c7; color: var(--color-warning); }
.diag-mediana .diag-texto { color: var(--color-warning); }
.diag-ruim    .diag-icone { background: #fee2e2; color: var(--color-danger-dark); }
.diag-ruim    .diag-texto { color: var(--color-danger-dark); }

.diag-obs {
    list-style: none;
    padding: 0;
    margin: 0;
    border-top: 1px solid var(--color-border);
    padding-top: 1rem;
}

.diag-obs li {
    font-size: 0.92rem;
    color: #374151;
    padding: 0.35rem 0;
    border-bottom: 1px solid #f3f4f6;
    line-height: 1.6;
}

.diag-obs li:last-child { border-bottom: none; }

/* ===== Comentário IA ===== */
.ia-comentario-box {
    background: linear-gradient(135deg, #faf5ff, #f5f0fe);
    border: 1.5px solid #c4b5fd;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 0.5rem 0 1.5rem;
}

.ia-comentario-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.ia-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.ia-nome {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: 0.02em;
}

.ia-comentario-texto {
    font-size: 0.95rem;
    color: #374151;
    line-height: 1.75;
    white-space: pre-wrap;
}

.ia-loading {
    display: flex;
    gap: 6px;
    padding: 0.5rem 0;
}

.ia-dot {
    width: 8px;
    height: 8px;
    background: var(--color-primary);
    border-radius: 50%;
    animation: iaBounce 1.2s infinite;
}

.ia-dot:nth-child(2) { animation-delay: 0.2s; }
.ia-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes iaBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40%           { transform: scale(1);   opacity: 1;   }
}
