@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;700;900&display=swap');

:root {
    --dark-blue: #010409;
    --mid-blue: #0d1117;
    --accent-blue: #238636; /* Using a green accent for a change, can be blue too */
    --light-gray: #e6edf3;
    --gray: #8b949e;
    --white: #FFFFFF;
    
    /* Original colors for compatibility with dynamic elements */
    --celeste: #37B5E0;
    --blanco: #FFFFFF;
    --gris: #808080;
    --azul: #005CAB;
    --amarillo: #FFD700;
    --rojo: #E74C3C;
    --verde: #2ECC71;
    --gris-oscuro: #7F8C8D;
}

body {
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--dark-blue);
    color: var(--light-gray);
}

.navbar {
    background-color: rgba(1, 4, 9, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--mid-blue);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.navbar-brand {
    display: flex;
    align-items: center;
    font-weight: bold;
    color: var(--white) !important;
}

.logo {
    width: 40px;
    height: 40px;
    margin-right: 10px;
    position: relative;
}

.logo-urna {
    width: 100%;
    height: 100%;
    background-color: var(--white);
    border-radius: 5px;
    position: relative;
    overflow: hidden;
}

.logo-sol {
    position: absolute;
    width: 30px;
    height: 30px;
    background-color: #FDB813;
    border-radius: 50%;
    top: 5px;
    left: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-sol::before {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: var(--celeste);
    border-radius: 50%;
}

.logo-sol::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: var(--white);
    border-radius: 50%;
    z-index: 1;
}

.nav-link {
    color: var(--light-gray) !important;
    font-weight: 500;
    margin: 0 5px;
    transition: all 0.3s;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.nav-link:hover, .nav-link.active {
    color: var(--white) !important;
    text-shadow: 0 0 5px var(--celeste);
}

.hero {
    background: url('background.png') no-repeat center center/cover;
    color: var(--white);
    padding: 120px 0;
    text-align: center;
    min-height: calc(100vh - 70px); /* Adjust based on navbar height */
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--accent-blue);
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(1, 4, 9, 0.3) 0%, rgba(1, 4, 9, 0.8) 80%);
    z-index: 1;
}

.hero-content {
    max-width: 900px;
    margin: 0 auto;
    animation: fadeInDown 1s ease-out;
    position: relative;
    z-index: 2;
}

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

.hero .hero-title {
    font-weight: 900;
    font-size: 5rem;
    margin-bottom: 0;
    text-shadow: 0 0 20px rgba(0, 191, 255, 0.5), 0 0 10px rgba(0, 0, 0, 0.5);
    letter-spacing: 2px;
    line-height: 1;
}

.hero .hero-subtitle {
    font-weight: 500;
    font-size: 1.5rem;
    color: var(--celeste);
    margin-bottom: 25px;
    letter-spacing: 4px;
    text-transform: uppercase;
}

.hero .lead {
    font-size: 1.2rem;
    font-weight: 400;
    margin-bottom: 40px;
    color: var(--light-gray);
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.hero-btn {
    font-weight: bold;
    padding: 14px 40px;
    border-radius: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    background-color: var(--accent-blue);
    color: var(--white);
    border: 2px solid var(--accent-blue);
    box-shadow: 0 0 15px rgba(35, 134, 54, 0.5);
}

.hero-btn:hover {
    background-color: transparent;
    color: var(--white);
    transform: translateY(-3px);
    box-shadow: 0 0 25px rgba(35, 134, 54, 0.8);
}

.section-title {
    color: var(--white);
    margin-bottom: 40px;
    font-weight: 700;
    position: relative;
    padding-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 1.8rem;
}

.section-title::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background-color: var(--accent-blue);
}

/* Poll Cards */
.poll-card {
    background-color: var(--mid-blue);
    border-radius: 8px;
    padding: 0;
    margin-bottom: 20px;
    text-align: left;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid #30363d;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.poll-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    border-color: var(--accent-blue);
}

.poll-card-content {
    padding: 25px;
    flex-grow: 1;
}

.poll-card i.fa-vote-yea, .poll-card i.fa-poll {
    font-size: 1.5rem;
    color: var(--gray);
    margin-bottom: 15px;
    background-color: #21262d;
    padding: 10px;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    text-align: center;
}

.poll-card h3 {
    font-weight: 700;
    color: var(--light-gray);
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.poll-card p {
    color: var(--gray);
    font-size: 0.95rem;
    line-height: 1.6;
}

.poll-card .poll-card-footer {
    padding: 15px 25px;
    background-color: #010409;
    border-top: 1px solid #30363d;
    margin-top: auto;
}

.poll-card .vote-prompt {
    font-weight: bold;
    color: var(--celeste);
    display: block;
    transition: color 0.3s;
}

.poll-card:hover .vote-prompt {
    color: var(--white);
}

/* Election Cards */
.election-card {
    background-color: var(--blanco);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    padding: 30px;
    margin-bottom: 20px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 2px solid transparent;
}

.election-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
    border-color: var(--celeste);
}

.election-card i {
    font-size: 3rem;
    color: var(--celeste);
    margin-bottom: 15px;
}

.election-card h3 {
    font-weight: bold;
    color: var(--azul);
    margin-bottom: 10px;
}

.election-card p {
    color: var(--gris);
}

/* General Poll Options */
.options-container {
    max-width: 600px;
    margin: 30px auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.poll-option {
    background-color: #fff;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 15px 20px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-align: left;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.poll-option.voted {
    cursor: default;
}

.poll-option:not(.voted):hover {
    border-color: var(--celeste);
    color: var(--celeste);
}

.poll-option-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background-color: #e0f7ff;
    z-index: 1;
    transition: width 0.5s ease-in-out;
}

.poll-option-text, .poll-option-perc {
    position: relative;
    z-index: 2;
    font-weight: bold;
}

.poll-option-perc {
    color: var(--celeste);
}

.poll-option.selected {
    background-color: var(--celeste);
    color: var(--blanco);
    border-color: var(--celeste);
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(55, 181, 224, 0.3);
}

/* Ballot Design */
.ballot-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin: 30px 0;
}

.ballot {
    width: 200px;
    height: 300px;
    background-color: var(--blanco);
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    border: 2px solid #ddd;
}

.ballot:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.ballot.selected {
    border: 3px solid var(--celeste);
    box-shadow: 0 0 0 4px rgba(55, 181, 224, 0.3);
}

.ballot-header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--blanco);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    font-size: 0.9rem;
    padding: 0 10px;
    text-align: center;
}

.ballot-body {
    padding: 15px;
    text-align: center;
    height: calc(100% - 60px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}

.ballot-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--blanco);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    margin-bottom: 15px;
}

.ballot-name {
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.ballot-position {
    font-size: 0.8rem;
    color: var(--celeste);
    margin-bottom: 8px;
    font-weight: bold;
}

.ballot-party {
    font-size: 0.9rem;
    color: var(--gris);
}

/* Provinces Section */
.provinces-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.province-card {
    background-color: var(--blanco);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
    border: 2px solid #e0e0e0;
}

.province-card h4 {
    font-weight: bold;
    color: var(--azul);
    font-size: 1.2rem;
    margin: 0;
}

.province-card.total-pais-card {
    border-color: var(--azul);
    background-color: #f0f8ff; /* Light blue */
}

.province-card.total-pais-card:hover {
    border-color: var(--celeste);
    background-color: #e6f4ff;
}

/* Results */
.results-container {
    overflow-x: auto;
    padding: 20px 0;
}

.results-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 15px;
    min-width: max-content;
}

.result-card {
    flex: 0 0 250px;
    background-color: var(--blanco);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.3s, opacity 0.5s;
    opacity: 0;
    transform: translateY(20px);
}

.result-card.show {
    opacity: 1;
    transform: translateY(0);
}

.result-card:hover {
    transform: translateY(-5px);
}

.result-header {
    height: 10px;
}

.result-body {
    padding: 15px;
    text-align: center;
}

.result-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 15px;
    border: 3px solid var(--blanco);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.result-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.result-position {
    font-size: 0.85rem;
    color: var(--celeste);
    margin-bottom: 8px;
    font-weight: bold;
}

.result-party {
    color: var(--gris);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.result-percentage {
    font-size: 2rem;
    font-weight: bold;
}

.result-party-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 15px;
    border: 3px solid var(--blanco);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* Styles for "Other Candidates" list */
.other-results-list-group {
    max-width: 800px;
    margin: 0 auto;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    background-color: #fff;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.other-candidate-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid #e9ecef;
    position: relative;
}

.other-candidate-item:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background-color: var(--candidate-color, transparent);
}

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

.other-candidate-info {
    display: flex;
    align-items: center;
}

.other-candidate-photo {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 15px;
}

.other-party-icon {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    color: white;
    flex-shrink: 0; /* Prevents shrinking */
}

.other-candidate-name {
    font-weight: 500;
}

.other-candidate-party {
    color: var(--gris);
    font-size: 0.9rem;
}

.other-candidate-percentage {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--celeste);
}

.chart-container {
    background-color: var(--blanco);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 30px;
    height: 400px;
}

.admin-panel {
    background-color: var(--blanco);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 30px;
}

.admin-subsection {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 40px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.provinces-checklist {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 5px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 5px;
}

.subsection-title {
    font-weight: bold;
    color: var(--azul);
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--celeste);
}

.subsection-description {
    color: var(--gris);
    margin-bottom: 20px;
}

.admin-poll-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-bottom: 10px;
    background-color: #f9f9f9;
}

.admin-poll-card .poll-info {
    font-weight: bold;
}

.admin-poll-card .poll-actions .btn {
    margin-left: 5px;
}

.election-poll-admin-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 15px;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.election-poll-admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    cursor: pointer;
    background-color: #f9f9f9;
    border-radius: 8px 8px 0 0;
}

.election-poll-admin-header:hover {
    background-color: #f1f1f1;
}

.election-poll-admin-title {
    font-weight: bold;
    color: var(--azul);
}

.election-poll-admin-editor {
    padding: 20px;
    border-top: 1px solid #ddd;
    display: none; /* Hidden by default */
}

.form-control, .form-select {
    border-radius: 5px;
    border: 1px solid #ddd;
    padding: 10px;
}

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

.btn-primary:hover {
    background-color: #1E88E5;
    border-color: #1E88E5;
}

.btn-danger {
    background-color: var(--rojo);
    border-color: var(--rojo);
}

.btn-danger:hover {
    background-color: #c0392b;
    border-color: #c0392b;
}

footer {
    background-color: var(--gris);
    color: var(--blanco);
    padding: 30px 0;
    margin-top: 50px;
}

.social-links a {
    color: var(--blanco);
    font-size: 1.5rem;
    margin: 0 10px;
    transition: color 0.3s;
}

.social-links a:hover {
    color: var(--celeste);
}

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050;
}

.custom-toast {
    background-color: var(--celeste);
    color: var(--blanco);
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    animation: slideIn 0.3s forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-close {
    margin-left: 15px;
    cursor: pointer;
}

.tab-content {
    padding-top: 20px;
}

.nav-tabs .nav-link {
    color: var(--gris);
}

.nav-tabs .nav-link.active {
    color: var(--celeste);
    font-weight: bold;
}

.nav-tabs .nav-link:hover {
    color: var(--celeste);
}

.back-btn {
    background-color: transparent;
    border: 1px solid var(--celeste);
    color: var(--celeste);
    padding: 8px 15px;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 20px;
}

.back-btn:hover {
    background-color: var(--celeste);
    color: var(--blanco);
}

.election-title {
    text-align: center;
    margin-bottom: 30px;
    color: var(--azul);
    font-weight: bold;
}

.hidden {
    display: none !important;
}

.section-transition {
    transition: opacity 0.5s ease-in-out;
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

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

.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
}

/* Login Modal */
.modal-content {
    border-radius: 10px;
    border: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.modal-header {
    background-color: var(--celeste);
    color: var(--blanco);
    border-radius: 10px 10px 0 0;
    border-bottom: none;
}

.modal-title {
    font-weight: bold;
}

.btn-close {
    filter: brightness(0) invert(1);
}

.login-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    position: relative;
}

.login-logo .logo-urna {
    width: 100%;
    height: 100%;
    background-color: var(--blanco);
    border-radius: 5px;
    position: relative;
    overflow: hidden;
}

.login-logo .logo-sol {
    position: absolute;
    width: 60px;
    height: 60px;
    background-color: #FDB813;
    border-radius: 50%;
    top: 10px;
    left: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-logo .logo-sol::before {
    content: "";
    position: absolute;
    width: 40px;
    height: 40px;
    background-color: var(--celeste);
    border-radius: 50%;
}

.login-logo .logo-sol::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: var(--blanco);
    border-radius: 50%;
    z-index: 1;
}

/* Footer clickable text */
.footer-brand {
    cursor: default;
    user-select: none;
}

/* Confirmation Modal */
.confirm-modal .modal-content {
    border-radius: 10px;
    border: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.confirm-modal .modal-header {
    background-color: var(--rojo);
    color: var(--blanco);
    border-radius: 10px 10px 0 0;
    border-bottom: none;
}

.confirm-modal .modal-title {
    font-weight: bold;
}

.confirm-modal .modal-body {
    text-align: center;
    padding: 30px;
}

.confirm-modal .modal-body i {
    font-size: 4rem;
    color: var(--rojo);
    margin-bottom: 20px;
}

.confirm-modal .modal-footer {
    border-top: none;
    justify-content: center;
    gap: 15px;
}

/* About Us Section */
#sobre-nosotros .lead {
    color: var(--gris-oscuro);
    max-width: 600px;
    margin: 0 auto 30px;
}

#sobre-nosotros .subtitle {
    font-weight: bold;
    color: var(--azul);
    margin-bottom: 20px;
}

.about-card {
    background-color: var(--blanco);
    border-radius: 10px;
    padding: 30px;
    height: 100%;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border-top: 4px solid var(--celeste);
    transition: transform 0.3s, box-shadow 0.3s;
}

.about-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.about-card-icon {
    font-size: 3rem;
    color: var(--celeste);
    margin-bottom: 20px;
    display: inline-block;
}

.about-card h3 {
    font-weight: bold;
    color: var(--azul);
    margin-bottom: 15px;
}

.value-item {
    text-align: center;
    padding: 20px;
}

.value-item i {
    font-size: 2.5rem;
    color: var(--celeste);
    margin-bottom: 15px;
}

.value-item h4 {
    font-weight: bold;
    color: var(--azul);
    margin-bottom: 10px;
}

.value-item p {
    color: var(--gris);
}

#sobre-nosotros .section-title::after {
    left: 50%;
    transform: translateX(-50%);
}

@media (max-width: 768px) {
    .hero {
        padding: 30px 0;
    }
    
    .result-card {
        flex: 0 0 200px;
    }
    
    .ballot {
        width: 150px;
        height: 250px;
    }
    
    .ballot-photo {
        width: 60px;
        height: 60px;
    }
    
    .result-photo {
        width: 60px;
        height: 60px;
    }
}

/* Vote Confirmation Modal */
#vote-confirm-candidate-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
#vote-confirm-candidate-info img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #ddd;
}
#vote-confirm-candidate-info h4 {
    margin: 0;
    font-weight: bold;
}
#vote-confirm-candidate-info p {
    margin: 0;
    color: var(--gris);
}