/**
 * Inteligência Eleitoral - Estilos
 * Design System
 */

/* ==========================================
   CSS Variables
   ========================================== */
:root {
    /* Cores principais */
    --primary: #7c3aed;
    --primary-hover: #6d28d9;
    --secondary: #10b981;
    --secondary-hover: #059669;
    
    /* Cores de status */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    /* Cores de fundo */
    --bg-body: #0f172a;
    --bg-sidebar: #1e293b;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --bg-hover: #334155;
    
    /* Cores de texto */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Bordas */
    --border-color: #334155;
    --border-radius: 8px;
    --border-radius-lg: 12px;
    
    /* Sombras */
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    
    /* Sidebar */
    --sidebar-width: 260px;
    
    /* Transições */
    --transition: all 0.2s ease;
}

/* ==========================================
   Reset & Base
   ========================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

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

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

/* ==========================================
   Auth Layout (Login)
   ========================================== */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-body) 0%, #1e1b4b 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 1rem;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    font-size: 3.5rem;
    margin-bottom: 1rem;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

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

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.login-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
}

/* ==========================================
   Form Elements
   ========================================== */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

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

.label-icon {
    font-size: 1rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

input::placeholder {
    color: var(--text-muted);
}

/* ==========================================
   Buttons
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

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

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #7c3aed 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    color: var(--text-primary);
}

.btn-block {
    width: 100%;
}

/* ==========================================
   Alerts
   ========================================== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fcd34d;
}

/* ==========================================
   App Layout
   ========================================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

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

.sidebar-title {
    font-size: 1rem;
    font-weight: 600;
}

.sidebar-user {
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 500;
    font-size: 0.875rem;
}

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

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    display: block;
    padding: 0.5rem 1.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    transition: var(--transition);
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: rgba(124, 58, 237, 0.15);
    color: var(--primary);
    border-right: 3px solid var(--primary);
}

.nav-icon {
    font-size: 1.1rem;
}

/* Submenu Styles */
.nav-item-with-submenu {
    position: relative;
    display: block;
}

.nav-link-toggle {
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
}

.nav-arrow {
    margin-left: auto;
    font-size: 0.6rem;
    transition: transform 0.3s ease;
    opacity: 0.6;
}

.nav-link-toggle.open .nav-arrow {
    transform: rotate(90deg);
}

.nav-submenu {
    display: block;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: rgba(0, 0, 0, 0.2);
}

.nav-submenu.open {
    max-height: 250px;
}

.nav-sublink {
    display: flex !important;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    transition: var(--transition);
    border-left: 2px solid transparent;
    text-decoration: none;
}

.nav-sublink:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-left-color: var(--text-muted);
}

.nav-sublink.active {
    background: rgba(124, 58, 237, 0.1);
    color: var(--primary);
    border-left-color: var(--primary);
}

.nav-subicon {
    font-size: 0.85rem;
    opacity: 0.8;
    width: 1.2rem;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--border-radius);
    color: #fca5a5;
    font-size: 0.875rem;
    transition: var(--transition);
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-menu {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Header User Menu */
.header-user-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.header-user-name {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
}

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

.btn-user-menu {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
}

.btn-user-menu:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

/* Dropdown Menu */
.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    min-width: 200px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    z-index: 200;
}

.user-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    transition: var(--transition);
}

.dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dropdown-item-danger {
    color: #fca5a5;
}

.dropdown-item-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
}

.dropdown-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 0.25rem 0;
}

.page-content {
    flex: 1;
    padding: 1.5rem;
}

/* ==========================================
   Welcome Page
   ========================================== */
.welcome-container {
    display: flex;
    justify-content: center;
}

.welcome-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    max-width: 800px;
    width: 100%;
}

.welcome-illustration {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    padding: 1.5rem;
    display: flex;
    justify-content: center;
}

.welcome-illustration svg {
    max-width: 100%;
    height: auto;
}

.welcome-content {
    padding: 2rem;
}

.welcome-content h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.welcome-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.feature-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-input);
    border-radius: var(--border-radius);
}

.feature-icon {
    font-size: 1.5rem;
}

.feature-text strong {
    display: block;
    margin-bottom: 0.25rem;
}

.feature-text p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
}

.welcome-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ==========================================
   Config Pages (Alterar Dados/Senha)
   ========================================== */
.config-container {
    display: flex;
    justify-content: center;
}

.config-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    max-width: 600px;
    width: 100%;
}

.config-card-narrow {
    max-width: 450px;
}

.config-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
}

.config-header h2 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.config-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
}

.config-form {
    padding: 2rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Password Input with Toggle */
.input-password {
    position: relative;
    display: flex;
}

.input-password input {
    padding-right: 3rem;
}

.btn-toggle-password {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 3rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: var(--transition);
}

.btn-toggle-password:hover {
    opacity: 1;
}

/* Password Strength Indicator */
.password-strength {
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.strength-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-input);
    border-radius: 2px;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    width: 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.strength-text {
    font-size: 0.75rem;
    font-weight: 500;
    min-width: 80px;
}

/* Password Match */
.password-match {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
}

/* ==========================================
   Responsive
   ========================================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .btn-menu {
        display: block;
    }
    
    .welcome-content {
        padding: 1.5rem;
    }
    
    .welcome-actions {
        flex-direction: column;
    }
    
    .welcome-actions .btn {
        width: 100%;
    }
    
    /* Config responsive */
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .config-form {
        padding: 1.5rem;
    }
    
    .form-actions {
        flex-direction: column-reverse;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    /* Header responsive */
    .header-user-info {
        display: none;
    }
}

