/**
 * Maisbook V3 - Estilos da Área do Cliente
 */

/* ==========================================
   PROTEÇÃO DE IMAGENS
   ========================================== */

/* Desabilitar seleção de texto e imagens */
.maisbook-page,
.gallery-grid,
.gallery-item,
.lightbox,
.lightbox-content {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
}

/* Permitir seleção apenas em inputs e textareas */
input,
textarea {
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

/* ==========================================
   LAYOUT GERAL
   ========================================== */

.maisbook-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.maisbook-header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    height: 80px;
    padding: 0;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.maisbook-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
}

.maisbook-logo {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.5px;
    transition: transform var(--transition-normal), opacity var(--transition-fast);
}

.maisbook-logo:hover {
    color: #fff;
    transform: scale(1.02);
    opacity: 0.95;
}

.maisbook-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: var(--font-size-sm);
    color: rgba(255, 255, 255, 0.9);
}

.maisbook-user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.maisbook-user-plano {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

.maisbook-user-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.14);
    border: 2px solid rgba(255, 255, 255, 0.22);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    backdrop-filter: blur(8px);
}

.maisbook-logout-btn {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.14);
    border: 2px solid rgba(255, 255, 255, 0.22);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all var(--transition-fast);
    backdrop-filter: blur(8px);
    padding: 0;
    margin-left: 8px;
}

.maisbook-logout-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.35);
    transform: translateY(-2px);
}

.maisbook-logout-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.maisbook-main {
    flex: 1;
    padding: 60px 0 80px 0;
}

.selecao-page .maisbook-main {
    padding-bottom: 120px; /* Espaço para a barra fixa */
}

.maisbook-footer {
    background: var(--color-bg-card);
    padding: 20px 0;
    text-align: center;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    border-top: 1px solid #E5E5E5;
}

/* ==========================================
   PÁGINA DE ACESSO (LOGIN)
   ========================================== */

.acesso-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(1200px 600px at 20% 10%, rgba(198, 40, 61, 0.14), transparent 55%),
                radial-gradient(900px 500px at 85% 30%, rgba(26, 26, 46, 0.14), transparent 55%),
                var(--color-bg);
}

.acesso-box {
    width: 100%;
    max-width: 440px;
    text-align: center;
}

.acesso-logo {
    margin-bottom: 40px;
}

.acesso-logo h1 {
    font-size: var(--font-size-3xl);
    font-weight: 800;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.acesso-logo p {
    color: var(--color-text-light);
    margin-top: 8px;
}

.acesso-card {
    background: var(--color-bg-card);
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(26, 26, 46, 0.06);
}

.acesso-card h2 {
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin-bottom: 8px;
}

.acesso-card p {
    color: var(--color-text-light);
    margin-bottom: 30px;
}

.acesso-input {
    width: 100%;
    padding: 18px 24px;
    font-size: var(--font-size-lg);
    text-align: center;
    letter-spacing: 4px;
    text-transform: uppercase;
    font-weight: 600;
    border: 2px solid #E5E5E5;
    border-radius: var(--radius-lg);
    background: #F8F9FA;
    transition: all var(--transition-fast);
}

.acesso-input:focus {
    outline: none;
    border-color: var(--color-primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.1);
}

.acesso-input::placeholder {
    letter-spacing: normal;
    font-weight: 400;
    color: var(--color-text-muted);
}

.acesso-btn {
    margin-top: 20px;
}

.acesso-error {
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(225, 112, 85, 0.1);
    border-radius: var(--radius-md);
    color: var(--color-error);
    font-size: var(--font-size-sm);
    display: none;
}

.acesso-error.show {
    display: block;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

/* ==========================================
   DASHBOARD DO CLIENTE
   ========================================== */

.dashboard-welcome {
    text-align: left;
    margin-bottom: 40px;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.dashboard-welcome h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 10px;
    letter-spacing: -1px;
}

.dashboard-welcome p {
    color: var(--color-text-light);
    font-size: 1.1rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    max-width: 1000px;
    margin: 0 auto;
}

.selection-card {
    background: var(--color-bg-card);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    border-left: 4px solid var(--color-primary);
    min-height: 320px;
    display: flex;
    flex-direction: column;
}

.selection-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.selection-card.completed {
    border-left-color: var(--color-success);
}

.selection-card.completed::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(900px 240px at 0% 0%, rgba(0, 184, 148, 0.10), transparent 55%);
    pointer-events: none;
}

.selection-card.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.selection-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, rgba(198, 40, 61, 0.16), rgba(198, 40, 61, 0.06));
    border: 1px solid rgba(198, 40, 61, 0.18);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 20px;
}

.selection-card.album .selection-icon {
    background: linear-gradient(135deg, rgba(198, 40, 61, 0.18), rgba(232, 90, 113, 0.08));
    border-color: rgba(198, 40, 61, 0.22);
}

.selection-card.poster .selection-icon {
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.16), rgba(26, 26, 46, 0.06));
    border-color: rgba(26, 26, 46, 0.18);
}

.selection-card.polaroide .selection-icon {
    background: linear-gradient(135deg, rgba(253, 203, 110, 0.22), rgba(253, 203, 110, 0.10));
    border-color: rgba(253, 203, 110, 0.28);
}

.selection-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin-bottom: 8px;
}

.selection-desc {
    color: var(--color-text-light);
    font-size: var(--font-size-sm);
    margin-bottom: 20px;
}

.selection-progress {
    margin-bottom: 20px;
}

.progress-bar {
    height: 8px;
    background: #E5E5E5;
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

.progress-text {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    display: flex;
    justify-content: space-between;
}

.selection-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
    margin-bottom: 20px;
}

.selection-status.pending {
    background: rgba(253, 203, 110, 0.2);
    color: #B7791F;
}

.selection-status.completed {
    background: rgba(0, 184, 148, 0.15);
    color: var(--color-success);
}

.selection-btn {
    width: 100%;
    margin-top: auto;
}

/* ==========================================
   PÁGINA DE SELEÇÃO DE FOTOS
   ========================================== */

.selecao-page .maisbook-main {
    padding: 30px 0 120px 0; /* Espaço para a barra fixa */
}

.selecao-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 16px;
}

.selecao-header h1 {
    font-size: var(--font-size-2xl);
    font-weight: 700;
}

.selecao-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.selecao-counter {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--color-bg-card);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.selecao-counter .count {
    font-size: var(--font-size-lg);
    color: var(--color-primary);
}

.selecao-counter .limit {
    color: var(--color-text-muted);
}

.selecao-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--color-text-light);
    font-size: var(--font-size-sm);
    transition: color var(--transition-fast);
}

.selecao-back:hover {
    color: var(--color-primary);
}

/* Galeria */
.gallery-loading {
    text-align: center;
    padding: 60px 20px;
}

.gallery-loading .spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto 20px;
}

/* Seções de pastas */
.gallery-folder-section {
    margin-bottom: 50px;
}

.gallery-folder-section:last-child {
    margin-bottom: 0;
}

.gallery-folder-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid rgba(198, 40, 61, 0.15);
}

.gallery-folder-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--color-primary);
    margin: 0;
}

.gallery-folder-title svg {
    color: var(--color-primary);
    opacity: 0.8;
}

.gallery-folder-count {
    font-size: var(--font-size-base);
    font-weight: 500;
    color: var(--color-text-muted);
    margin-left: 4px;
}

.gallery-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
    padding: 20px 0 0 0;
    justify-content: space-around;
    align-items: stretch;
    align-content: center;
}

.gallery-folder-section:last-child .gallery-grid {
    padding-bottom: 180px;
}

/* Desktop grande - 5 colunas */
@media (min-width: 1400px) {
    .gallery-grid {
        gap: 12px;
    }
    
    .gallery-item {
        width: calc((100% - (14px * 4)) / 5);
    }
    
    .gallery-item.horizontal {
        width: calc(((100% - (14px * 4)) / 5) * 2 + 14px);
    }
}

/* Desktop médio - 4 colunas */
@media (min-width: 1024px) and (max-width: 1399px) {
    .gallery-grid {
        gap: 12px;
    }
    
    .gallery-item {
        width: calc((100% - (12px * 3)) / 4);
    }
    
    .gallery-item.horizontal {
        width: calc(((100% - (12px * 3)) / 4) * 2 + 12px);
    }
}

/* Tablet - 3 colunas */
@media (min-width: 769px) and (max-width: 1023px) {
    .gallery-grid {
        gap: 10px;
    }
    
    .gallery-item {
        width: calc((100% - (10px * 2)) / 3);
    }
    
    .gallery-item.horizontal {
        width: calc(((100% - (10px * 2)) / 3) * 2 + 10px);
    }
}

.gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all var(--transition-normal);
    border: 3px solid transparent;
    display: grid;
    width: calc((100% - (12px * 3)) / 4);
    line-height: 0;
    pointer-events: auto;
    align-content: center;

}
.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    pointer-events: none;
    -webkit-touch-callout: none;
    transition: transform var(--transition-normal);
    transform: scale(1.02);
}

/* Imagens horizontais ocupam mais espaço (2 colunas) */
.gallery-item.horizontal {
    width: calc(((100% - (12px * 3)) / 4) * 2 + 12px);
}

.gallery-item:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
    border-color: rgba(198, 40, 61, 0.35);
    z-index: 10;
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    pointer-events: none;
    -webkit-touch-callout: none;
}

.gallery-item::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity var(--transition-normal);
    z-index: 2;
    pointer-events: none;
}

.gallery-item:hover::before {
    opacity: 1;
}

.gallery-item.selected {
    box-shadow: 0 0 0 4px rgba(198, 40, 61, 0.22), 0 14px 30px rgba(0, 0, 0, 0.14);
    border-color: rgba(198, 40, 61, 0.55);
}

.gallery-item-check {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 32px;
    height: 32px;
    background: rgba(14, 180, 22, 0.95);
    border: 2px solid white;
    color: white;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.gallery-item-check svg {
    width: 18px;
    height: 18px;
    stroke-width: 3;
}

.gallery-item-overlay {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    opacity: 0;
    transition: opacity var(--transition-fast);
    pointer-events: none;
    z-index: 5;
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

/* O overlay não deve bloquear cliques, apenas os botões */
.gallery-item-overlay {
    pointer-events: none;
}

.gallery-item-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 10;
    pointer-events: auto;
}

.gallery-item-fullscreen,
.gallery-item-download {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all var(--transition-fast);
    color: #1A1A2E;
}

.gallery-item-fullscreen:hover {
    background: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.gallery-item-download:hover {
    background: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    color: #10B981;
}

.gallery-item-download:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.gallery-item-fullscreen svg,
.gallery-item-download svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.spinner-small {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(26, 26, 46, 0.2);
    border-top-color: #1A1A2E;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ==========================================
   BARRA DE AÇÕES FLUTUANTE
   ========================================== */
.action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 16px 24px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-bar.visible {
    transform: translateY(0);
}

.action-bar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 800px;
    gap: 20px;
}

.action-bar-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.selection-count {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.selection-count .current {
    font-size: 2rem;
    font-weight: 800;
    color: #C41E3A;
    line-height: 1;
}

.selection-count .separator {
    color: #9CA3AF;
    font-size: 1.2rem;
}

.selection-count .max {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1A1A2E;
}

.selection-label {
    color: #6B7280;
    font-size: 0.9rem;
}

/* Barra de progresso */
.progress-bar-container {
    flex: 1;
    max-width: 200px;
    height: 8px;
    background: #E5E7EB;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #C41E3A, #E85A71);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-bar.full {
    background: linear-gradient(90deg, #10B981, #34D399);
}

.progress-bar.over {
    background: linear-gradient(90deg, #EF4444, #F87171);
}

.action-bar-buttons {
    display: flex;
    gap: 12px;
}

.btn-clear {
    padding: 12px 20px;
    background: #F3F4F6;
    color: #374151;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-clear:hover {
    background: #E5E7EB;
}

.btn-confirm {
    padding: 12px 28px;
    background: linear-gradient(135deg, #C41E3A, #E85A71);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(196, 30, 58, 0.3);
}

.btn-confirm:hover {
    background: linear-gradient(135deg, #A01A2E, #C41E3A);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(196, 30, 58, 0.4);
}

.btn-preview {
    padding: 12px 28px;
    background: linear-gradient(135deg, #C41E3A, #E85A71);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(196, 30, 58, 0.3);
}

.btn-preview:hover {
    background: linear-gradient(135deg, #A01A2E, #C41E3A);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(196, 30, 58, 0.4);
}

.btn-download {
    padding: 12px 28px;
    background: linear-gradient(135deg, #10B981, #059669);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-download:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.btn-download:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Botão Voltar */
.btn-voltar {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #6B7280, #4B5563);
    color: white;
    text-decoration: none;
    font-weight: 600;
    border-radius: 10px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.btn-voltar:hover {
    background: linear-gradient(135deg, #4B5563, #374151);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(107, 114, 128, 0.4);
    color: white;
    text-decoration: none;
}

.btn-voltar:active {
    transform: translateY(0);
}

.btn-voltar-modal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #6B7280, #4B5563);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
    min-width: 140px;
    font-family: inherit;
}

.btn-voltar-modal:hover {
    background: linear-gradient(135deg, #4B5563, #374151);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(107, 114, 128, 0.4);
}

.btn-voltar-modal:active {
    transform: translateY(0);
}

/* ==========================================
   MODAL / LIGHTBOX
   ========================================== */

.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 20px;
    pointer-events: auto;
}

.lightbox-image {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    pointer-events: none;
    -webkit-touch-callout: none;
    max-width: 100%;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: var(--radius-full);
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: var(--radius-full);
    color: white;
    font-size: 28px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-actions {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
}

.lightbox-select {
    padding: 14px 32px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.lightbox-select:hover {
    background: var(--color-primary-dark);
    transform: scale(1.05);
}

.lightbox-select.selected {
    background: var(--color-success);
}

/* ==========================================
   MODAL DE PRÉVIA
   ========================================== */

.preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.preview-modal.active {
    opacity: 1;
    visibility: visible;
}

.preview-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
}

.preview-modal-content {
    position: relative;
    background: white;
    max-width: 1200px;
    max-height: 90vh;
    margin: 5vh auto;
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1;
}

.preview-modal-header {
    padding: 24px 32px;
    border-bottom: 2px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #F8FAFC 0%, #F1F5F9 100%);
}

.preview-modal-header h2 {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--color-primary);
    margin: 0;
}

.preview-modal-close {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(198, 40, 61, 0.1);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--color-primary);
}

.preview-modal-close:hover {
    background: rgba(198, 40, 61, 0.2);
    transform: scale(1.05);
}

.preview-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

.preview-folder-section {
    margin-bottom: 50px;
}

.preview-folder-section:last-child {
    margin-bottom: 0;
}

.preview-folder-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid rgba(198, 40, 61, 0.15);
}

.preview-folder-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--color-primary);
    margin: 0;
}

.preview-folder-count {
    font-size: var(--font-size-base);
    font-weight: 500;
    color: var(--color-text-muted);
    margin-left: 4px;
}

.preview-folder-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
    padding: 20px 0 0 0;
    justify-content: space-around;
    align-items: stretch;
    align-content: center;
}

.preview-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: default;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all var(--transition-normal);
    border: 3px solid transparent;
    display: grid;
    width: calc((100% - (12px * 3)) / 4);
    line-height: 0;
    pointer-events: auto;
    align-content: center;
}

.preview-item img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    pointer-events: none;
    -webkit-touch-callout: none;
    transition: transform var(--transition-normal);
    transform: scale(1.02);
}

.preview-item.horizontal {
    width: calc(((100% - (12px * 3)) / 4) * 2 + 12px);
}

.preview-item-number {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 36px;
    height: 36px;
    background: rgba(198, 40, 61, 0.95);
    color: white;
    border: 2px solid white;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--font-size-base);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 10;
    backdrop-filter: blur(8px);
}

/* Desktop grande - 5 colunas */
@media (min-width: 1400px) {
    .preview-folder-grid {
        gap: 12px;
    }
    
    .preview-item {
        width: calc((100% - (14px * 4)) / 5);
    }
    
    .preview-item.horizontal {
        width: calc(((100% - (14px * 4)) / 5) * 2 + 14px);
    }
}

/* Desktop médio - 4 colunas */
@media (min-width: 1024px) and (max-width: 1399px) {
    .preview-folder-grid {
        gap: 12px;
    }
    
    .preview-item {
        width: calc((100% - (12px * 3)) / 4);
    }
    
    .preview-item.horizontal {
        width: calc(((100% - (12px * 3)) / 4) * 2 + 12px);
    }
}

/* Tablet - 3 colunas */
@media (min-width: 769px) and (max-width: 1023px) {
    .preview-folder-grid {
        gap: 10px;
    }
    
    .preview-item {
        width: calc((100% - (10px * 2)) / 3);
    }
    
    .preview-item.horizontal {
        width: calc(((100% - (10px * 2)) / 3) * 2 + 10px);
    }
}

.preview-modal-footer {
    padding: 24px 32px;
    border-top: 2px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    background: #F8FAFC;
}

.preview-modal-footer .btn-clear,
.preview-modal-footer .btn-confirm {
    min-width: 140px;
}

/* ==========================================
   MENSAGENS DE SUCESSO
   ========================================== */

.success-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}

.success-box {
    max-width: 500px;
}

.success-icon {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, var(--color-success), #00D9A5);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 30px;
    font-size: 48px;
    color: white;
    animation: bounceIn 0.6s ease;
}

@keyframes bounceIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.success-box h1 {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    margin-bottom: 16px;
}

.success-box p {
    color: var(--color-text-light);
    font-size: var(--font-size-lg);
    margin-bottom: 30px;
}

/* ==========================================
   RESPONSIVIDADE
   ========================================== */

@media (max-width: 768px) {
    .dashboard-welcome h1 {
        font-size: var(--font-size-2xl);
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .selection-card {
        padding: 24px;
    }
    
    .selecao-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .gallery-grid {
        gap: 8px;
        padding-bottom: 180px;
    }
    
    .gallery-item {
        width: calc((100% - 8px) / 2);
    }
    
    .gallery-item.horizontal {
        width: 100%;
    }
    
    .action-bar {
        padding: 12px 16px;
    }
    
    .action-bar-content {
        flex-direction: column;
        gap: 12px;
    }
    
    .action-bar-info {
        width: 100%;
        justify-content: center;
    }
    
    .progress-bar-container {
        max-width: 100%;
        width: 100%;
    }
    
    .action-bar-buttons {
        width: 100%;
        justify-content: stretch;
    }
    
    .action-bar-buttons .btn-clear,
    .action-bar-buttons .btn-confirm,
    .action-bar-buttons .btn-preview,
    .action-bar-buttons .btn-download {
        flex: 1;
    }
    
    .preview-modal-content {
        max-width: 95vw;
        max-height: 95vh;
        margin: 2.5vh auto;
    }
    
    .preview-modal-header,
    .preview-modal-body,
    .preview-modal-footer {
        padding: 20px;
    }
    
    .preview-folder-grid {
        gap: 8px;
    }
    
    .preview-item {
        width: calc((100% - 8px) / 2);
    }
    
    .preview-item.horizontal {
        width: 100%;
    }
    
    .preview-folder-section {
        margin-bottom: 30px;
    }
    
    .preview-folder-header {
        margin-bottom: 16px;
        padding-bottom: 12px;
    }
    
    .preview-folder-title {
        font-size: var(--font-size-lg);
    }
    
    .preview-modal-footer {
        flex-direction: column;
    }
    
    .preview-modal-footer .btn-clear,
    .preview-modal-footer .btn-confirm {
        width: 100%;
    }
    
    .selection-count .current {
        font-size: 1.5rem;
    }
    
    .lightbox-nav {
        width: 44px;
        height: 44px;
        font-size: 22px;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
}

@media (max-width: 480px) {
    .acesso-card {
        padding: 30px 24px;
    }
    
    .gallery-grid {
        gap: 6px;
    }
    
    .gallery-item {
        width: calc((100% - 6px) / 2);
    }
    
    .gallery-item.horizontal {
        width: 100%;
    }
    
    .gallery-item {
        border-radius: var(--radius-sm);
    }
    
    .preview-folder-grid {
        gap: 6px;
    }
    
    .preview-item {
        width: calc((100% - 6px) / 2);
        border-radius: var(--radius-sm);
    }
    
    .preview-item.horizontal {
        width: 100%;
    }
    
    .preview-item-number {
        width: 28px;
        height: 28px;
        font-size: var(--font-size-sm);
        top: 8px;
        left: 8px;
    }
}

/* ==========================================
   BOXES (Área do Cliente - Dashboard)
   ========================================== */
.boxes-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    max-width: 1000px;
    width: 100%;
}

.box {
    position: relative;
    border-radius: var(--radius-xl);
    aspect-ratio: 4/5;
    min-height: 280px;
    overflow: hidden;
    cursor: pointer;
    background: linear-gradient(145deg, var(--color-secondary), #2A2A4E);
    box-shadow: var(--shadow-xl);
    transition: var(--transition-normal);
    text-decoration: none;
    display: block;
}

.box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, transparent 40%, rgba(26, 26, 46, 0.85) 100%);
    z-index: 1;
    pointer-events: none;
}

.box-label {
    position: absolute;
    bottom: 25px;
    left: 25px;
    color: white;
    font-size: 1.6rem;
    font-weight: 700;
    z-index: 2;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.box:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 0 40px rgba(196, 30, 58, 0.15), var(--shadow-xl);
}

.box:hover img {
    transform: scale(1.1);
}


@media (max-width: 768px) {
    .maisbook-user-info {
        display: none; /* Ocultar informações do plano em telas pequenas */
    }
    
    .boxes-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .box {
        min-height: 240px;
    }
    
    .box-label {
        font-size: 1.3rem;
    }
}

/* ==========================================
   PLANO LINK - GALERIA DE DOWNLOADS
   ========================================== */

/* Item da galeria baixado */
.gallery-item.downloaded {
    border: 3px solid var(--color-success);
}

.gallery-item.downloaded .gallery-item-check {
    background: var(--color-success);
}

/* Item com limite atingido */
.gallery-item.limit-reached {
    opacity: 0.5;
    cursor: not-allowed;
}

.gallery-item.limit-reached:hover {
    transform: none;
}

.gallery-item.limit-reached:hover img {
    transform: none;
}

.gallery-item-limit-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 5;
    border-radius: var(--radius-lg);
}

/* Spinner de download */
.spinner-download {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

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

