/* ============================================
   SAPERE AUDE FRONTEND STYLES (V9.2 PREMIUM)
   Design moderno, animações suaves, 100% responsivo
   ============================================ */

/* ==================== BASE ==================== */
.sap-frontend-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    color: #1f2937;
}
.sap-frontend-wrapper * { 
    box-sizing: border-box; 
}

.sap-frontend-wrapper h2 {
    font-size: 2rem;
    margin-bottom: 30px;
    color: #111827;
    font-weight: 800;
    position: relative;
    padding-bottom: 15px;
}
.sap-frontend-wrapper h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, #1e3a8a, #3b82f6);
    border-radius: 2px;
}

.sap-desc {
    font-size: 1.1rem;
    color: #6b7280;
    line-height: 1.7;
    margin-bottom: 30px;
}

/* ==================== BOTÃO VOLTAR ==================== */
.sap-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 30px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: #374151;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.sap-back-btn:hover {
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
    transform: translateX(-5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    color: #1f2937;
}

/* ==================== SÉRIES ==================== */
.sap-grid-series {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 35px;
    margin-top: 40px;
}

.sap-card-series {
    display: block;
    text-align: center;
    padding: 35px 25px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    text-decoration: none;
    color: inherit;
    border: 2px solid transparent;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.sap-card-series::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(30,58,138,0.03) 0%, rgba(59,130,246,0.03) 100%);
    opacity: 0;
    transition: opacity 0.4s;
}

.sap-card-series:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 28px rgba(30,58,138,0.15);
    border-color: #1e3a8a;
}

.sap-card-series:hover::before {
    opacity: 1;
}

.sap-series-img {
    width: 100%;
    height: 180px;
    object-fit: contain;
    margin-bottom: 25px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.08));
    transition: transform 0.4s;
}

.sap-card-series:hover .sap-series-img {
    transform: scale(1.05);
}

.sap-card-series h3 {
    margin: 0;
    font-size: 1.35rem;
    color: #1f2937;
    font-weight: 700;
    line-height: 1.3;
}

/* ==================== COLEÇÕES (MANTENDO 4:3) ==================== */
.sap-grid-collections {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 35px;
    margin-top: 40px;
}

.sap-card-col {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    text-decoration: none;
    color: inherit;
    border: 2px solid transparent;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sap-card-col:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 28px rgba(37,99,235,0.15);
    border-color: #2563eb;
}

.sap-col-cover {
    width: 100%;
    aspect-ratio: 4/3; /* Mantendo como você pediu! */
    background-size: cover;
    background-position: center;
    background-color: #e5e7eb;
    transition: transform 0.6s ease;
}

.sap-card-col:hover .sap-col-cover {
    transform: scale(1.08);
}

.sap-col-info {
    padding: 25px;
    background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
}

.sap-col-info h4 {
    margin: 0 0 8px;
    font-size: 1.3rem;
    color: #1f2937;
    font-weight: 700;
    line-height: 1.3;
}

.sap-col-info p {
    margin: 0;
    color: #6b7280;
    font-style: italic;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* ==================== EIXOS - TABS PREMIUM ==================== */
.sap-frontend-tabs {
    display: flex;
    gap: 10px;
    border-bottom: 2px solid #e5e7eb;
    margin: 40px 0 30px;
    overflow-x: auto;
    padding-bottom: 0;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.sap-frontend-tabs::-webkit-scrollbar {
    height: 6px;
}

.sap-frontend-tabs::-webkit-scrollbar-track {
    background: transparent;
}

.sap-frontend-tabs::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.sap-ft-btn {
    background: none;
    border: none;
    padding: 14px 24px;
    font-size: 1.05rem;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    transition: all 0.3s ease;
    position: relative;
}

.sap-ft-btn::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #f59e0b, #fb923c);
    transform: translateX(-50%);
    transition: width 0.3s ease;
    border-radius: 2px 2px 0 0;
}

.sap-ft-btn:hover {
    color: #f59e0b;
}

.sap-ft-btn.active {
    color: #f59e0b;
}

.sap-ft-btn.active::after {
    width: 100%;
}

/* Conteúdo das Tabs */
.sap-frontend-content {
    position: relative;
}

.sap-ft-pane {
    display: none;
    animation: slideInUp 0.4s ease;
}

.sap-ft-pane.active {
    display: block;
}

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

/* Header do Eixo */
.sap-axis-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 30px 0 20px;
    padding: 20px;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-radius: 12px;
    border-left: 5px solid #f59e0b;
}

.sap-axis-icon {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 12px;
    background: #ffffff;
    flex-shrink: 0;
    box-shadow: 0 4px 8px rgba(245,158,11,0.2);
}

.sap-axis-header h3 {
    margin: 0;
    font-size: 1.6rem;
    color: #92400e;
    font-weight: 700;
}

.sap-axis-desc {
    color: #78716c;
    line-height: 1.7;
    margin: 15px 0 25px;
    font-size: 1rem;
}

/* ==================== GRID DE MESTRES (MELHORADO!) ==================== */
.sap-master-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.sap-mini-master {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 18px;
    background: #ffffff;
    border-radius: 12px;
    text-decoration: none;
    color: #1f2937;
    border: 2px solid #f0f0f1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.sap-mini-master:hover {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    box-shadow: 0 8px 16px rgba(16,185,129,0.15);
    transform: translateY(-3px);
    border-color: #10b981;
}

.sap-mini-master img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #ffffff;
    box-shadow: 0 3px 8px rgba(0,0,0,0.12);
    flex-shrink: 0;
    transition: transform 0.3s;
}

.sap-mini-master:hover img {
    transform: scale(1.1);
    border-color: #10b981;
}

.sap-mini-master span {
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.3;
}

/* ==================== PÁGINA DO MESTRE ==================== */
.sap-master-header {
    display: flex;
    gap: 40px;
    margin-bottom: 50px;
    padding: 40px;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
    align-items: center;
    border: 1px solid #f0f0f1;
}

.sap-master-img {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    border: 6px solid #ffffff;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    flex-shrink: 0;
}

.sap-master-bio h1 {
    margin: 0 0 15px;
    font-size: 2.5rem;
    color: #111827;
    font-weight: 800;
    line-height: 1.2;
}

.sap-master-bio p {
    margin: 0;
    color: #4b5563;
    line-height: 1.7;
    font-size: 1.1rem;
}

/* ==================== TÍTULOS (LIVROS) ==================== */
.sap-titles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.sap-book-card {
    background: #ffffff;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.sap-book-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 28px rgba(139,92,246,0.15);
    border-color: #8b5cf6;
}

.sap-book-cover {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    cursor: zoom-in;
    transition: all 0.3s ease;
}

.sap-book-cover:hover {
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    transform: scale(1.02);
}

.sap-vol {
    align-self: flex-start;
    background: linear-gradient(135deg, #000000 0%, #374151 100%);
    color: #ffffff;
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 700;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sap-book-card h4 {
    margin: 0 0 8px;
    font-size: 1.15rem;
    color: #1f2937;
    font-weight: 700;
    line-height: 1.4;
    min-height: 2.8em;
}

.sap-book-card h5 {
    margin: 0 0 15px;
    font-size: 0.9rem;
    color: #6b7280;
    font-weight: 500;
    font-style: italic;
}

.sap-book-card .meta {
    font-size: 0.85rem;
    color: #9ca3af;
    margin-bottom: auto;
    padding-top: 10px;
}

.sap-book-card .price {
    font-size: 1.6rem;
    color: #10b981;
    font-weight: 800;
    margin: 20px 0 15px;
    text-shadow: 0 2px 4px rgba(16,185,129,0.1);
}

.btn-buy {
    display: block;
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: #ffffff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(30,58,138,0.2);
}

.btn-buy:hover {
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    box-shadow: 0 6px 12px rgba(30,58,138,0.3);
    transform: translateY(-2px);
}

/* ==================== LIGHTBOX PREMIUM ==================== */
.sap-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.92);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
    cursor: zoom-out;
    animation: fadeIn 0.3s ease;
}

.sap-lightbox.active {
    display: flex;
}

.sap-lightbox img {
    max-width: 90%;
    max-height: 90vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    border: 6px solid #ffffff;
    animation: zoomIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Close button (opcional - você pode adicionar no PHP) */
.sap-lightbox::before {
    content: '✕';
    position: absolute;
    top: 30px;
    right: 40px;
    font-size: 2rem;
    color: #ffffff;
    font-weight: 300;
    z-index: 10000;
    cursor: pointer;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.sap-lightbox:hover::before {
    background: rgba(255,255,255,0.2);
    transform: rotate(90deg);
}

/* ==================== RESPONSIVO ==================== */
@media (max-width: 900px) {
    .sap-master-header {
        flex-direction: column;
        text-align: center;
        padding: 30px;
    }
    
    .sap-axis-header {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }
    
    .sap-master-bio h1 {
        font-size: 2rem;
    }
}

@media (max-width: 640px) {
    .sap-frontend-wrapper {
        padding: 0 15px;
    }
    
    .sap-grid-series,
    .sap-grid-collections,
    .sap-titles-grid,
    .sap-master-grid {
        grid-template-columns: 1fr;
    }
    
    .sap-ft-btn {
        font-size: 0.95rem;
        padding: 12px 18px;
    }
    
    .sap-book-card h4 {
        font-size: 1rem;
        min-height: auto;
    }
    
    .sap-lightbox img {
        max-width: 95%;
        border-width: 3px;
    }
}

/* ==================== ANIMAÇÕES EXTRAS ==================== */
@media (prefers-reduced-motion: no-preference) {
    .sap-card-series,
    .sap-card-col,
    .sap-mini-master,
    .sap-book-card {
        animation: fadeInUp 0.6s ease backwards;
    }
    
    /* Delay escalonado para efeito cascata */
    .sap-card-series:nth-child(1),
    .sap-card-col:nth-child(1),
    .sap-book-card:nth-child(1) { animation-delay: 0.05s; }
    
    .sap-card-series:nth-child(2),
    .sap-card-col:nth-child(2),
    .sap-book-card:nth-child(2) { animation-delay: 0.1s; }
    
    .sap-card-series:nth-child(3),
    .sap-card-col:nth-child(3),
    .sap-book-card:nth-child(3) { animation-delay: 0.15s; }
    
    .sap-card-series:nth-child(4),
    .sap-card-col:nth-child(4),
    .sap-book-card:nth-child(4) { animation-delay: 0.2s; }
}

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

/* ==================== ACESSIBILIDADE ==================== */
.sap-ft-btn:focus,
.sap-back-btn:focus,
.btn-buy:focus {
    outline: 3px solid #3b82f6;
    outline-offset: 3px;
}

.sap-book-cover:focus {
    outline: 3px solid #8b5cf6;
    outline-offset: 3px;
}
/* ==================== ABAS DE EIXOS - GRID RESPONSIVO ==================== */
.sap-frontend-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
    padding: 0;
}

.sap-ft-btn {
    padding: 12px 20px;
    background: #f5f5f5;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: normal; /* Permite quebra de linha em nomes longos */
    text-align: center;
    font-size: 14px;
    line-height: 1.4;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sap-ft-btn.active {
    background: #0073aa;
    color: #fff;
    border-color: #005177;
    font-weight: 600;
}

.sap-ft-btn:hover:not(.active) {
    background: #e8e8e8;
    border-color: #999;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Mobile: abas menores */
@media (max-width: 768px) {
    .sap-frontend-tabs {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }

    .sap-ft-btn {
        font-size: 13px;
        padding: 10px 15px;
        min-height: 44px;
    }
}
