/* ============================================================
   GESDOMUS APP — Design System
   ============================================================ */

:root {
    --color-primary: #1a56db;
    --color-primary-light: #e8f0fe;
    --color-primary-dark: #1344b0;
    --color-accent: #059669;
    --color-accent-light: #ecfdf5;
    --color-danger: #dc2626;
    --color-warning: #f59e0b;
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-text: #1e293b;
    --color-text-secondary: #64748b;
    --color-border: #e2e8f0;
    --color-sidebar: #1e293b;
    --color-sidebar-hover: #334155;
    --color-sidebar-active: #1a56db;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --sidebar-width: 260px;
    --header-height: 60px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--color-bg);
    color: var(--color-text);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--color-sidebar);
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    min-height: var(--header-height);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 18px;
}

.logo-icon { font-size: 24px; }
.logo-text { color: #fff; }

.sidebar-close { display: none; color: #fff; }

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: #cbd5e1;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    margin-bottom: 2px;
    cursor: pointer;
}

.nav-item:hover { background: var(--color-sidebar-hover); color: #fff; }
.nav-item.active { background: var(--color-sidebar-active); color: #fff; }

.nav-item svg { flex-shrink: 0; }

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info-mini {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
}

.user-details { display: flex; flex-direction: column; }
.user-name { font-size: 13px; font-weight: 600; }
.user-condo { font-size: 11px; color: #94a3b8; }

/* Overlay mobile */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin 0.3s ease;
}

.app-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 20px;
    height: var(--header-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.menu-toggle { display: none; }

.page-title {
    font-size: 20px;
    font-weight: 700;
    flex: 1;
}

.header-actions { display: flex; gap: 8px; }

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

.btn-icon:hover { background: var(--color-primary-light); color: var(--color-primary); }

.page-content {
    flex: 1;
    padding: 24px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* ============================================================
   RESPONSIVO
   ============================================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-close { display: flex; }
    .main-content { margin-left: 0; }
    .menu-toggle { display: flex; }
    .page-content { padding: 16px; }
}

/* ============================================================
   COMPONENTES COMUNS
   ============================================================ */
.hidden { display: none !important; }

.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-outline { background: transparent; border: 1px solid var(--color-border); color: var(--color-text); }
.btn-outline:hover { background: var(--color-primary-light); border-color: var(--color-primary); }

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 0;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-secondary);
}

.empty-state svg { margin-bottom: 16px; opacity: 0.3; }
.empty-state p { font-size: 14px; }

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--color-text);
    color: #fff;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 200;
    animation: slideUp 0.3s ease;
}

.toast.error { background: var(--color-danger); }
.toast.success { background: var(--color-accent); }

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

/* ============================================================
   VOTAÇÕES — Estilos Completos
   ============================================================ */

.voting-page {
    max-width: 800px; width: 100%; overflow-x: hidden;
    margin: 0 auto;
}

.voting-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.voting-page-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

.voting-stats-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.stat-chip {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.stat-chip.active {
    background: #dbeafe;
    color: #1e40af;
}

.stat-chip.closed {
    background: #f1f5f9;
    color: #64748b;
}

.stat-chip.draft {
    background: #fef3c7;
    color: #92400e;
}

/* Lista de votações */
.voting-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Cartão de votação */
.voting-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    transition: all 0.2s;
    cursor: pointer;
}

.voting-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.voting-card.voted {
    border-left: 4px solid var(--color-accent);
}

.voting-card.pending {
    border-left: 4px solid var(--color-warning);
}

.voting-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.voting-card-title h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: var(--color-text);
    font-weight: 600;
}

.voting-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.estado-badge {
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.estado-badge.active {
    background: #dbeafe;
    color: #1e40af;
}

.estado-badge.closed {
    background: #f1f5f9;
    color: #64748b;
}

.estado-badge.draft {
    background: #fef3c7;
    color: #92400e;
}

.voto-badge {
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.voto-badge.voted {
    background: #d1fae5;
    color: #065f46;
}

.voto-badge.pending {
    background: #fef3c7;
    color: #92400e;
}

.voting-date {
    font-size: 13px;
    color: var(--color-text-secondary);
    white-space: nowrap;
}

/* Barra de progresso */
.progress-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.progress-bar {
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #1a56db, #7c3aed);
    border-radius: 4px;
    transition: width 0.4s ease;
    min-width: 0;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--color-text-secondary);
}

/* Ações do cartão */
.voting-card-actions {
    margin-top: 14px;
    display: flex;
    gap: 8px;
}

.btn-votar, .btn-ver-voto, .btn-ver-resultados, .btn-detalhes {
    padding: 8px 16px;
    border-radius: var(--radius);
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
}

.btn-votar {
    background: var(--color-primary);
    color: #fff;
    width: 100%;
}

.btn-votar:hover {
    background: var(--color-primary-dark);
}

.btn-ver-voto {
    background: #d1fae5;
    color: #065f46;
    width: 100%;
}

.btn-ver-voto:hover {
    background: #a7f3d0;
}

.btn-ver-resultados {
    background: #f1f5f9;
    color: var(--color-text);
    width: 100%;
}

.btn-ver-resultados:hover {
    background: #e2e8f0;
}

.btn-detalhes {
    background: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
    width: 100%;
}

.btn-detalhes:hover {
    background: var(--color-primary-light);
}

/* Modal de votação */
.voting-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.voting-modal-content {
    background: #fff;
    border-radius: var(--radius-lg);
    max-width: 520px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.voting-modal-content .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 0;
}

.voting-modal-content .modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--color-text-secondary);
    padding: 4px 8px;
    border-radius: 6px;
}

.modal-close:hover {
    background: #f1f5f9;
}

.voting-modal-content .modal-body {
    padding: 20px;
}

/* Resultados */
.resultados-section {
    margin-bottom: 20px;
}

.resultados-section h4 {
    margin: 0 0 12px 0;
    font-size: 15px;
}

.resultados-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.resultado-item {
    margin-bottom: 14px;
}

.resultado-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
}

.resultado-votos {
    color: var(--color-text-secondary);
    font-size: 13px;
}

.resultado-bar {
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
}

.resultado-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Opções de voto */
.voto-form-section h4 {
    margin: 0 0 8px 0;
    font-size: 15px;
}

.voto-descricao {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 16px;
}

.opcoes-voto {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.opcao-voto {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.opcao-voto:hover {
    border-color: var(--color-primary);
    background: #f8fafc;
}

.opcao-voto.selected {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.opcao-voto input[type="radio"] {
    accent-color: var(--color-primary);
    width: 18px;
    height: 18px;
}

.opcao-label {
    font-size: 15px;
    font-weight: 500;
}

.btn-confirmar-voto {
    width: 100%;
    padding: 12px;
    background: var(--color-accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-confirmar-voto:hover {
    background: #047857;
}

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

/* Meu voto */
.meu-voto-section {
    background: #f0fdf4;
    padding: 16px;
    border-radius: var(--radius);
    margin-top: 16px;
    border: 1px solid #bbf7d0;
}

.meu-voto-section h4 {
    margin: 0 0 10px 0;
    font-size: 15px;
}

.meu-voto-section p {
    margin: 4px 0;
    font-size: 14px;
}

.tracker-info {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-top: 10px;
    word-break: break-all;
}

.tracker-info code {
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
}

/* Responsivo */
@media (max-width: 600px) {
    .voting-card { width: 100%; overflow-x: hidden; }
    .voting-card-header { flex-direction: column; }
    .voting-card-actions { flex-wrap: wrap; }
    .voting-page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .voting-card-header {
        flex-direction: column;
    }

    .voting-modal-content {
        margin: 10px;
        max-height: 90vh;
    }

    .voting-modal-content .modal-body {
        padding: 16px;
    }
}

/* ============================================================
   FILTROS E PAGINAÇÃO
   ============================================================ */

.stat-chip {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    border: 2px solid transparent;
}

.stat-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-chip.todas { background: #f1f5f9; color: #475569; }
.stat-chip.todas:hover { background: #e2e8f0; }

.stat-chip.active { background: #dbeafe; color: #1e40af; }
.stat-chip.active:hover { background: #bfdbfe; }

.stat-chip.closed { background: #f1f5f9; color: #64748b; }
.stat-chip.closed:hover { background: #e2e8f0; }

.stat-chip.active-filter {
    border-color: currentColor;
    box-shadow: 0 0 0 2px rgba(26,86,219,0.2);
}

.stat-chip.todas.active-filter { border-color: #475569; box-shadow: 0 0 0 2px rgba(71,85,105,0.2); }
.stat-chip.active.active-filter { border-color: #1e40af; }
.stat-chip.closed.active-filter { border-color: #64748b; box-shadow: 0 0 0 2px rgba(100,116,139,0.2); }

/* Paginação */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    padding: 16px 0;
    border-top: 1px solid var(--color-border);
    flex-wrap: wrap;
    gap: 12px;
}

.pagination-info {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.pagination-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-btn {
    padding: 6px 12px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 36px;
    text-align: center;
}

.pagination-btn:hover:not(:disabled):not(.active) {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.pagination-btn.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

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

.pagination-ellipsis {
    padding: 6px 4px;
    color: var(--color-text-secondary);
    font-size: 13px;
}

/* Responsivo */
@media (max-width: 600px) {
    .pagination-container {
        flex-direction: column;
        align-items: center;
    }
    
    .pagination-buttons {
        gap: 2px;
    }
    
    .pagination-btn {
        padding: 6px 10px;
        font-size: 12px;
        min-width: 32px;
    }
}
