/* Estilos Globales para BookHouse - Tienda Cliente */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #00a8b5;
    --primary-hover: #008f9a;
    --primary-light: rgba(0, 168, 181, 0.08);
    --secondary: #4a5568;
    --dark: #1a202c;
    --light: #f7fafc;
    --white: #ffffff;
    --border: #e2e8f0;
    --success: #48bb78;
    --error: #f56565;
    --font: 'Outfit', sans-serif;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.05), 0 8px 10px -6px rgba(0,0,0,0.05);
    --radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    background-color: var(--light);
    color: var(--dark);
    line-height: 1.6;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

/* Barra de anuncios */
.announcement-bar {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: var(--white);
    text-align: center;
    padding: 8px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow-sm);
    z-index: 1000;
    position: relative;
}

/* Encabezado */
header {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 999;
    padding: 15px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-img {
    height: 42px;
    width: auto;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary);
    letter-spacing: -0.5px;
}

.logo-text span {
    color: var(--primary);
}

nav {
    display: flex;
    align-items: center;
    gap: 30px;
}

nav a {
    font-weight: 500;
    color: var(--secondary);
    transition: var(--transition);
    position: relative;
}

nav a:hover, nav a.active {
    color: var(--primary);
}

nav a::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary);
    transition: var(--transition);
}

nav a:hover::after, nav a.active::after {
    width: 100%;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.cart-icon {
    position: relative;
    font-size: 1.4rem;
    color: var(--secondary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 50%;
}

.cart-icon:hover {
    background-color: var(--primary-light);
    color: var(--primary);
}

.cart-count {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: var(--primary);
    color: var(--white);
    font-size: 0.75rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--white);
}

.btn-login {
    background-color: var(--primary);
    color: var(--white);
    padding: 8px 20px;
    border-radius: var(--radius);
    font-weight: 500;
    transition: var(--transition);
    border: none;
    cursor: pointer;
}

.btn-login:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 168, 181, 0.2);
}

.user-menu {
    position: relative;
    cursor: pointer;
    font-weight: 500;
    color: var(--secondary);
}

/* Banner de Portada (Hero Section) */
.hero {
    background: radial-gradient(circle at 10% 20%, rgba(240, 249, 250, 0.8) 0%, rgba(255, 255, 255, 0.8) 90%), url('../assets/hero_background.jpg') no-repeat center center/cover;
    min-height: 420px;
    display: flex;
    align-items: center;
    padding: 60px 5%;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.hero-content {
    max-width: 650px;
    animation: fadeIn 1s ease;
}

.hero-content h1 {
    font-size: 3rem;
    line-height: 1.15;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 20px;
    letter-spacing: -1px;
}

.hero-content p {
    font-size: 1.15rem;
    color: var(--secondary);
    margin-bottom: 30px;
    font-weight: 300;
}

/* Catálogo de Productos */
.container {
    padding: 50px 5%;
}

.catalog-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 40px;
}

/* Filtros Laterales */
.filters-sidebar {
    background-color: var(--white);
    padding: 25px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    height: fit-content;
    position: sticky;
    top: 100px;
}

.filter-section {
    margin-bottom: 30px;
}

.filter-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--dark);
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 8px;
}

.category-list {
    list-style: none;
}

.category-list li {
    margin-bottom: 10px;
}

.category-list a {
    color: var(--secondary);
    font-size: 0.95rem;
    transition: var(--transition);
    display: block;
    padding: 4px 0;
}

.category-list a:hover, .category-list a.active {
    color: var(--primary);
    padding-left: 5px;
    font-weight: 500;
}

/* Buscador y Grid */
.search-container {
    margin-bottom: 30px;
    display: flex;
    gap: 15px;
}

.search-input {
    flex: 1;
    padding: 12px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-family: var(--font);
    font-size: 1rem;
    transition: var(--transition);
    background-color: var(--white);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.btn-search {
    background-color: var(--secondary);
    color: var(--white);
    padding: 0 25px;
    border-radius: var(--radius);
    border: none;
    font-family: var(--font);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-search:hover {
    background-color: var(--dark);
}

/* Grid de Productos */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 30px;
}

.product-card {
    background-color: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    position: relative;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(0, 168, 181, 0.2);
}

.product-image-container {
    height: 280px;
    background-color: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 20px;
}

.product-image-container img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    transition: var(--transition);
    filter: drop-shadow(0 8px 12px rgba(0,0,0,0.15));
}

.product-card:hover .product-image-container img {
    transform: scale(1.05);
}

/* Portada de Libro fallback en CSS */
.book-fallback {
    width: 150px;
    height: 220px;
    background: linear-gradient(135deg, var(--secondary), var(--dark));
    border-radius: 4px 8px 8px 4px;
    color: var(--white);
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 5px 5px 15px rgba(0,0,0,0.2);
    border-left: 6px solid rgba(255, 255, 255, 0.15);
    position: relative;
}

.book-fallback::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: rgba(255,255,255,0.2);
}

.book-fallback-title {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-fallback-author {
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.8;
}

.product-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.product-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.6rem;
}

.product-author {
    font-size: 0.85rem;
    color: var(--secondary);
    margin-bottom: 12px;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

.product-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--dark);
}

.btn-add-cart {
    background-color: var(--primary-light);
    color: var(--primary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-add-cart:hover {
    background-color: var(--primary);
    color: var(--white);
    transform: scale(1.05);
}

.btn-add-cart svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.out-of-stock {
    background-color: rgba(0,0,0,0.03);
}

.out-of-stock-label {
    position: absolute;
    top: 12px;
    right: 12px;
    background-color: var(--secondary);
    color: var(--white);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
}

/* Detalle del Producto */
.product-detail-layout {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 50px;
    background-color: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 40px;
    box-shadow: var(--shadow-sm);
}

.detail-image-section {
    background-color: #f8fafc;
    border-radius: var(--radius);
    padding: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-info-section h2 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 5px;
    line-height: 1.2;
}

.detail-author {
    font-size: 1.2rem;
    color: var(--secondary);
    margin-bottom: 20px;
}

.detail-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 25px;
}

.detail-desc-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--dark);
}

.detail-desc {
    color: var(--secondary);
    margin-bottom: 30px;
}

.detail-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.qty-selector {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.qty-btn {
    background-color: var(--light);
    border: none;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1.1rem;
    transition: var(--transition);
}

.qty-btn:hover {
    background-color: var(--border);
}

.qty-input {
    width: 50px;
    text-align: center;
    border: none;
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 600;
    outline: none;
}

.btn-buy {
    background-color: var(--primary);
    color: var(--white);
    border: none;
    padding: 12px 35px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-buy:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 168, 181, 0.2);
}

/* Vista del Carrito */
.cart-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
}

.cart-table-card, .cart-summary-card {
    background-color: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 30px;
    box-shadow: var(--shadow-sm);
}

.cart-item {
    display: flex;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
    gap: 20px;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-img {
    width: 70px;
    height: 100px;
    background-color: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    padding: 5px;
}

.cart-item-img img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.cart-item-details {
    flex: 1;
}

.cart-item-title {
    font-weight: 600;
    color: var(--dark);
    font-size: 1.05rem;
}

.cart-item-author {
    font-size: 0.85rem;
    color: var(--secondary);
}

.cart-item-price {
    font-weight: 600;
    color: var(--dark);
    margin-top: 5px;
}

.btn-remove-item {
    color: var(--error);
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    margin-top: 5px;
    transition: var(--transition);
}

.btn-remove-item:hover {
    text-decoration: underline;
}

/* Resumen del Pedido */
.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.summary-total {
    border-top: 2px solid var(--border);
    padding-top: 15px;
    font-weight: 700;
    font-size: 1.25rem;
}

.btn-checkout {
    display: block;
    width: 100%;
    background-color: var(--primary);
    color: var(--white);
    text-align: center;
    padding: 12px;
    border-radius: var(--radius);
    font-weight: 600;
    transition: var(--transition);
    margin-top: 20px;
    border: none;
    cursor: pointer;
}

.btn-checkout:hover {
    background-color: var(--primary-hover);
}

/* Pantalla de Checkout / Login */
.auth-card {
    max-width: 450px;
    margin: 50px auto;
    background-color: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow-md);
}

.auth-card h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 25px;
    text-align: center;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--secondary);
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-family: var(--font);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.btn-submit {
    width: 100%;
    background-color: var(--primary);
    color: var(--white);
    padding: 12px;
    border-radius: var(--radius);
    border: none;
    font-family: var(--font);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-submit:hover {
    background-color: var(--primary-hover);
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9rem;
    color: var(--secondary);
}

.auth-switch a {
    color: var(--primary);
    font-weight: 600;
}

.alert {
    padding: 12px 15px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-success {
    background-color: #def7ec;
    color: #03543f;
}

.alert-danger {
    background-color: #fde8e8;
    color: #9b1c1c;
}

/* Pie de Página */
footer {
    background-color: var(--dark);
    color: #a0aec0;
    padding: 40px 5% 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    margin-bottom: 30px;
}

.footer-column h4 {
    color: var(--white);
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.footer-column p {
    font-size: 0.9rem;
    line-height: 1.5;
}

.footer-column ul {
    list-style: none;
}

.footer-column ul li {
    margin-bottom: 10px;
}

.footer-column ul li a {
    font-size: 0.9rem;
    transition: var(--transition);
}

.footer-column ul li a:hover {
    color: var(--white);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 20px;
    text-align: center;
    font-size: 0.85rem;
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Filtros Móviles */
.filter-mobileOnly {
    display: none;
}

.mobile-filter-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mobile-filter-select {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background-color: var(--white);
    color: var(--dark);
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234a5568'%3E%3Cpath d='M7 10l5 5 5-5H7z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 20px;
    padding-right: 40px;
    box-shadow: var(--shadow-sm);
}

.mobile-filter-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.mobile-filter-select:hover {
    border-color: var(--primary);
}

/* Diseño Responsivo */
@media (max-width: 900px) {
    .catalog-layout, .cart-layout, .product-detail-layout {
        grid-template-columns: 1fr;
    }
    .filter-desktopOnly {
        display: none;
    }
    .filter-mobileOnly {
        display: block;
    }
    .filters-sidebar {
        position: static;
        margin-bottom: 25px;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 15px;
        padding: 20px;
        background-color: var(--white);
        border: 1px solid var(--border);
        box-shadow: var(--shadow-sm);
        border-radius: var(--radius);
        height: auto;
    }
    .filter-section {
        margin-bottom: 0 !important;
    }
}
@media (max-width: 600px) {
    .hero-content h1 {
        font-size: 2.2rem;
    }
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    nav {
        gap: 15px;
    }
}

/* Modales para la Tienda (ej. Éxito de Pago) */
.modal-admin {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

.modal-admin.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content-admin {
    background-color: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 450px;
    padding: 35px 30px;
    position: relative;
    transform: scale(0.95);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.modal-admin.show .modal-content-admin {
    transform: scale(1);
}

/* Floating WhatsApp Support Widget */
.support-widget {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background-color: #25D366; /* WhatsApp Green */
    color: #ffffff;
    text-decoration: none;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.35);
    padding: 0 13px;
    width: 50px;
    height: 50px;
    overflow: hidden;
    box-sizing: border-box;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    animation: support-pulse 3s infinite ease-in-out;
}

.support-widget svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    margin-right: 0;
    transition: margin-right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.support-widget span {
    max-width: 0;
    opacity: 0;
    transition: max-width 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease-out;
    display: inline-block;
    overflow: hidden;
    color: #ffffff;
}

.support-widget:hover {
    width: 165px;
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.45);
    animation-play-state: paused;
}

.support-widget:hover svg {
    margin-right: 8px;
}

.support-widget:hover span {
    max-width: 100px;
    opacity: 1;
}

@keyframes support-pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

