/* ==================== RESET Y VARIABLES ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --dark-color: #333;
    --light-color: #f5f5f5;
    --border-color: #ddd;
    --text-color: #555;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 12px rgba(0, 0, 0, 0.15);
}

html, body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color);
    background: white;
    line-height: 1.6;
}

/* ==================== HEADER ==================== */
.header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 20px 0;
    sticky: top;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

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

.logo img {
    max-width: 150px;
    height: auto;
    display: block;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 30px;
}

/* ==================== LANGUAGE SELECTOR ==================== */
.language-selector {
    display: flex;
    gap: 15px;
}

.lang-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--light-color);
    text-decoration: none;
    transition: all 0.3s ease;
    opacity: 0.55;
}

.lang-link:hover {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    transform: scale(1.1);
    opacity: 1;
}

.lang-link.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    box-shadow: var(--shadow);
    opacity: 1;
}

.flag-icon {
    display: block;
    width: 26px;
    height: auto;
    border-radius: 3px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 60px 20px;
    min-height: calc(100vh - 200px);
}

.page-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 50px;
    color: var(--dark-color);
    font-weight: 300;
    letter-spacing: -1px;
}

/* ==================== BOOKS GRID ==================== */
.books-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin-bottom: 50px;
}

.book-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.book-link {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

.book-cover {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: var(--shadow);
    background: #fff;
    aspect-ratio: 3 / 4;
    margin-bottom: 15px;
}

.cover-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.book-card:hover .cover-img {
    transform: scale(1.05);
}

.book-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
}

.book-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark-color);
    line-height: 1.4;
    min-height: 2.8em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.no-books {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 1.2rem;
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-secondary {
    background: var(--light-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #e8e8e8;
}

.btn-amazon {
    background: #FF9900;
}

.btn-amazon:hover {
    background: #ff9900cc;
}

/* ==================== BOOK DETAIL PAGE ==================== */
.book-detail {
    margin-bottom: 50px;
}

.book-detail-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    background: var(--light-color);
    padding: 40px;
    border-radius: 8px;
}

.book-detail-cover {
    display: flex;
    justify-content: center;
}

.detail-cover-img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.book-detail-info {
    display: flex;
    flex-direction: column;
}

.book-detail-title {
    font-size: 2rem;
    color: var(--dark-color);
    margin-bottom: 20px;
    font-weight: 600;
}

.book-detail-author,
.book-detail-series {
    margin-bottom: 20px;
    font-size: 1.05rem;
}

.book-detail-author strong,
.book-detail-series strong {
    color: var(--dark-color);
    font-weight: 600;
}

.book-detail-author-cta {
    margin-bottom: 25px;
}

/* Botón Amazon bajo la imagen: oculto en escritorio, visible en móvil */
.book-detail-cover-cta {
    display: none;
}

.book-detail-synopsis {
    margin-bottom: 30px;
}

.book-detail-synopsis h2 {
    font-size: 1.3rem;
    color: var(--dark-color);
    margin-bottom: 15px;
    font-weight: 600;
}

.book-detail-synopsis p {
    line-height: 1.8;
    color: var(--text-color);
    text-align: justify;
}

.book-detail-actions {
    display: flex;
    gap: 15px;
    margin-top: auto;
}

.book-detail-actions .btn {
    flex: 1;
    text-align: center;
}

.error-container {
    text-align: center;
    padding: 60px 20px;
}

.error-container h1 {
    color: #c00;
    margin-bottom: 20px;
}

.error-container p {
    color: #999;
    margin-bottom: 30px;
}

/* ==================== FOOTER ==================== */
.footer {
    background: var(--light-color);
    padding: 30px 20px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    color: #999;
    font-size: 0.9rem;
    margin-top: 50px;
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px 25px;
    margin-bottom: 15px;
}

.footer-links a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* ==================== LEGAL / CONTENT PAGES ==================== */
.content-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 60px 20px;
    min-height: calc(100vh - 200px);
}

.content-page h1 {
    font-size: 2rem;
    color: var(--dark-color);
    margin-bottom: 10px;
    font-weight: 600;
}

.content-page .updated {
    color: #999;
    font-size: 0.9rem;
    margin-bottom: 35px;
}

.content-page h2 {
    font-size: 1.3rem;
    color: var(--dark-color);
    margin: 35px 0 12px;
    font-weight: 600;
}

.content-page p,
.content-page li {
    line-height: 1.8;
    color: var(--text-color);
    margin-bottom: 12px;
}

.content-page ul {
    padding-left: 22px;
    margin-bottom: 12px;
}

.content-page a {
    color: var(--primary-color);
}

/* ==================== CONTACT FORM ==================== */
.contact-form .form-group {
    margin-bottom: 20px;
}

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

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 0.95rem;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.contact-form textarea {
    resize: vertical;
    min-height: 150px;
}

/* Honeypot anti-spam: oculto para humanos */
.contact-form .hp-field {
    position: absolute;
    left: -5000px;
}

.form-message {
    padding: 14px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-weight: 500;
}

.form-message.success {
    background: #efe;
    color: #060;
    border-left: 4px solid #060;
}

.form-message.error {
    background: #fee;
    color: #c00;
    border-left: 4px solid #c00;
}

/* ==================== COOKIE BANNER ==================== */
.cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 25px;
    flex-wrap: wrap;
    padding: 18px 25px;
    background: rgba(30, 30, 40, 0.97);
    color: #fff;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.2);
}

.cookie-banner .cookie-text {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    max-width: 800px;
    color: #f0f0f0;
}

.cookie-banner .cookie-actions {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.cookie-banner .btn {
    white-space: nowrap;
}

.cookie-banner .btn-secondary {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.cookie-banner .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

@media (max-width: 600px) {
    .cookie-banner {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 18px 15px;
    }

    .cookie-banner .cookie-actions {
        width: 100%;
        justify-content: center;
    }
}

/* ==================== RESPONSIVE DESIGN ==================== */

/* Tablets - 2 columnas */
@media (max-width: 1024px) {
    .books-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }

    .page-title {
        font-size: 2rem;
    }

    .book-detail-container {
        grid-template-columns: 1fr;
        gap: 40px;
    }
}

/* Móvil - 2 columnas (como especificó el usuario) */
@media (max-width: 768px) {
    .header-container {
        flex-wrap: wrap;
        gap: 20px;
    }

    .logo img {
        max-width: 120px;
    }

    .main-content {
        padding: 40px 15px;
    }

    .page-title {
        font-size: 1.8rem;
        margin-bottom: 35px;
    }

    .books-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .book-title {
        font-size: 0.9rem;
    }

    .book-detail-title {
        font-size: 1.6rem;
    }

    .book-detail-info {
        font-size: 0.95rem;
    }

    /* Portada más pequeña en móvil */
    .detail-cover-img {
        max-width: 200px;
    }

    /* En móvil: botón Amazon centrado justo debajo de la imagen */
    .book-detail-cover-cta {
        display: block;
        text-align: center;
        margin-top: 20px;
    }

    /* Ocultar el botón que en escritorio va bajo el autor */
    .book-detail-author-cta {
        display: none;
    }

    .book-detail-actions {
        flex-direction: column;
    }

    .book-detail-actions .btn {
        width: 100%;
    }
}

/* Móviles muy pequeños */
@media (max-width: 480px) {
    .header {
        padding: 15px 0;
    }

    .logo img {
        max-width: 100px;
    }

    .main-content {
        padding: 30px 10px;
    }

    .page-title {
        font-size: 1.4rem;
        margin-bottom: 25px;
    }

    .books-grid {
        gap: 15px;
    }

    .book-detail-container {
        padding: 20px;
    }

    .book-detail-title {
        font-size: 1.3rem;
    }

    .book-detail-synopsis p {
        text-align: left;
        font-size: 0.9rem;
    }

    .btn {
        padding: 10px 20px;
        font-size: 13px;
    }
}

/* Utility classes */
.text-center {
    text-align: center;
}

.mt-3 {
    margin-top: 30px;
}

.mb-3 {
    margin-bottom: 30px;
}
