/* ========== RESET E BASE ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #1B2021;
    font-family: 'Arial', sans-serif;
    color: #F4E409;
    overflow-x: hidden;
}

/* ========== FRASE INICIAL ========== */
#inicio {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #1B2021;
    z-index: 9999;
    animation: fadeOut 3s forwards 2.5s;
}

#inicio h1 {
    font-family: 'Bowlby One SC', sans-serif;
    font-size: clamp(2rem, 8vw, 5rem);
    color: #F4E409;
    text-align: center;
    animation: zoom 2s ease;
    text-shadow: 4px 4px 12px rgba(0,0,0,0.6);
    padding: 0 20px;
}

@keyframes zoom {
    from { transform: scale(0.5); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

@keyframes fadeOut {
    to { opacity: 0; visibility: hidden; }
}

/* ========== HEADER ========== */
#header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(27, 32, 33, 0.95);
    backdrop-filter: blur(10px);
    padding: 20px 0;
    z-index: 1000;
    opacity: 0;
    transition: opacity 1s ease;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    height: 80px;
    display: flex;
    align-items: center;
}

#header .container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

#header h2 {
    font-family: 'Bowlby One SC', sans-serif;
    font-size: 1.8rem;
    color: #F4E409;
    margin: 0;
    white-space: nowrap;
}

.btn-upload {
    background: #F4E409;
    color: #1B2021;
    padding: 12px 28px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-upload:hover {
    background: #fff;
    transform: scale(1.05);
}

/* ========== GALERIA ========== */
.hidden {
    opacity: 0;
    pointer-events: none;
}

#galeria {
    column-count: 3;
    column-gap: 12px;
    padding: 120px 20px 40px 20px;
    transition: opacity 1s ease;
    min-height: 100vh;
}

#galeria:not(.hidden) {
    opacity: 1;
}

/* Tamanhos do grid (controle de zoom) */
#galeria.size-small {
    column-count: 5;
}

#galeria.size-medium {
    column-count: 3;
}

#galeria.size-large {
    column-count: 2;
}

#galeria .item {
    break-inside: avoid;
    margin-bottom: 12px;
}

#galeria img {
    width: 100%;
    display: block;
    border-radius: 8px;
    background: #30343F;
    box-shadow: 0 6px 16px rgba(0,0,0,0.5);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#galeria img:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 24px rgba(244,228,9,0.3);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 100px 20px;
}

.empty-state .icon {
    font-size: 5rem;
    margin-bottom: 20px;
}

.empty-state p {
    color: #626868;
    font-size: 1.5rem;
    margin-bottom: 30px;
}

.empty-state .btn {
    background: #F4E409;
    color: #1B2021;
    padding: 15px 40px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
    transition: all 0.3s;
}

.empty-state .btn:hover {
    background: #fff;
    transform: scale(1.05);
}

/* ========== CONTROLE DE ZOOM DO GRID ========== */
#gridControl {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: rgba(48, 52, 63, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#gridControl .label {
    color: #626868;
    font-size: 0.8rem;
    text-align: center;
    font-weight: bold;
    margin-bottom: 5px;
}

#gridControl .buttons {
    display: flex;
    gap: 8px;
}

#gridControl button {
    background: #626868;
    color: #fff;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s;
}

#gridControl button:hover {
    background: #F4E409;
    color: #1B2021;
    transform: scale(1.1);
}

#gridControl button.active {
    background: #F4E409;
    color: #1B2021;
    box-shadow: 0 0 0 3px rgba(244, 228, 9, 0.3);
}

/* ========== MODAL ========== */
#modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.95);
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

#modal img {
    max-width: 90%;
    max-height: 85%;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
}

#closeModal {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 3.5rem;
    color: #F4E409;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 10001;
}

#closeModal:hover {
    color: #fff;
}

/* ========== FRASE FLUTUANTE NO MODAL ========== */
#modalWatermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Bowlby One SC', sans-serif;
    font-size: clamp(3rem, 10vw, 8rem);
    color: rgba(244, 228, 9, 0.08);
    text-align: center;
    pointer-events: none;
    z-index: 10000;
    white-space: nowrap;
    user-select: none;
    text-shadow: 0 0 40px rgba(244, 228, 9, 0.15);
}

/* ========== BOTÃO AUTOPLAY DISCRETO ========== */
#toggleAutoplay {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(48, 52, 63, 0.7);
    color: #F4E409;
    border: 1px solid rgba(244, 228, 9, 0.3);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}

#toggleAutoplay:hover {
    background: rgba(244, 228, 9, 0.9);
    color: #1B2021;
    transform: scale(1.1);
}

/* ========== BARRA DE PROGRESSO DO AUTOPLAY ========== */
#autoplayProgress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #F4E409 0%, #fff 100%);
    width: 0%;
    transition: width 0.02s linear;
    z-index: 10001;
}

/* ========== TRANSIÇÃO SUAVE DA IMAGEM ========== */
#modal img {
    max-width: 90%;
    max-height: 85%;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    transition: opacity 0.3s ease;
}

/* ========== RESPONSIVO ========== */
@media (max-width: 768px) {
    #modalWatermark {
        font-size: clamp(2rem, 8vw, 4rem);
    }

    #toggleAutoplay {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        bottom: 15px;
        right: 15px;
    }
}


/* Autoplay minimalista */
#toggleAutoplay {
    position: absolute;
    bottom: 25px;
    right: 30px;
    background: rgba(48, 52, 63, 0.85);
    color: #F4E409;
    border: none;
    padding: 10px 14px;
    font-size: 0.85rem;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    z-index: 10002;
    opacity: 0.8;
}

#toggleAutoplay:hover {
    opacity: 1;
    transform: scale(1.05);
}

/* Estado desligado */
#toggleAutoplay.off {
    background: rgba(98, 104, 104, 0.7);
    color: #fff;
}


/* Botões de navegação */
.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(244, 228, 9, 0.9);
    color: #1B2021;
    border: none;
    font-size: 3rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 10001;
}

.nav-btn:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.1);
}

.nav-btn.prev {
    left: 30px;
}

.nav-btn.next {
    right: 30px;
}

/* Contador de imagens */
#imageCounter {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(244, 228, 9, 0.9);
    color: #1B2021;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: bold;
    z-index: 10001;
}

/* ========== LOADING ========== */
#loading {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9998;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #626868;
    border-top-color: #F4E409;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ========== RESPONSIVO ========== */
@media (max-width: 1200px) {
    #galeria:not(.size-small):not(.size-medium):not(.size-large) {
        column-count: 3;
    }

    #galeria.size-small {
        column-count: 4;
    }
}

@media (max-width: 768px) {
    /* Header */
    #header {
        height: 70px;
        padding: 15px 0;
    }

    #header h2 {
        font-size: 1.4rem;
    }

    .btn-upload {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    /* Galeria */
    #galeria {
        padding-top: 100px;
    }

    #galeria:not(.size-small):not(.size-medium):not(.size-large) {
        column-count: 2;
    }

    #galeria.size-small {
        column-count: 3;
    }

    #galeria.size-medium {
        column-count: 2;
    }

    #galeria.size-large {
        column-count: 1;
    }

    /* Controle de zoom */
    #gridControl {
        bottom: 15px;
        right: 15px;
        padding: 10px;
    }

    #gridControl button {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    /* Modal */
    .nav-btn {
        width: 45px;
        height: 45px;
        font-size: 2rem;
    }

    .nav-btn.prev {
        left: 10px;
    }

    .nav-btn.next {
        right: 10px;
    }

    #closeModal {
        font-size: 2.5rem;
        top: 10px;
        right: 15px;
    }

    #toggleAutoplay {
        bottom: 15px;
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    /* Galeria */
    #galeria {
        padding-top: 90px;
    }

    #galeria:not(.size-small):not(.size-medium):not(.size-large) {
        column-count: 1;
    }

    #galeria.size-small {
        column-count: 2;
    }

    #galeria.size-medium {
        column-count: 1;
    }
}

/* Marca d’água / branding dentro do modal */
#modalBrand {
    position: absolute;
    top: 25px;
    left: 25px;
    font-family: 'Bowlby One SC', sans-serif;
    font-size: 2rem;
    color: rgba(244, 228, 9, 0.85);
    letter-spacing: 1px;
    pointer-events: none;
    z-index: 10002;

    /* sombra elegante */
    text-shadow: 4px 4px 12px rgba(0,0,0,0.55);
}

/* Mobile */
@media (max-width: 768px) {
    #modalBrand {
        font-size: 1.4rem;
        top: 18px;
        left: 18px;
    }
}
