/* Reset e variáveis */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* BriskMail Navy Theme */
    --primary: #211f60;
    --primary-dark: #1a1850;
    --secondary: #3730a3;
    --success: #34d399;
    --danger: #f87171;
    --warning: #fbbf24;

    /* Dark Navy Background Colors */
    --bg-primary: #0d0f1c;
    --bg-secondary: #13162a;
    --bg-tertiary: #1b2038;
    --bg-card: #13162a;

    /* Neutral Text Colors */
    --text-primary: #eef0f8;
    --text-secondary: #b0b8d4;
    --text-muted: #6b7599;

    /* Border Colors */
    --border-color: #252d4a;
    --border-hover: #333d61;
}

[data-theme="light"] {
    --bg-primary: #f5f0ea;
    --bg-secondary: #ece7e0;
    --bg-tertiary: #e3ddd5;
    --bg-card: #ece7e0;
    --text-primary: #1c1410;
    --text-secondary: #4a3f35;
    --text-muted: #7a6f65;
    --border-color: #d0c9c0;
    --border-hover: #bcb5ac;
}

[data-theme="light"] .main-content {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-primary);
    position: relative;
}

.theme-toggle {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.3s;
}

.theme-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: rotate(20deg);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
}

.subtitle {
    font-size: 1.125rem;
    opacity: 0.9;
}

/* Main Content */
.main-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    padding: 2rem;
    animation: fadeIn 0.5s ease;
}

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

/* Maintenance Banner */
.maintenance-banner {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    margin-bottom: 2rem;
    padding: 1rem 1.25rem;
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-radius: 0.5rem;
    animation: fadeIn 0.3s ease;
}

.maintenance-icon {
    color: var(--warning);
    flex-shrink: 0;
}

.maintenance-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
    min-width: 0;
}

.maintenance-text strong {
    color: var(--warning);
    font-size: 0.9375rem;
}

.maintenance-text span {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
}

.maintenance-link {
    flex-shrink: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--warning);
    text-decoration: none;
    white-space: nowrap;
    opacity: 0.85;
    transition: opacity 0.2s;
}

.maintenance-link:hover {
    opacity: 1;
    text-decoration: underline;
}

@media (max-width: 600px) {
    .maintenance-banner {
        flex-direction: column;
        align-items: flex-start;
    }

    .maintenance-link {
        align-self: flex-end;
    }
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.3s;
}

.tab:hover {
    color: var(--primary);
    background: var(--bg-tertiary);
}

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

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    transition: border-color 0.3s;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.char-count {
    text-align: right;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Upload Area */
.upload-area {
    border: 3px dashed var(--border-color);
    border-radius: 0.75rem;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--bg-secondary);
}

.upload-area:hover {
    border-color: var(--primary);
    background: var(--bg-tertiary);
}

.upload-area svg {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.upload-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

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

.selected-file {
    margin: 1rem 0;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 0.5rem;
    display: none;
}

.selected-file.show {
    display: block;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(33, 31, 96, 0.3);
}

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

/* Error Banner */
.error-banner {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid var(--danger);
    border-radius: 0.5rem;
    color: var(--danger);
    font-size: 0.9375rem;
}

.error-banner.show {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.error-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--danger);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.25rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.error-close:hover {
    opacity: 1;
}

/* Loading */
.loading {
    display: none;
    text-align: center;
    padding: 3rem 0;
}

.loading.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 1rem;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Result Section */
.result-section {
    display: none;
    margin-top: 2rem;
}

.result-section.show {
    display: block;
    animation: fadeIn 0.5s ease;
}

.result-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 2rem;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.result-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.badge {
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge.produtivo {
    background: var(--success);
    color: white;
}

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

/* Confidence Bar */
.confidence-bar {
    margin-bottom: 2rem;
}

.confidence-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.progress-bar {
    height: 1rem;
    background: var(--bg-tertiary);
    border-radius: 0.5rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 1s ease, background 0.5s ease;
    border-radius: 0.5rem;
}

.progress-fill.confidence-high {
    background: linear-gradient(90deg, var(--success), #6ee7b7);
}

.progress-fill.confidence-medium {
    background: linear-gradient(90deg, var(--warning), #fde68a);
}

.progress-fill.confidence-low {
    background: linear-gradient(90deg, var(--danger), #fca5a5);
}

/* Reasoning */
.reasoning {
    background: var(--bg-tertiary);
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.reasoning h3 {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.reasoning p {
    color: var(--text-muted);
}

/* Suggestions */
.suggestions h3 {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.suggestion-card {
    background: var(--bg-tertiary);
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
}

.suggestion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.suggestion-title {
    font-weight: 600;
    color: var(--text-primary);
}

.suggestion-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.suggestion-tone {
    padding: 0.25rem 0.75rem;
    background: var(--primary);
    color: var(--bg-primary);
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.btn-copy {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-copy:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-copy.copied {
    border-color: var(--success);
    color: var(--success);
}

.suggestions-empty {
    color: var(--text-muted);
    font-size: 0.9375rem;
    padding: 0.75rem 0;
}

.suggestion-content {
    color: var(--text-muted);
    line-height: 1.6;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 3rem;
    color: var(--text-secondary);
}

.footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.footer a:hover {
    color: var(--secondary);
    text-decoration: underline;
}

.tech-stack {
    margin-top: 0.5rem;
    opacity: 0.8;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .logo h1 {
        font-size: 2rem;
    }

    .main-content {
        padding: 1.5rem;
    }

    .tabs {
        flex-direction: column;
    }

    .result-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}

/* Footer Links */
.footer-links {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.footer-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.3s;
}

.footer-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

.footer-btn svg {
    transition: transform 0.3s;
}

.footer-btn:hover svg {
    transform: scale(1.1);
}

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

.history-header h3 {
    color: var(--text-primary);
    font-size: 1.25rem;
}

.btn-clear-history {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--danger);
    border-radius: 0.5rem;
    color: var(--danger);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-clear-history:hover {
    background: var(--danger);
    color: var(--bg-primary);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 600px;
    overflow-y: auto;
}

.empty-history {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-history svg {
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-history p {
    margin-bottom: 0.5rem;
}

.empty-hint {
    font-size: 0.875rem;
    opacity: 0.7;
}

.history-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    transition: all 0.3s;
}

.history-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

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

.history-item-preview {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.history-item-footer {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

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

/* Category badge (result + history) */
.badge.category-badge {
    background: var(--primary);
    color: var(--bg-primary);
    text-transform: none;
    font-size: 0.8125rem;
    font-weight: 600;
}

/* Result meta row (priority + action) */
.result-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

/* Priority tag */
.priority-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
}

.priority-tag--high {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

.priority-tag--normal {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

.priority-tag--low {
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
}

/* Action tag */
.action-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
}

.action-tag--yes {
    background: rgba(96, 165, 250, 0.15);
    color: #60a5fa;
}

.action-tag--no {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

/* About Tab */
.about-section {
    margin-bottom: 2.5rem;
}

.about-section:last-child {
    margin-bottom: 0;
}

.about-section-title {
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

/* Hero */
.about-hero {
    text-align: center;
    padding: 1rem 0 0.5rem;
}

.about-hero-logo {
    margin-bottom: 1rem;
}

.about-hero-title {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.about-hero-description {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.75;
    max-width: 560px;
    margin: 0 auto;
}

.about-hero-description strong {
    color: var(--text-primary);
}

/* Steps */
.about-steps {
    display: flex;
    gap: 1rem;
}

.about-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
    border-radius: 0.5rem;
    padding: 1.25rem;
}

.about-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--bg-primary);
    font-size: 0.875rem;
    font-weight: 700;
    flex-shrink: 0;
}

.about-step-body {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.about-step-icon {
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.about-step-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.about-step-description {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.about-step-description code {
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 0.8125rem;
    background: var(--bg-primary);
    color: var(--primary);
    padding: 0.1rem 0.3rem;
    border-radius: 0.25rem;
}

/* Stack */
.about-stack {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.about-stack-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    transition: border-color 0.3s;
}

.about-stack-item:hover {
    border-color: var(--border-hover);
}

.about-stack-icon {
    color: var(--primary);
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.about-stack-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

.about-stack-description {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Author */
.about-author {
    text-align: center;
    padding: 1rem 0;
}

.about-author-avatar {
    margin-bottom: 1rem;
}

.about-author-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.about-author-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
}

.about-links {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* About responsivo */
@media (max-width: 768px) {
    .about-steps {
        flex-direction: column;
    }

    .about-stack {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Responsividade */
@media (max-width: 640px) {
    .footer-links {
        flex-direction: column;
        width: 100%;
        max-width: 200px;
        margin: 0 auto 1.5rem;
    }
    
    .footer-btn {
        width: 100%;
        justify-content: center;
    }
    
    .history-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .btn-clear-history {
        justify-content: center;
    }

    .about-stack {
        grid-template-columns: 1fr;
    }

    .about-links {
        flex-direction: column;
        align-items: center;
    }

    .about-links .footer-btn {
        width: 100%;
        max-width: 200px;
        justify-content: center;
    }
}