/* ==========================================
   RESET E VARIÁVEIS BÁSICAS
   ========================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body { 
    font-family: 'Montserrat', sans-serif; 
    background-color: #ffffff; 
    color: #1a1a1a; 
    -webkit-font-smoothing: antialiased; 
    padding-bottom: 80px; 
}

a { text-decoration: none; color: inherit; }

/* ==========================================
   1. CAPA (HERO)
   ========================================== */
.hero { 
    position: relative; 
    height: 100vh; 
    height: 100dvh; 
    width: 100vw; 
    max-width: 100%;
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    background-color: #1a1a1a; 
    overflow: hidden;
}

.hero-cover-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    z-index: 0;
    -webkit-user-drag: none;
    user-select: none;
    pointer-events: none;
}

.hero::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.35); z-index: 1; }
.hero-content { position: relative; z-index: 2; text-align: center; color: #ffffff; padding: 0 20px;}
.hero-title { font-size: clamp(32px, 5vw, 56px); font-weight: 700; letter-spacing: 4px; margin-bottom: 10px; text-transform: uppercase; }

.btn-view { display: inline-block; border: 1px solid #ffffff; padding: 14px 35px; font-size: 11px; font-weight: 500; letter-spacing: 2px; text-transform: uppercase; color: #ffffff; transition: all 0.3s ease; cursor: pointer; }
.btn-view:hover { background-color: #ffffff; color: #000000; }

.hero-footer { position: absolute; bottom: 40px; z-index: 2; display: flex; flex-direction: column; align-items: center; }
.logo-box { width: 85px; height: 85px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.photographer-name { color: #ffffff; font-size: 10px; letter-spacing: 2px; text-transform: uppercase; }

/* ==========================================
   2. BARRA DE NAVEGAÇÃO / MENU (FIXADO PARA iOS)
   ========================================== */
.toolbar { 
    display: flex; 
    flex-wrap: nowrap; /* Tenta manter tudo em 1 linha em telas grandes */
    justify-content: space-between; 
    align-items: center; 
    padding: 15px 40px; 
    background-color: #ffffff; 
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 990; 
    border-bottom: 1px solid #f5f5f5; 
}

.toolbar-left { display: flex; flex-direction: column; flex-shrink: 0; order: 1; }
.toolbar-left h2 { font-size: 16px; font-weight: 700; letter-spacing: 1px; color: #1a1a1a; margin-bottom: 5px; text-transform: uppercase; }
.toolbar-left span { font-size: 10px; color: #888888; letter-spacing: 1.5px; text-transform: uppercase; }

.toolbar-center { 
    order: 2; /* Fica no meio na tela grande */
    display: flex; 
    flex: 1; 
    justify-content: center; 
    margin: 0 30px; 
    gap: 15px;
    overflow-x: auto; 
    white-space: nowrap; 
    -webkit-overflow-scrolling: touch;
}
.toolbar-center::-webkit-scrollbar { display: none; }

.cat-btn { font-size: 10px; font-weight: 600; color: #999999; letter-spacing: 1.5px; text-transform: uppercase; padding: 5px 0; border-bottom: 1px solid transparent; transition: all 0.2s ease;}
.cat-btn.active { color: #1a1a1a; border-bottom-color: #1a1a1a; }
.cat-btn:hover { color: #1a1a1a; }

.toolbar-right { display: flex; align-items: center; gap: 20px; color: #555555; flex-shrink: 0; order: 3; }

/* ==========================================
   3. GRID DE FOTOS (FLEX JUSTIFIED)
   ========================================== */
#main-content { padding: 20px; max-width: 100%; overflow-x: hidden; }

#imgbox { display: flex; flex-wrap: wrap; gap: 6px; }
#imgbox::after { content: ''; flex-grow: 999999999; }

.wrap { position: relative; cursor: pointer; background: #f5f5f7; overflow: hidden; }

/* BLOQUEIO DE DOWNLOAD MOBILE NAS THUMBS */
.wrap img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    display: block; 
    transition: transform 0.3s ease; 
    -webkit-touch-callout: none; 
    -webkit-user-select: none; 
    user-select: none; 
    -webkit-user-drag: none; 
    pointer-events: none; 
    image-rendering: auto;
}
.wrap:hover img { transform: scale(1.02); }

.wrap.selected img { opacity: 0.85; border: 3px solid #1a1a1a; }

.image-overlay { position: absolute; bottom: 0; left: 0; right: 0; padding: 40px 15px 15px; background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 100%); display: flex; justify-content: flex-end; gap: 15px; opacity: 0; transition: opacity 0.3s ease; }

.wrap:hover .image-overlay, .wrap.selected .image-overlay, .wrap.has-comment .image-overlay { opacity: 1; }

.image-overlay i { color: #ffffff; font-size: 24px; cursor: pointer; transition: transform 0.2s ease; }
.image-overlay i:hover { transform: scale(1.15); }
.image-overlay i.selected { color: #ff4d4d; }
.image-overlay i.btn-comment.ph-fill { color: #ffcc00; }

/* ==========================================
   4. BARRA DE SELEÇÃO FLUTUANTE
   ========================================== */
.selection-bar {
    position: fixed; bottom: 0; left: 0; width: 100%; background-color: #ffffff; box-shadow: 0 -4px 15px rgba(0,0,0,0.08); padding: 15px 40px; display: flex; justify-content: space-between; align-items: center; z-index: 1000; transform: translateY(100%); transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.selection-bar.visible { transform: translateY(0); }

.selection-info { display: flex; align-items: center; gap: 15px; }
.selection-info i { color: #ff4d4d; font-size: 24px; }

.status-texts { display: flex; flex-direction: column; }
#status-text { font-size: 14px; font-weight: 700; color: #1a1a1a; }
#status-extra { font-size: 11px; font-weight: 700; color: #dc2626; margin-top: 2px; }

.btn-send-selection { background-color: #1a1a1a; color: #ffffff; border: none; padding: 12px 30px; font-size: 11px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; cursor: pointer; transition: background-color 0.3s ease; }
.btn-send-selection:hover { background-color: #333333; }

/* ==========================================
   5. PAINEL DE COMENTÁRIOS E MODAIS
   ========================================== */
#comment-panel { position: absolute; bottom: 90px; left: 50%; transform: translateX(-50%); background: #ffffff; padding: 20px; border-radius: 12px; width: 90%; max-width: 450px; z-index: 9010; display: flex; flex-direction: column; gap: 15px; }
#comment-input { width: 100%; height: 90px; padding: 12px; border: 1px solid #e2e8f0; border-radius: 8px; font-family: inherit; font-size: 13px; resize: none; }
.comment-actions { display: flex; gap: 10px; justify-content: flex-end; }
.comment-actions button { padding: 10px 20px; border-radius: 6px; border: none; font-weight: 600; cursor: pointer; font-size: 13px; }
#cancel-comment { background: #f1f5f9; color: #475569; }
#save-comment { background: #1a1a1a; color: white; }

#modal-finalizar, #modal-resumo-cliente { position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 9999; display: flex; align-items: center; justify-content: center; }
.modal-content { background: white; padding: 30px; border-radius: 12px; width: 90%; max-width: 500px; box-shadow: 0 15px 40px rgba(0,0,0,0.4); }
.modal-content h3 { margin-bottom: 10px; font-size: 22px; color: #1a1a1a; }
#obs-geral { width: 100%; height: 100px; padding: 12px; border: 1px solid #e2e8f0; border-radius: 8px; font-family: inherit; font-size: 13px; resize: none; margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.modal-actions button { padding: 12px 20px; border-radius: 6px; border: none; font-weight: 600; cursor: pointer; font-size: 13px; }
#btn-cancelar-envio { background: #f1f5f9; color: #475569; }
#btn-confirmar-envio { background: #1a1a1a; color: white; }

.modal-header-flex { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; border-bottom: 1px solid #f5f5f5; padding-bottom: 15px;}
.close-modal { font-size: 24px; cursor: pointer; color: #999; }
.close-modal:hover { color: #1a1a1a; }

#loading-spinner { text-align: center; padding: 100px; color: #999; }
.spinner { border: 3px solid #f3f3f3; border-top: 3px solid #1a1a1a; border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; margin: 0 auto 20px; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ==========================================
   BOTÃO VOLTAR AO TOPO
   ========================================== */
.scroll-top-btn {
    position: fixed;
    bottom: 20px;
    left: 30px;
    background-color: #1a1a1a;
    color: #ffffff;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 998;
}

.scroll-top-btn.show { opacity: 1; visibility: visible; transform: translateY(0); }
.scroll-top-btn:hover { background-color: #333333; transform: translateY(-3px); }
.scroll-top-btn.lifted { bottom: 95px; }

/* ==========================================
   RESPONSIVIDADE INTERMEDIÁRIA (Telas Médias/Notebooks)
   Se apertar demais, joga as categorias para a linha de baixo
   ========================================== */
@media (max-width: 1250px) {
    .toolbar { 
        flex-wrap: wrap; /* Permite quebrar a linha */
        padding: 15px 40px 0 40px; 
    }
    
    .toolbar-left { margin-bottom: 15px; }
    
    .toolbar-right { 
        order: 2; /* Sobe os botões para o lado do Logo */
        margin-bottom: 15px; 
        gap: 15px; 
    }
    
    .toolbar-center { 
        order: 3; /* Cai para a linha de baixo */
        width: 100%; 
        flex: none;
        margin: 0; 
        padding-bottom: 15px;
        gap: 25px;
    }
}

/* ==========================================
   RESPONSIVIDADE CELULAR E TABLET COMPACTO
   ========================================== */
@media (max-width: 850px) {
    /* ESCONDE OS TEXTOS DA BARRA SUPERIOR, MOSTRANDO SÓ OS ÍCONES */
    .text-desktop-sel { display: none !important; }
    
    .toolbar { 
        padding: 10px 0 0 0; 
    }
    
    .toolbar-left { 
        padding: 0 10px 8px 20px; 
        margin-bottom: 0; 
        flex: 1 1 0; 
        min-width: 0; 
    }
    
    .toolbar-left h2 { 
        white-space: normal; 
        word-break: break-word; 
        overflow-wrap: break-word; 
        line-height: 1.2; 
    }
    
    .toolbar-right { 
        padding: 0 20px 8px 10px; 
        margin-bottom: 0;
        gap: 15px !important; 
    }
    
    .toolbar-center { 
        background-color: #f6f6f6; 
        padding: 0 15px; 
        gap: 12px;
    }
    
    .cat-btn { font-size: 9px; padding: 10px 0; margin-right: 6px; }
    .cat-btn.active { border-bottom-width: 2px; }
    
    #main-content { padding: 10px 15px; overflow-x: hidden; } 
    #imgbox { gap: 6px; } 
    
    .selection-bar { padding: 10px 15px; flex-direction: row; justify-content: space-between; align-items: center; gap: 8px; }
    .selection-info { gap: 8px; }
    .selection-info i { font-size: 18px; }
    #status-text { font-size: 11px; }
    #status-extra { font-size: 9px; }
    .btn-send-selection { width: auto; padding: 10px 15px; font-size: 9px; letter-spacing: 1px; }
    
    .scroll-top-btn { bottom: 20px; left: 15px; width: 40px; height: 40px; font-size: 18px; }
    .scroll-top-btn.lifted { bottom: 80px; }
}

/* ==========================================
   LAYOUT PANEL
   ========================================== */

#layout-panel-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 9400;
}
#layout-panel-overlay.open { display: block; }

/* Mobile: slide up from bottom */
#layout-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -6px 30px rgba(0,0,0,0.15);
    z-index: 9500;
    padding: 0 22px 34px;
    transform: translateY(105%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 90vh;
    overflow-y: auto;
}
#layout-panel.open { transform: translateY(0); }

/* Desktop: slide in from right */
@media (min-width: 601px) {
    #layout-panel {
        left: auto;
        right: 0;
        top: 0;
        bottom: 0;
        border-radius: 0;
        width: 300px;
        transform: translateX(105%);
        max-height: 100vh;
        padding: 0 24px 40px;
    }
    #layout-panel.open { transform: translateX(0); }
}

.layout-panel-drag-handle {
    width: 36px;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    margin: 14px auto 20px;
}
@media (min-width: 601px) { .layout-panel-drag-handle { display: none; } }

.layout-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
    padding-top: 24px;
}
@media (min-width: 601px) { .layout-panel-header { padding-top: 30px; } }

.layout-panel-header > span {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: #1a1a1a;
}

.layout-panel-close {
    font-size: 24px;
    cursor: pointer;
    color: #aaa;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}
.layout-panel-close:hover { color: #1a1a1a; }

.layout-control {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 22px;
}

.layout-control-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.layout-control-label .lc-name {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #1a1a1a;
}

.layout-control-label .lc-val {
    font-size: 11px;
    font-weight: 500;
    color: #888;
    min-width: 44px;
    text-align: right;
}

.layout-control input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: #e5e5e5;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    accent-color: #1a1a1a;
}
.layout-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1a1a1a;
    cursor: pointer;
}
.layout-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1a1a1a;
    cursor: pointer;
    border: none;
}

.layout-divider {
    height: 1px;
    background: #f0f0f0;
    margin: 4px 0 22px;
}

/* Botões de tema (Light / Dark) */
.layout-theme-btns {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}

.layout-theme-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 12px 6px;
    border: 1px solid #e5e5e5;
    background: #fafafa;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-family: 'Montserrat', sans-serif;
}

.layout-theme-btn i {
    font-size: 20px;
    color: #bbb;
    transition: color 0.2s;
}

.layout-theme-btn span {
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #bbb;
    transition: color 0.2s;
}

.layout-theme-btn.active {
    border-color: #1a1a1a;
    background: #1a1a1a;
}
.layout-theme-btn.active i,
.layout-theme-btn.active span { color: #ffffff; }

.layout-theme-btn:not(.active):hover {
    border-color: #999;
    background: #f0f0f0;
}
.layout-theme-btn:not(.active):hover i,
.layout-theme-btn:not(.active):hover span { color: #1a1a1a; }

/* Painel de layout no tema dark */
body.theme-dark #layout-panel {
    background: #1a1a1a;
}
body.theme-dark .layout-panel-header > span {
    color: #ffffff;
}
body.theme-dark .layout-panel-close {
    color: #666;
}
body.theme-dark .layout-panel-close:hover {
    color: #ffffff;
}
body.theme-dark .layout-control-label .lc-name { color: #e0e0e0; }
body.theme-dark .layout-control-label .lc-val { color: #666; }
body.theme-dark .layout-divider { background: #333; }
body.theme-dark .layout-control input[type="range"] { background: #333; accent-color: #ffffff; }
body.theme-dark .layout-control input[type="range"]::-webkit-slider-thumb { background: #ffffff; }
body.theme-dark .layout-control input[type="range"]::-moz-range-thumb { background: #ffffff; }
body.theme-dark .layout-theme-btn {
    border-color: #333;
    background: #111;
}
body.theme-dark .layout-theme-btn i,
body.theme-dark .layout-theme-btn span { color: #666; }
body.theme-dark .layout-theme-btn.active {
    border-color: #ffffff;
    background: #ffffff;
}
body.theme-dark .layout-theme-btn.active i,
body.theme-dark .layout-theme-btn.active span { color: #000000; }
body.theme-dark #btn-salvar-layout {
    background: #ffffff;
    color: #000000;
}
body.theme-dark #btn-salvar-layout:hover {
    background: #dddddd;
}

/* ==========================================
   TEMA DARK — Ativado via body.theme-dark
   ========================================== */
body.theme-dark {
    background-color: #3b3833;
    color: #e0e0e0;
}

body.theme-dark .toolbar {
    background-color: #3b3833;
    border-bottom-color: #4a4540;
}

body.theme-dark .toolbar-left h2 {
    color: #ffffff;
}

body.theme-dark .toolbar-left span {
    color: #666666;
}

body.theme-dark .toolbar-right {
    color: #aaaaaa;
}

body.theme-dark .nav-btn {
    color: #aaaaaa !important;
}
body.theme-dark .nav-btn:hover {
    color: #ffffff !important;
}

body.theme-dark .cat-btn {
    color: #666666;
}
body.theme-dark .cat-btn.active {
    color: #ffffff;
    border-bottom-color: #ffffff;
}
body.theme-dark .cat-btn:hover {
    color: #ffffff;
}

body.theme-dark #main-content {
    background-color: #3b3833;
}

body.theme-dark .wrap {
    background: #1a1a1a;
}

body.theme-dark .selection-bar {
    background-color: #111111;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.4);
}

body.theme-dark #status-text {
    color: #ffffff;
}

body.theme-dark .btn-send-selection {
    background-color: #ffffff;
    color: #000000;
}
body.theme-dark .btn-send-selection:hover {
    background-color: #dddddd;
}

/* Lightbox dark */
body.theme-dark #lightbox {
    background-color: #000000 !important;
}

body.theme-dark #lightbox-top-bar {
    background-color: transparent !important;
}

body.theme-dark #lightbox-filename {
    color: #ffffff !important;
}

body.theme-dark #close-lightbox,
body.theme-dark #fullscreen-lightbox,
body.theme-dark #zoom-lightbox,
body.theme-dark #download-lightbox-pc {
    color: #ffffff !important;
}

body.theme-dark #lightbox-bottom-bar {
    background: #000000 !important;
}

body.theme-dark #lightbox-comment-btn,
body.theme-dark #lightbox-select-btn {
    color: #ffffff !important;
}

body.theme-dark #prev-btn,
body.theme-dark #next-btn {
    color: #ffffff !important;
}

body.theme-dark #comment-panel {
    background: #1a1a1a !important;
    border-color: #333 !important;
}

body.theme-dark #comment-input {
    background: #222 !important;
    color: #e0e0e0 !important;
    border-color: #444 !important;
}

body.theme-dark #cancel-comment {
    background: #333;
    color: #ccc;
}

body.theme-dark #save-comment {
    background: #ffffff;
    color: #000000;
}

/* Modais dark */
body.theme-dark .modal-content,
body.theme-dark #modal-finalizar .modal-content,
body.theme-dark #modal-resumo-cliente .modal-content {
    background: #1a1a1a;
    color: #e0e0e0;
}

body.theme-dark .modal-content h3 {
    color: #ffffff;
}

body.theme-dark #obs-geral {
    background: #222;
    color: #e0e0e0;
    border-color: #444;
}

body.theme-dark #btn-cancelar-envio {
    background: #333;
    color: #ccc;
}

body.theme-dark #btn-confirmar-envio {
    background: #ffffff;
    color: #000000;
}

body.theme-dark .close-modal {
    color: #666;
}
body.theme-dark .close-modal:hover {
    color: #ffffff;
}

body.theme-dark .modal-header-flex {
    border-bottom-color: #333;
}

body.theme-dark #resumo-texto-cliente {
    background: #222 !important;
    color: #ccc !important;
    border-color: #333 !important;
}

/* Scroll top button dark */
body.theme-dark .scroll-top-btn {
    background-color: #ffffff;
    color: #000000;
}
body.theme-dark .scroll-top-btn:hover {
    background-color: #dddddd;
}

/* Loading spinner dark */
body.theme-dark #loading-spinner {
    color: #666;
}
body.theme-dark .spinner {
    border-color: #333;
    border-top-color: #ffffff;
}

/* Toolbar mobile dark */
@media (max-width: 850px) {
    body.theme-dark .toolbar-center {
        background-color: #3b3833;
    }
}

/* Lightbox mobile dark */
@media (max-width: 600px) {
    body.theme-dark #lightbox-top-bar {
        background-color: #000000 !important;
        border-bottom-color: #222 !important;
    }
    body.theme-dark #lightbox-bottom-bar {
        background: #000000 !important;
    }
}

/* Modal compartilhar dark */
body.theme-dark #modal-compartilhar > div {
    background: #1a1a1a !important;
}
body.theme-dark #modal-compartilhar h3 {
    color: #ffffff !important;
}
body.theme-dark .share-option {
    color: #e0e0e0 !important;
}
body.theme-dark .share-option:hover,
body.theme-dark .share-option:active {
    background: #222 !important;
}

/* Email ZIP modal dark */
body.theme-dark #modal-email-zip .modal-content {
    background: #1a1a1a !important;
}
body.theme-dark #modal-email-zip h3 {
    color: #ffffff !important;
}
body.theme-dark #modal-email-zip p {
    color: #aaa !important;
}
body.theme-dark #email-zip-input {
    background: #222 !important;
    color: #e0e0e0 !important;
    border-color: #444 !important;
}
}