/* =====================================================
   Sistema de Votación - Iglesia Episcopal Hondureña
   ===================================================== */

:root {
    --primary: #1a3a6e;       /* Azul episcopal profundo */
    --primary-dark: #0d2245;
    --primary-light: #2a5298;
    --secondary: #c8a84b;     /* Dorado litúrgico */
    --secondary-light: #e8c870;
    --success: #27ae60;
    --danger: #c0392b;
    --warning: #f39c12;
    --info: #2980b9;
    --white: #ffffff;
    --light: #f8f9fc;
    --gray: #6c757d;
    --gray-light: #e9ecef;
    --text: #2c3e50;
    --shadow: 0 4px 20px rgba(26,58,110,0.15);
    --shadow-lg: 0 8px 40px rgba(26,58,110,0.2);
    --radius: 12px;
    --radius-sm: 6px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Open Sans', sans-serif;
    color: var(--text);
    background: var(--light);
    min-height: 100vh;
}

/* ===== LOGIN PAGE ===== */
.login-page {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '✝';
    position: absolute;
    font-size: 400px;
    color: rgba(255,255,255,0.03);
    top: -100px;
    right: -100px;
    pointer-events: none;
}

.login-container {
    width: 100%;
    max-width: 480px;
    z-index: 1;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border-top: 6px solid var(--secondary);
}

.login-header {
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 40px 40px 30px;
    text-align: center;
    color: var(--white);
}

.login-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin-bottom: 16px;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
}

.church-name {
    font-family: 'Cinzel', serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--secondary-light);
    line-height: 1.3;
    margin-bottom: 6px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.convention-subtitle {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    font-weight: 400;
    color: rgba(255,255,255,0.85);
    margin-bottom: 16px;
    letter-spacing: 1px;
}

.divider {
    width: 60px;
    height: 2px;
    background: var(--secondary);
    margin: 0 auto 14px;
}

.system-title {
    font-size: 0.9rem;
    font-weight: 400;
    color: rgba(255,255,255,0.75);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.login-form {
    padding: 30px 40px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--primary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.label-icon { margin-right: 6px; }

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-light);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: 'Open Sans', sans-serif;
    color: var(--text);
    transition: var(--transition);
    background: var(--white);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,58,110,0.1);
}

.login-footer {
    background: var(--light);
    border-top: 1px solid var(--gray-light);
    padding: 16px 40px;
    text-align: center;
}

.login-footer p {
    font-size: 0.8rem;
    color: var(--gray);
    margin-bottom: 4px;
}

.footer-year { font-weight: 600; color: var(--primary); }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Open Sans', sans-serif;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--white);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(26,58,110,0.3); }

.btn-secondary { background: var(--secondary); color: var(--white); }
.btn-secondary:hover { background: var(--secondary-light); color: var(--text); }

.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #219a52; }

.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #a93226; }

.btn-warning { background: var(--warning); color: var(--white); }
.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: var(--white); }

.btn-sm { padding: 7px 14px; font-size: 0.82rem; }
.btn-full { width: 100%; padding: 14px; font-size: 1.05rem; }

/* ===== ALERTS ===== */
.alert {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    margin: 0 40px 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-error { background: #fde8e8; color: #c0392b; border-left: 4px solid #c0392b; }
.alert-success { background: #e8f8f0; color: #27ae60; border-left: 4px solid #27ae60; }
.alert-warning { background: #fef9e7; color: #f39c12; border-left: 4px solid #f39c12; }
.alert-info { background: #e8f4fd; color: #2980b9; border-left: 4px solid #2980b9; }

/* ===== TOP NAVIGATION ===== */
.navbar {
    background: linear-gradient(90deg, var(--primary-dark) 0%, var(--primary) 100%);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
}

.navbar-logo { height: 42px; width: 42px; object-fit: contain; }

.navbar-title {
    color: var(--white);
    font-family: 'Cinzel', serif;
    font-size: 1.05rem;
    line-height: 1.2;
}

.navbar-subtitle {
    color: var(--secondary-light);
    font-size: 0.72rem;
    font-family: 'Open Sans', sans-serif;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-greeting {
    color: rgba(255,255,255,0.85);
    font-size: 0.9rem;
}

.user-name { color: var(--secondary-light); font-weight: 700; }

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
}

.navbar-nav a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    transition: var(--transition);
}

.navbar-nav a:hover, .navbar-nav a.active {
    background: rgba(255,255,255,0.15);
    color: var(--white);
}

/* ===== MAIN LAYOUT ===== */
.main-wrapper {
    display: flex;
    min-height: calc(100vh - 64px);
}

.sidebar {
    width: 240px;
    background: var(--white);
    border-right: 1px solid var(--gray-light);
    padding: 24px 0;
    flex-shrink: 0;
}

.sidebar-menu { list-style: none; }
.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
    border-left: 3px solid transparent;
}
.sidebar-menu li a:hover, .sidebar-menu li a.active {
    background: rgba(26,58,110,0.08);
    color: var(--primary);
    border-left-color: var(--primary);
}

.sidebar-section {
    padding: 16px 24px 8px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray);
    font-weight: 600;
}

.content-area {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

/* ===== PAGE HEADER ===== */
.page-header {
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-title {
    font-family: 'Cinzel', serif;
    font-size: 1.6rem;
    color: var(--primary);
}

.page-subtitle {
    color: var(--gray);
    font-size: 0.9rem;
    margin-top: 4px;
}

/* ===== CARDS ===== */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 24px;
}

.card-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(90deg, var(--light) 0%, var(--white) 100%);
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
}

.card-body { padding: 24px; }

/* ===== STATS CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    border-left: 5px solid var(--primary);
}

.stat-card.gold { border-left-color: var(--secondary); }
.stat-card.green { border-left-color: var(--success); }
.stat-card.red { border-left-color: var(--danger); }

.stat-icon { font-size: 2.2rem; }
.stat-info {}
.stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); line-height: 1; }
.stat-label { font-size: 0.82rem; color: var(--gray); margin-top: 4px; }

/* ===== TABLES ===== */
.table-responsive { overflow-x: auto; }

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    background: var(--primary);
    color: var(--white);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-light);
    color: var(--text);
}

.data-table tr:hover td { background: rgba(26,58,110,0.04); }
.data-table tr:last-child td { border-bottom: none; }

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info { background: #cce5ff; color: #004085; }
.badge-secondary { background: var(--gray-light); color: var(--gray); }
.badge-clerigo { background: #e8d5f5; color: #5b2c6f; }
.badge-laico { background: #d5eaf5; color: #1a5276; }

/* ===== LOBBY - VOTING CARDS ===== */
.welcome-banner {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--white);
    border-radius: var(--radius);
    padding: 28px 32px;
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
}

.welcome-icon { font-size: 3rem; }
.welcome-title { font-family: 'Cinzel', serif; font-size: 1.6rem; }
.welcome-subtitle { color: rgba(255,255,255,0.8); font-size: 0.95rem; margin-top: 4px; }

.votaciones-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.votacion-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
    border-top: 4px solid var(--primary);
    cursor: pointer;
    text-decoration: none;
    display: block;
    color: inherit;
}

.votacion-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-top-color: var(--secondary);
}

.votacion-card.voted { border-top-color: var(--success); opacity: 0.85; }
.votacion-card.voted:hover { cursor: default; transform: none; }

.votacion-card-body { padding: 24px; }
.votacion-icon { font-size: 2.5rem; margin-bottom: 12px; }
.votacion-name { font-family: 'Cinzel', serif; font-size: 1.1rem; color: var(--primary); margin-bottom: 8px; }
.votacion-desc { font-size: 0.85rem; color: var(--gray); line-height: 1.5; }

.votacion-card-footer {
    background: var(--light);
    padding: 14px 24px;
    border-top: 1px solid var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ===== CANDIDATE SELECTION ===== */
.voting-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--white);
    padding: 24px 32px;
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.voting-rules {
    display: flex;
    gap: 20px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.voting-rule {
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 0.85rem;
    border: 1px solid rgba(255,255,255,0.3);
}

.candidates-section { margin-bottom: 32px; }

.section-title {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    color: var(--primary);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.candidates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.candidate-card {
    background: var(--white);
    border: 3px solid var(--gray-light);
    border-radius: var(--radius);
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    user-select: none;
}

.candidate-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(26,58,110,0.15);
    transform: translateY(-2px);
}

.candidate-card.selected {
    border-color: var(--secondary);
    background: #fffbf0;
    box-shadow: 0 4px 16px rgba(200,168,75,0.25);
}

.candidate-card.selected::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 12px;
    width: 24px;
    height: 24px;
    background: var(--secondary);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}

.candidate-photo {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 12px;
    display: block;
    border: 3px solid var(--gray-light);
}

.candidate-card.selected .candidate-photo { border-color: var(--secondary); }

.candidate-placeholder {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gray-light), #d0d5dd);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--gray);
    margin: 0 auto 12px;
}

.candidate-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 6px;
    line-height: 1.3;
}

.candidate-type { font-size: 0.75rem; }

/* ===== VOTE SUBMIT BAR ===== */
.vote-submit-bar {
    position: sticky;
    bottom: 0;
    background: var(--white);
    border-top: 2px solid var(--secondary);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    z-index: 50;
}

.selection-summary { font-size: 0.9rem; color: var(--text); }
.selection-count { font-weight: 700; color: var(--primary); }

/* ===== RESULTS PAGE ===== */
.results-container { max-width: 900px; margin: 0 auto; }

.results-header {
    text-align: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: var(--white);
    padding: 40px;
    border-radius: var(--radius);
    margin-bottom: 32px;
}

.results-logo { width: 80px; margin-bottom: 16px; }

.candidate-result {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--gray-light);
}

.candidate-result:last-child { border-bottom: none; }

.result-rank {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.result-rank.gold-rank { background: #c9a227; }
.result-rank.silver-rank { background: #9e9e9e; }
.result-rank.bronze-rank { background: #cd7f32; }

.result-photo {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--gray-light);
    flex-shrink: 0;
}

.result-info { flex: 1; }
.result-name { font-weight: 700; font-size: 1rem; color: var(--text); }
.result-type { font-size: 0.8rem; color: var(--gray); }

.result-bar-container { flex: 2; }
.result-bar-bg {
    height: 10px;
    background: var(--gray-light);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 4px;
}

.result-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 5px;
    transition: width 1s ease;
}

.result-votes { font-size: 0.82rem; color: var(--gray); text-align: right; margin-top: 2px; }

/* ===== PROGRESS MONITOR ===== */
.monitor-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
    text-align: center;
}

.big-percentage {
    font-size: 5rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    font-family: 'Cinzel', serif;
}

.progress-bar-lg {
    height: 24px;
    background: var(--gray-light);
    border-radius: 12px;
    overflow: hidden;
    margin: 24px 0;
}

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

/* ===== FORM STYLES (Admin) ===== */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-row.three { grid-template-columns: 1fr 1fr 1fr; }
.form-row.full { grid-template-columns: 1fr; }

.form-group label { margin-bottom: 6px; display: block; font-weight: 600; font-size: 0.85rem; color: var(--primary); }
.form-group small { color: var(--gray); font-size: 0.78rem; display: block; margin-top: 4px; }

.form-group input[type="file"] {
    border: 2px dashed var(--gray-light);
    background: var(--light);
    cursor: pointer;
    padding: 10px;
}

.form-group input[type="file"]:hover { border-color: var(--primary); }

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 100%;
    border-top: 5px solid var(--primary);
}

.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--gray-light); }
.modal-title { font-family: 'Cinzel', serif; font-size: 1.2rem; color: var(--primary); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--gray-light); display: flex; justify-content: flex-end; gap: 12px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .content-area { padding: 20px; }
    .form-row { grid-template-columns: 1fr; }
    .candidates-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== UTILITIES ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }

/* Cross animation for vote confirmation */
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.4s ease; }
