* {
    box-sizing: border-box;
}

body {
    overflow-x: hidden;
}

:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --accent-primary: #1f88d9;
    --accent-green: #00c853;
    --accent-red: #ff3d00;
    --overlay-bg: rgba(0, 0, 0, 0.4);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

/* --- ESTILOS ESPECÍFICOS PARA MÓVIL --- */
.mobile-footer {
    display: none;
    /* Oculto por defecto (escritorio) */
}

@media (max-width: 768px) {
    body {
        padding-bottom: 80px;
        /* Espacio para el sticky footer */
    }

    .header-stats-desktop {
        display: none !important;
        /* Forzar ocultar barra flotante en móvil */
    }

    .header {
        height: 70px;
        /* Altura equilibrada */
        padding: 5px 15px;
    }

    .header-brand h1 {
        display: block;
        font-size: 1rem;
        margin-left: 12px;
    }

    .header-logo {
        height: 30px;
        /* Equilibrado para móvil */
    }

    .mobile-footer {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(30, 30, 30, 0.9);
        backdrop-filter: blur(15px);
        border-top: 1px solid var(--glass-border);
        padding: 12px 20px;
        justify-content: space-between;
        align-items: center;
        z-index: 100;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
    }

    .mobile-footer .stats {
        gap: 10px;
        /* Espacio reducido para que quepan las palabras completas */
    }

    .mobile-footer .stat-item {
        gap: 2px;
    }

    .mobile-footer .count-number {
        font-size: 1.1rem;
    }

    .mobile-footer .count-label {
        font-size: 0.65rem;
        /* Fuente más pequeña para que quepan las palabras completas */
        white-space: nowrap;
    }

    #btn-submit-mobile {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .gallery-container {
        padding: 15px;
        gap: 20px;
        grid-template-columns: 1fr;
        /* Una sola columna en pantallas pequeñas */
    }

    /* Hacer botones siempre visibles en móvil */
    .actions-bar {
        transform: translateY(0);
        background: rgba(0, 0, 0, 0.7);
    }

    .photo-card:hover .actions-bar {
        transform: translateY(0);
    }

    .filename {
        left: 10px;
        right: 10px;
        font-size: 0.85rem;
    }
}

.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at 50% 50%, #1a1a1a 0%, #0a0a0a 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

.login-box {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 60px;
    /* Padding aumentado */
    border-radius: 30px;
    /* Más redondeado */
    text-align: center;
    width: 100%;
    max-width: 600px;
    /* 1.5x de 400px aprox */
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.5);
    transform: scale(1.1);
    /* Escalado sutil */
    transition: transform 0.3s ease, opacity 0.5s ease;
}

.login-box.shifted-up {
    transform: scale(1) translateY(-100px) !important;
}

.login-logo {
    width: 420px;
    /* 1.5x de 280px */
    max-width: 100%;
    /* Asegura que no desborde en pantallas pequeñas */
    height: auto;
    margin-bottom: 35px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.login-box h2 {
    margin-top: 0;
    font-size: 3rem;
    /* Título más grande */
    font-weight: 600;
}

.login-box p {
    color: var(--text-secondary);
    margin-bottom: 40px;
    font-size: 1.2rem;
}

#username-input {
    width: 100%;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    margin-bottom: 20px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

#username-input:focus {
    border-color: var(--accent-primary);
}

#username-input.input-error::placeholder {
    color: var(--accent-red);
    opacity: 1;
}

.hidden {
    display: none !important;
}

.fade-out {
    opacity: 0;
    pointer-events: none;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-10px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(10px);
    }
}

.shake {
    animation: bounce 0.8s ease-in-out;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    padding: 1px 10px;
    background-color: var(--card-bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.header h1 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-logo {
    height: 50px;
    /* Reducido de 100px */
    width: auto;
    margin: 0px;
    padding: 0px;
    object-fit: contain;
}

.header-stats-desktop {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 30, 30, 0.8);
    backdrop-filter: blur(15px);
    padding: 10px 30px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 40px;
    z-index: 1000;
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
}

.header-stats-desktop:hover {
    transform: translateX(-50%) translateY(-5px);
}

.btn-primary {
    background-color: var(--accent-primary);
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.btn-primary:hover {
    background-color: #1565c0;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    background-color: #444;
    cursor: not-allowed;
    opacity: 0.6;
}

.stats {
    display: flex;
    gap: 10px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.count-number {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0px 0px;
    margin: 0px 0px;
}

.count-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0px 0px;
    margin: 0px 0px;
}

.gallery-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    align-content: start;
}

.photo-card {
    position: relative;
    background-color: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 16/10;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.photo-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.photo-card.status-selected {
    box-shadow: 0 0 0 4px var(--accent-green);
}

.photo-card.status-rejected {
    opacity: 0.4;
    filter: grayscale(100%);
    box-shadow: 0 0 0 4px var(--accent-red);
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay-bg);
    opacity: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.2s;
    z-index: 2;
}

.photo-card:hover .overlay {
    opacity: 1;
}

.btn-maximize {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    position: relative;
    z-index: 5;
    padding: 14px;
    box-sizing: border-box;
}

.btn-maximize svg {
    width: 100%;
    height: 100%;
    display: block;
}

.btn-maximize:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.3);
}

.actions-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    transform: translateY(100%);
    transition: transform 0.2s;
    z-index: 3;
}

.photo-card:hover .actions-bar {
    transform: translateY(0);
}

.action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.1s, background-color 0.2s;
    color: white;
}

.action-btn.active {
    transform: scale(1.15);
}

.btn-check.active {
    background-color: var(--accent-green) !important;
    color: white !important;
    border-color: var(--accent-green) !important;
}

.btn-cross.active {
    background-color: var(--accent-red) !important;
    color: white !important;
    border-color: var(--accent-red) !important;
}

.btn-check {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
}

.btn-check:hover {
    background-color: var(--accent-green);
    color: white;
}

.btn-cross {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--accent-red);
    color: var(--accent-red);
}

.btn-cross:hover {
    background-color: var(--accent-red);
    color: white;
}

.filename {
    position: absolute;
    top: 2%;
    left: 25%;
    right: 25%;
    padding: 5px 10px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 40px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 1;
}

/* Estilos del Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    /* Changed to hidden to manage scroll via container */
}

.modal-content-container {
    position: relative;
    max-width: 85%;
    max-height: 85%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible;
    transition: all 0.3s ease;
}

.modal-content-container.zoomed-container {
    display: block;
    /* Switch to block to allow full scrolling */
    max-width: 100vw;
    max-height: 100vh;
    width: 100vw;
    height: 100vh;
    overflow: auto;
    /* Enable native scrolling */
    padding: 0;
    margin: 0;
}

.modal-content {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.9);
    user-select: none;
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.modal-content.zoomed {
    transform: none;
    /* Disable transform scale */
    width: auto;
    height: auto;
    min-width: 220vw;
    /* Dimension-based zoom (2.2x width) */
    max-width: none;
    max-height: none;
    cursor: zoom-out;
}

.modal-filename-top {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 7px 20px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    /* Semibold */
    text-align: center;
    border-radius: 40px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    pointer-events: none;
    z-index: 2006;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
}

.zoomed-container~.modal-filename-top,
/* Move filename when container is zoomed */
.zoomed-container .modal-filename-top {
    position: fixed;
    top: 20px;
    left: 20px;
    transform: none;
    z-index: 2011;
    /* Above zoomed image */
}

.modal-close-btn {
    position: absolute;
    top: -60px;
    /* 40px height + 20px gap */
    right: -10px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.4rem;
    cursor: pointer;
    z-index: 2010;
    transition: all 0.3s ease;
}

.zoomed-container .modal-close-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2011;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.2);
}

.modal-arrow {
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    position: absolute;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s, transform 0.2s, color 0.2s;
    z-index: 2008;
    padding: 0 !important;
    padding: 0 !important;
    line-height: 0 !important;
}

.zoomed-container .modal-prev {
    position: fixed;
    left: 20px;
    z-index: 2011;
}

.zoomed-container .modal-next {
    position: fixed;
    right: 20px;
    z-index: 2011;
}

.modal-arrow svg {
    width: 28px;
    height: 28px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.modal-prev {
    left: 20px;
}

.modal-next {
    right: 20px;
}

.modal-arrow:hover {
    background: rgba(255, 255, 255, 0.4);
    color: var(--accent-primary);
    transform: translateY(-50%) scale(1.2);
}

.modal-actions-bar {
    position: absolute;
    bottom: -104px;
    /* ~84px height + 20px gap */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    padding: 12px 30px;
    border-radius: 60px;
    display: flex;
    gap: 40px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    z-index: 2007;
    transition: all 0.3s ease;
}

.zoomed-container .modal-actions-bar {
    position: fixed;
    bottom: 85px;
    /* Raised from 60px */
    left: 50%;
    transform: translateX(-50%);
    z-index: 2011;
}

.modal-actions-bar .action-btn {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    opacity: 1;
    transition: opacity 0.3s;
    z-index: 3000;
}

.toast.hidden {
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 480px) {
    .login-box {
        padding: 35px 20px;
        width: 88% !important;
        margin: 0 auto;
        max-width: 380px;
        transform: none !important;
        /* Resetear transformaciones de escritorio */
        background: rgba(30, 30, 30, 0.95);
        border: 1px solid rgba(255, 255, 255, 0.2);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
        box-sizing: border-box;
    }

    /* Reducción agresiva para Firefox Mobile */
    body.is-firefox-mobile .login-box {
        width: 78% !important;
        padding: 20px 10px;
    }

    body.is-firefox-mobile .login-logo {
        width: 150px;
    }

    body.is-firefox-mobile .login-box h2 {
        font-size: 1.2rem;
    }

    body.is-firefox-mobile .login-box p {
        font-size: 0.9rem;
    }

    .login-logo {
        width: 260px;
        /* Reducido de 300px para evitar empujar contenedores */
        max-width: 100%;
        margin-bottom: 20px;
    }

    .login-box h2 {
        font-size: 1.4rem;
        margin-bottom: 10px;
    }

    .login-box p {
        font-size: 1.05rem;
        margin-bottom: 25px;
    }

    #btn-login {
        width: 100%;
        padding: 14px;
        font-size: 1rem;
    }
}