/* ==========================================
   ENIDH - Comunicação Social
   Main Stylesheet
   ========================================== */

/* Base Reset & Variables */
:root {
    /* Primary Colors */
    --primary-dark: #0d2137;
    --primary: #1e4a6e;
    --primary-light: #2d6a9f;
    --accent: #5ba3d9;
    
    /* Neutral Colors */
    --white: #ffffff;
    --gray-50: #f0f4f8;
    --gray-100: #e2e8f0;
    --gray-300: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #5a6f7d;
    --text-dark: #1e3a5f;
    
    /* Error Colors */
    --error-bg: #fee2e2;
    --error-border: #fecaca;
    --error-text: #dc2626;
    
    /* Success Colors */
    --success-bg: #dcfce7;
    --success-border: #bbf7d0;
    --success-text: #16a34a;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 2.5rem;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --radius-xl: 12px;
    --radius-2xl: 16px;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.2);
    --shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.12);
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-dark);
    min-height: 100vh;
    line-height: 1.5;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* ==========================================
   Header Styles
   ========================================== */
header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    padding: 1.25rem var(--spacing-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

header.transparent {
    background: transparent;
    box-shadow: none;
}

.logo {
    color: var(--white);
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-decoration: none;
}

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

.header-btn {
    background-color: var(--white);
    color: var(--primary);
    border: none;
    padding: 0.625rem var(--spacing-lg);
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    display: inline-block;
}

.header-btn:hover {
    background-color: var(--accent);
    color: var(--white);
    transform: translateY(-1px);
}

.back-btn {
    color: var(--white);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    transition: background-color var(--transition-fast);
}

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

/* ==========================================
   Button Styles
   ========================================== */
.btn {
    display: inline-block;
    padding: 0.875rem var(--spacing-2xl);
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    border: none;
    text-align: center;
}

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

.btn-primary:hover {
    background-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 74, 110, 0.3);
}

.btn-full {
    width: 100%;
}

/* ==========================================
   Form Styles
   ========================================== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    color: var(--text-dark);
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    font-size: 0.9375rem;
}

.form-group input {
    width: 100%;
    padding: 0.875rem var(--spacing-md);
    border: 2px solid var(--gray-100);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    color: var(--text-dark);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(91, 163, 217, 0.2);
}

.form-group input::placeholder {
    color: var(--gray-300);
}

.form-group input.error {
    border-color: var(--error-text);
}

.form-group input.success {
    border-color: var(--success-text);
}

.form-group .helptext {
    display: block;
    color: var(--gray-500);
    font-size: 0.8125rem;
    margin-top: 0.375rem;
    line-height: 1.4;
}

.form-group .helptext ul {
    margin: var(--spacing-xs) 0 0 var(--spacing-md);
    padding: 0;
    list-style: disc;
}

.form-group .helptext li {
    margin-bottom: 0.125rem;
}

.form-group .field-error {
    color: var(--error-text);
    font-size: 0.8125rem;
    margin-top: 0.375rem;
    display: block;
}

.form-group .errorlist {
    color: var(--error-text);
    font-size: 0.8125rem;
    margin-top: 0.375rem;
    list-style: none;
    padding: 0;
}

/* ==========================================
   Alert / Message Styles
   ========================================== */
.alert {
    padding: 0.875rem var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
    font-size: 0.875rem;
    border: 1px solid;
}

.alert-error {
    background-color: var(--error-bg);
    color: var(--error-text);
    border-color: var(--error-border);
}

.alert-success {
    background-color: var(--success-bg);
    color: var(--success-text);
    border-color: var(--success-border);
}

.alert ul {
    margin: var(--spacing-sm) 0 0 1.25rem;
    padding: 0;
    list-style: disc;
}

.alert li {
    margin-bottom: var(--spacing-xs);
}

.alert li:last-child {
    margin-bottom: 0;
}

/* ==========================================
   Responsive Utilities
   ========================================== */
@media (max-width: 600px) {
    header {
        padding: var(--spacing-md);
    }

    .logo {
        font-size: 1.25rem;
    }
}

/* ==========================================
   Toast Notification
   ========================================== */
.toast {
    position: fixed;
    top: 24px;
    right: 24px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(59, 130, 246, 0.18);
    border-radius: var(--radius-2xl);
    padding: 14px 18px;
    box-shadow:
        0 10px 30px rgba(37, 99, 235, 0.12),
        0 2px 10px rgba(0, 0, 0, 0.04);
    z-index: 9999;
    opacity: 0;
    transform: translateY(-10px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: var(--white);
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    flex-shrink: 0;
}

.toast-message {
    color: var(--primary-dark);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Toast semantic variants — used by utils.js showToast() */
.toast--success {
    border-color: var(--success-border);
}
.toast--success .toast-icon {
    background: linear-gradient(135deg, var(--success-text), #15803d);
}
.toast--success .toast-message {
    color: #14532d;
}

.toast--error {
    border-color: var(--error-border);
}
.toast--error .toast-icon {
    background: linear-gradient(135deg, var(--error-text), #b91c1c);
}
.toast--error .toast-message {
    color: #7f1d1d;
}

.toast--info .toast-icon {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
}

/* ==========================================
   Shared Utility Classes
   ==========================================
   These replace duplicated rules that were
   scattered across individual page stylesheets.
   ========================================== */

/* -- Page content wrapper --
   Replaces .editor-feed, .notif-page, .settings-page etc.
   Usage: add class="page-content" alongside the existing
   semantic class; the individual file only overrides what differs
   (e.g. a different max-width). */
.page-content {
    flex: 1;
    padding: var(--spacing-xl);
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
}

/* -- Pill badge / count --
   Replaces .editor-count, .notif-count, .comments-count etc.
   Usage: class="badge-pill" or class="badge-pill editor-count" */
.badge-pill {
    background: var(--primary);
    color: var(--white);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    display: inline-block;
}

/* -- Section header with primary underline --
   Replaces .editor-section-header, .settings-header etc.
   Usage: class="section-header" */
.section-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--primary);
    margin-bottom: var(--spacing-sm);
}

/* -- AI risk level modifiers --
   Replaces .ai-risk-badge--* in editor.css and
   .settings-ai-badge--* in definicoes.css.
   Usage: class="<shape-class> risk-low" */
.risk-ideal,
.risk-low    { background: #d1fae5; color: #065f46; }
.risk-medium { background: #fef9c3; color: #854d0e; }
.risk-high   { background: #ffedd5; color: #9a3412; }
.risk-trash  { background: #fee2e2; color: #991b1b; }

/* -- Password strength bar --
   Replaces .strength-bar* in auth.css and
   .pw-strength-* in account.css. */
.strength-bar {
    height: 4px;
    background: var(--gray-100);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: var(--spacing-xs);
}

.strength-bar-fill {
    height: 100%;
    width: 0;
    border-radius: 2px;
    transition: width var(--transition-normal), background-color var(--transition-normal);
}

.strength-bar-fill.weak   { width: 33%;  background: var(--error-text); }
.strength-bar-fill.medium { width: 66%;  background: #f59e0b; }
.strength-bar-fill.strong { width: 100%; background: var(--success-text); }

.strength-text {
    font-size: 0.75rem;
    color: var(--gray-500);
}
.strength-text.weak   { color: var(--error-text); }
.strength-text.medium { color: #f59e0b; }
.strength-text.strong { color: var(--success-text); }

/* -- Empty state --
   Replaces .empty-state in dashboard.css, landing.css, noticia.css.
   Page-specific files keep only overrides (padding, font). */
.empty-state {
    text-align: center;
    padding: var(--spacing-2xl) var(--spacing-xl);
    color: var(--gray-500);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: var(--spacing-md);
    opacity: 0.4;
}

.empty-state h3 {
    font-size: 1.125rem;
    color: var(--text-dark);
    margin-bottom: var(--spacing-sm);
}

.empty-state p {
    font-size: 0.9375rem;
}

/* ==========================================
   Dark Theme — Variable Overrides
   Applied via [data-theme="dark"] on <html>.
   The sidebar gradient uses --primary-dark/--primary
   which are already dark, so they need no override.
   --white is intentionally NOT overridden here because
   it is used for text/icons on dark backgrounds (sidebar,
   header buttons, etc.). Surface backgrounds that rely on
   var(--white) are patched in dashboard.css instead.
   ========================================== */
[data-theme="dark"] {
    /* Page & structural backgrounds */
    --gray-50:  #0f1822;
    /* Card borders, input borders, dividers */
    --gray-100: #1e2d3f;
    /* Placeholder text, disabled icons */
    --gray-300: #4a6580;
    /* Secondary / muted text */
    --gray-500: #7a9bb5;
    /* Slightly-brighter secondary text */
    --gray-600: #9abacf;
    /* Primary body text */
    --text-dark: #cfe0ef;

    /* Semantic feedback — softer on dark backgrounds */
    --error-bg:      rgba(239, 68,  68,  0.1);
    --error-border:  rgba(239, 68,  68,  0.25);
    --error-text:    #f87171;

    --success-bg:     rgba(34, 197, 94, 0.1);
    --success-border: rgba(34, 197, 94, 0.25);
    --success-text:   #4ade80;
}

/* ── Form inputs ── */
[data-theme="dark"] .form-group input {
    background-color: #16202d;
    color: var(--text-dark);
}

/* ── Toast ── */
[data-theme="dark"] .toast {
    background: rgba(18, 28, 40, 0.96);
    border-color: rgba(91, 163, 217, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 2px 10px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .toast-message {
    color: var(--text-dark);
}

/* ── AI risk badges (shared across editor + definicoes) ── */
[data-theme="dark"] .risk-ideal,
[data-theme="dark"] .risk-low    { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }
[data-theme="dark"] .risk-medium { background: rgba(245, 158,  11, 0.15); color: #fcd34d; }
[data-theme="dark"] .risk-high   { background: rgba(249, 115,  22, 0.15); color: #fdba74; }
[data-theme="dark"] .risk-trash  { background: rgba(239,  68,  68, 0.15); color: #fca5a5; }