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

:root {
    --primary-blue: #1e3a8a;
    --secondary-blue: #3b82f6;
    --light-blue: #60a5fa;
    --dark-blue: #1e40af;
    --sky-blue: #0ea5e9;
    --primary-orange: #f97316;
    --secondary-orange: #fb923c;
    --light-orange: #fdba74;
    --dark-orange: #ea580c;
    --gradient-start: #1e3a8a;
    --gradient-end: #3b82f6;
    --gradient-orange: linear-gradient(135deg, #f97316, #fb923c);
    --text-dark: #1e293b;
    --text-light: #f8fafc;
    --bg-light: #f1f5f9;
    --success: #10b981;
    --error: #ef4444;
    --shadow: rgba(30, 58, 138, 0.1);
    --shadow-orange: rgba(249, 115, 22, 0.2);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 70%, var(--primary-orange) 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Pantallas */
.screen {
    display: none;
    min-height: 100vh;
    animation: fadeIn 0.5s ease-in-out;
}

.screen.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Pantalla de finalización y ya votó con scroll automático */
#finish-screen.active,
#already-voted-screen.active {
    display: block !important;
    overflow-y: auto;
    overflow-x: hidden;
    padding-top: 40px;
    padding-bottom: 40px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 100;
}

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

/* Login Screen */
#login-screen .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.logo-container {
    text-align: center;
    margin-bottom: 40px;
}

.logo-image {
    max-width: 200px;
    height: auto;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
    animation: fadeIn 0.8s ease-in-out;
}

.title {
    font-size: 2.5rem;
    font-weight: 800;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.subtitle {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--light-orange);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 450px;
}

.login-card h3 {
    font-size: 1.75rem;
    color: var(--primary-blue);
    margin-bottom: 10px;
    text-align: center;
}

.help-text {
    color: #64748b;
    text-align: center;
    margin-bottom: 30px;
    font-size: 0.95rem;
}

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

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-orange);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-orange), var(--secondary-orange));
    color: white;
    width: 100%;
    box-shadow: 0 4px 15px var(--shadow-orange);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.5);
    background: linear-gradient(135deg, var(--dark-orange), var(--primary-orange));
}

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

.btn-secondary {
    background: white;
    color: var(--secondary-blue);
    border: 2px solid var(--secondary-blue);
}

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

.error-message {
    background: #fee2e2;
    color: var(--error);
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
    text-align: center;
    border-left: 4px solid var(--error);
}

/* Welcome Screen */
.welcome-card {
    background: white;
    border-radius: 20px;
    padding: 60px 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.welcome-title {
    font-size: 2.5rem;
    color: var(--primary-blue);
    margin-bottom: 20px;
}

.welcome-name {
    font-size: 2rem;
    color: var(--primary-orange);
    margin-bottom: 30px;
}

.welcome-text {
    font-size: 1.2rem;
    color: var(--text-dark);
    line-height: 1.8;
    margin-bottom: 30px;
}

.welcome-instructions {
    background: var(--bg-light);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    text-align: left;
}

.welcome-instructions h3 {
    color: var(--primary-blue);
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.welcome-instructions ul {
    list-style: none;
    color: var(--text-dark);
}

.welcome-instructions li {
    padding: 10px 0;
    padding-left: 30px;
    position: relative;
    font-size: 1.05rem;
}

.welcome-instructions li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--primary-orange);
    font-weight: bold;
    font-size: 1.2rem;
}

/* Voting Screen */
#voting-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.voting-header {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    box-shadow: 0 2px 10px var(--shadow);
}

#sector-title {
    text-align: center;
    color: var(--primary-blue);
    font-size: 1.8rem;
    margin-bottom: 15px;
}

.progress-bar {
    width: 100%;
    max-width: 600px;
    height: 10px;
    background: #e2e8f0;
    border-radius: 10px;
    margin: 0 auto 10px;
    overflow: hidden;
}

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

.progress-text {
    text-align: center;
    color: var(--text-dark);
    font-weight: 600;
}

.voting-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

.photos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
}

/* Animaciones de deslizamiento */
.photos-grid.slide-out-left {
    animation: slideOutLeft 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.photos-grid.slide-out-right {
    animation: slideOutRight 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.photos-grid.slide-in-left {
    animation: slideInLeft 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.photos-grid.slide-in-right {
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

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

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

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

.photo-card {
    background: transparent;
    border-radius: 15px;
    overflow: visible;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    aspect-ratio: 4/3; /* Mantener proporción constante */
}

.photo-card:hover .photo-image {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px var(--shadow-orange);
}

.photo-card.selected .photo-image {
    border: 4px solid var(--primary-orange);
    box-shadow: 0 10px 30px var(--shadow-orange);
}

.photo-card.selected::after {
    content: "✓";
    position: absolute;
    top: 15px;
    right: 15px;
    width: 50px;
    height: 50px;
    background: var(--primary-orange);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    z-index: 10;
}

.photo-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 15px;
    box-shadow: 0 4px 15px var(--shadow);
    transition: all 0.3s ease;
}

.photo-info {
    padding: 20px;
    text-align: center;
    display: none; /* Ocultar el título en la votación */
}

.photo-title {
    font-size: 1.1rem;
    color: var(--primary-blue);
    font-weight: 600;
}

.voting-footer {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    box-shadow: 0 -2px 10px var(--shadow);
    position: relative;
}

.voting-footer .btn {
    flex: 1;
    max-width: 250px;
}

.vote-indicator {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-orange);
    color: white;
    padding: 12px 25px;
    border-radius: 50px;
    font-weight: 600;
    box-shadow: 0 4px 15px var(--shadow-orange);
    z-index: 100;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 1;
    font-size: 0.95rem;
}

.vote-indicator.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
    pointer-events: none;
}

/* Ocultar en móviles después de unos segundos */
@media (max-width: 768px) {
    .vote-indicator {
        top: 70px;
        padding: 10px 20px;
        font-size: 0.85rem;
        animation: fadeInOutMobile 8s ease-in-out forwards;
    }
    
    @keyframes fadeInOutMobile {
        0% { opacity: 1; }
        70% { opacity: 1; }
        100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    }
}

/* Finish Screen */
.finish-card {
    background: white;
    border-radius: 20px;
    padding: 60px 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.success-icon {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, var(--primary-orange), var(--secondary-orange));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin: 0 auto 30px;
    animation: scaleIn 0.5s ease-out;
    box-shadow: 0 4px 20px var(--shadow-orange);
}

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

.finish-title {
    font-size: 2.5rem;
    color: var(--primary-blue);
    margin-bottom: 20px;
}

.finish-name {
    font-size: 1.8rem;
    color: var(--primary-orange);
    margin-bottom: 30px;
}

.finish-text {
    font-size: 1.3rem;
    color: var(--text-dark);
    line-height: 1.8;
    margin-bottom: 15px;
}

.finish-subtext {
    font-size: 1.1rem;
    color: #64748b;
}

.finish-message {
    margin: 30px 0;
    padding: 20px;
    background: var(--bg-light);
    border-radius: 15px;
}

.finish-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 30px 0;
}

.info-box {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border-left: 4px solid var(--primary-orange);
}

.info-icon {
    font-size: 2rem;
    min-width: 50px;
    text-align: center;
}

.info-box p {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-dark);
    font-weight: 500;
}

.finish-footer {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-orange), var(--secondary-orange));
    color: white;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 58, 138, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .logo-image {
        max-width: 150px;
    }
    
    .title {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1.2rem;
    }
    
    .login-card {
        padding: 30px 20px;
    }
    
    .photos-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .photo-card {
        aspect-ratio: 16/9; /* Proporción más horizontal en móviles */
    }
    
    .photo-image {
        height: 100%;
    }
    
    .voting-footer {
        flex-direction: column;
    }
    
    .voting-footer .btn {
        max-width: 100%;
    }
    
    .welcome-card,
    .finish-card {
        padding: 40px 20px;
    }
    
    /* Ajustes específicos para pantalla de finalización y ya votó en móviles */
    #finish-screen.active,
    #already-voted-screen.active {
        padding-top: 10px !important;
        padding-bottom: 10px !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100vh !important;
        overflow-y: auto !important;
    }
    
    #finish-screen .container,
    #already-voted-screen .container {
        padding: 10px;
        max-width: 100%;
    }
    
    #finish-screen .finish-card,
    #already-voted-screen .finish-card {
        margin: 0;
    }
    
    .welcome-title,
    .finish-title {
        font-size: 2rem;
    }
    
    .finish-name {
        font-size: 1.5rem;
    }
    
    .finish-text {
        font-size: 1.1rem;
    }
    
    .info-box {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .info-icon {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .logo-image {
        max-width: 120px;
    }
    
    .title {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    #sector-title {
        font-size: 1.4rem;
    }
}

/* Touch gestures indicator */
.swipe-indicator {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Indicador de swipe para móviles */
@media (max-width: 768px) {
    .voting-footer {
        padding-bottom: 50px;
    }
    
    .voting-footer::after {
        content: '← Deslizá para navegar →';
        position: absolute;
        bottom: 15px;
        left: 50%;
        transform: translateX(-50%);
        color: rgba(30, 58, 138, 0.7);
        font-size: 0.8rem;
        white-space: nowrap;
        animation: fadeInOut 3s ease-in-out infinite;
        font-weight: 500;
    }
    
    @keyframes fadeInOut {
        0%, 100% { opacity: 0.5; }
        50% { opacity: 1; }
    }
    
    /* Hacer las animaciones más rápidas en móviles */
    .photos-grid {
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    }
    
    .photos-grid.slide-out-left,
    .photos-grid.slide-out-right,
    .photos-grid.slide-in-left,
    .photos-grid.slide-in-right {
        animation-duration: 0.3s;
    }
}

/* Admin Link */
.admin-link {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.admin-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}
