:root {
    /* Paleta elegante */
    --color-bg: #faf9f7;
    --color-bg-card: #ffffff;
    --color-bg-elevated: #f5f4f2;
    --color-text: #2c2c2c;
    --color-text-muted: #6b6b6b;
    --color-gold: #b8956c;
    --color-gold-dark: #9a7b5a;
    --color-gold-accent: #8b7355;
    --color-border: #e8e6e3;
    --color-error: #c53030;
    
    /* Colores derivados para UI */
    --color-primary: var(--color-gold);
    --color-primary-dark: var(--color-gold-dark);
    --color-primary-light: #d4c4b0;
    --color-btn-bg: #f5f2ef;
    --color-btn-hover: #ebe7e2;
    
    color-scheme: light only;
}

html,
body {
    color-scheme: light only !important;
}

input,
textarea,
select,
button {
    color-scheme: light only !important;
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: light only;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

body {
    font-family: 'Lato', sans-serif;
    background: var(--color-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Filter Modal Styles */
.filter-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(44, 44, 44, 0.4);
    z-index: 999;
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.filter-modal-backdrop.show {
    display: block;
}

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

.filter-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    background: var(--color-bg-card);
    border-radius: 16px;
    padding: 0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease-out;
    overflow: hidden;
    border: 1px solid var(--color-border);
}

.filter-modal-backdrop.show .filter-modal {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.modal-header {
    background: var(--color-bg-elevated);
    color: var(--color-text);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--color-border);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text);
}

.modal-close {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.modal-close:hover {
    background: var(--color-bg-elevated);
    color: var(--color-text);
    border-color: var(--color-gold);
}

.modal-body {
    padding: 30px;
    max-height: calc(90vh - 180px);
    overflow-y: auto;
    background: var(--color-bg-card);
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: var(--color-bg-elevated);
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--color-gold);
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--color-gold-dark);
}

.modal-footer {
    padding: 20px 30px;
    background: var(--color-bg-elevated);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Filter Toggle Button */
.filter-toggle-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-bg-card);
    color: var(--color-gold);
    border: 1px solid var(--color-border);
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    z-index: 998;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.filter-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
    border-color: var(--color-gold);
}

/* Form Styles */
.filter-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 8px;
    color: var(--color-text);
    font-weight: 600;
    font-size: 0.9rem;
}

.form-group select,
.form-group input[type="date"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg-card);
    color: var(--color-text);
    font-size: 0.95rem;
    transition: all 0.3s ease;
    font-family: 'Lato', sans-serif;
}

.form-group select:focus,
.form-group input[type="date"]:focus {
    outline: none;
    border-color: var(--color-gold);
    box-shadow: 0 0 0 3px rgba(184, 149, 108, 0.15);
}

.btn-submit,
.btn-clear {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.btn-submit {
    background: var(--color-gold);
    color: white;
    box-shadow: 0 2px 8px rgba(184, 149, 108, 0.3);
}

.btn-submit:hover {
    background: var(--color-gold-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(184, 149, 108, 0.4);
}

.btn-clear {
    background: var(--color-bg-elevated);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

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

/* Container */
.container {
    width: 100%;
    max-width: 1588px;
    margin: 0 auto;
    padding: 20px;
    overflow: hidden;
    flex: 1;
    display: flex;
    align-items: center;
    margin-top: -100px;
}

/* Footer */
.footer {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: -1;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.footer img {
    height: 35px;
    width: auto;
    opacity: 0.9;
}

/* Swiper Styles */
.swiper {
    width: 100%;
    padding: 50px 30px;
    overflow: visible;
}

.swiper-slide {
    background-position: center;
    background-size: cover;
    width: 320px;
    height: 500px;
}

/* Flip Card Styles */
.flip-card {
    background-color: transparent;
    width: 100%;
    height: 100%;
    perspective: 1000px;
    cursor: pointer;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.card-face.back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--color-border);
}

.card-face.back {
    transform: rotateY(180deg);
    background: var(--color-bg-card);
    padding: 0.8rem;
    position: relative;
    overflow: hidden;
}

/* Front Card Styles */
.flip-card-front {
    color: var(--color-text);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 30px 20px;
    overflow: hidden;
    background: var(--color-bg-card);
}

/* Book Cover Container */
.book-cover-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0;
    z-index: 1;
    margin-bottom: 36px;
}

.book-cover-container img {
    width: 100%;
    height: 12rem;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.book-title-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 20px;
    text-align: center;
    z-index: 1;
}

.book-title {
    font-family: 'Merriweather', serif;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--color-text);
    letter-spacing: 0.3px;
}

.book-cover-image {
    width: 100%;
    height: 100%;
    object-fit: fill;
    border-radius: 16px;
}

/* Book Overlay */
.book-overlay {
    position: relative;
    width: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    z-index: 1;
    margin-bottom: -20px;
}

.card.flipped .book-overlay,
.card.flipped .book-cover-container {
    display: none;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: center;
}

.action-btn {
    background: var(--color-btn-bg) !important;
    color: var(--color-gold-dark);
    border: 1px solid var(--color-border);
    padding: 15px 20px;
    border-radius: 12px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 100px;
    width: 100px;
    height: 80px;
    font-weight: 500;
}

.action-btn i {
    font-size: 24px;
    margin-bottom: 4px;
    color: var(--color-gold);
}

.action-btn:hover:not(:disabled) {
    background: var(--color-btn-hover) !important;
    border-color: var(--color-gold);
    transform: scale(1.02) !important;
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: var(--color-text-muted);
    border-color: var(--color-border);
}

.action-btn:disabled i {
    color: var(--color-text-muted);
}

/* Share Button */
.share-button-container,
.share-button-container2 {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-top: auto;
    padding-top: 12px;
}

.share-btn,
.share-btn2 {
    background: transparent;
    color: var(--color-gold-dark);
    border: 1px solid var(--color-border);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
    position: relative;
    bottom: -0.8rem;
}

.share-btn:hover,
.share-btn2:hover {
    background: var(--color-btn-bg);
    border-color: var(--color-gold);
}

/* Music Player Styles */
.btn {
    outline: none;
    border: 1px solid var(--color-border);
    background: var(--color-btn-bg);
    font-size: 0.9rem;
    color: var(--color-gold-dark);
    height: 2.188rem;
    width: 2.188rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.top-icons {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.volume {
    z-index: 5;
}

.layer {
    z-index: 4;
    position: absolute;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    height: 2.188rem;
    width: 13rem;
    left: 0;
    right: 0;
    margin-left: 0.8rem;
    top: 0.8rem;
    border-radius: 1.5rem;
    display: grid;
    place-items: center;
    visibility: hidden;
}

.volume-slider,
.progress-bar {
    position: relative;
    width: 100%;
    height: 0.2rem;
    background: var(--color-bg-elevated);
    border-radius: 0.1rem;
}

.volume-slider {
    width: 80%;
    right: -15px;
}

.volume-slider .bar,
.progress-bar .progress-line {
    display: block;
    width: 0;
    height: inherit;
    background-color: var(--color-gold);
    transition: width 0.1s ease;
    border-radius: 0.1rem;
}

.volume-slider .volumerange {
    width: 100%;
    -webkit-appearance: none;
    height: inherit;
    background: linear-gradient(to right, var(--color-gold) 0%, var(--color-gold) 100%, var(--color-bg-elevated) 100%, var(--color-bg-elevated) 100%);
    outline: none;
    position: absolute;
    top: 0;
    left: 0;
    cursor: pointer;
    touch-action: none;
    border-radius: 0.1rem;
}

.progress-bar .progress {
    width: 100%;
    -webkit-appearance: none;
    height: inherit;
    background: transparent;
    outline: none;
    position: absolute;
    top: 0;
    left: 0;
    cursor: pointer;
    touch-action: none;
}

.volume-slider .volumerange::-webkit-slider-thumb,
.progress-bar .progress::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 0.7rem;
    width: 0.7rem;
    background-color: var(--color-gold);
    border-radius: 50%;
    cursor: pointer;
}

.volume-slider .volumerange::-moz-range-thumb {
    height: 0.7rem;
    width: 0.7rem;
    background-color: var(--color-gold);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.layer.hide {
    visibility: visible;
}

/* Music Image */
.music-img {
    margin-top: 1rem;
    width: 100%;
    height: 12rem;
    overflow: hidden;
    border-radius: 12px;
}

.music-img img {
    object-fit: cover;
    height: 100%;
    width: 100%;
}

/* Music Info */
.music-info {
    text-align: center;
}

.music-info h2 {
    font-size: 1rem;
    margin-top: 1rem;
    letter-spacing: 0.02rem;
    color: var(--color-text);
    font-weight: 600;
}

/* Music Progress */
.music-progress {
    margin-top: 1rem;
}

.music-progress .progress-bar {
    background: var(--color-bg-elevated);
    height: 0.2rem;
    width: 100%;
    margin-bottom: 0.4rem;
    position: relative;
    cursor: pointer;
}

.progress {
    background: var(--color-gold);
    width: 0;
    height: 100%;
    position: relative;
}

.progress::before {
    content: "";
    position: absolute;
    height: 0.7rem;
    width: 0.7rem;
    border-radius: 50%;
    top: 50%;
    right: -5px;
    z-index: 2;
    transform: translateY(-50%);
    background: inherit;
}

.duration {
    display: flex;
    color: var(--color-text-muted);
    justify-content: space-between;
}

.duration span {
    font-size: 0.7rem;
}

/* Music Controls */
.music-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.6rem;
}

.prevbtn,
.nextbtn,
.playpause {
    border: 0;
    outline: 0;
    font-size: 2rem;
    background: transparent;
    color: var(--color-gold-dark);
    cursor: pointer;
    transition: all 0.3s ease;
}

.prevbtn:hover:not(:disabled),
.nextbtn:hover:not(:disabled) {
    color: var(--color-gold);
}

.prevbtn:disabled,
.nextbtn:disabled {
    color: var(--color-border);
    cursor: not-allowed;
    opacity: 0.5;
}

.playpause {
    font-size: 1.7rem;
    background: var(--color-gold);
    height: 3.5rem;
    width: 3.5rem;
    color: #fff;
    border-radius: 50%;
    display: grid;
    place-items: center;
    box-shadow: 0 4px 15px rgba(184, 149, 108, 0.3);
}

.playpause:hover {
    background: var(--color-gold-dark);
    transform: scale(1.05);
}

.fa-play {
    position: relative;
    display: inline-block;
    left: 0.1rem;
}

.main-controls {
    position: relative;
    border-radius: 2rem;
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.color {
    color: var(--color-error);
}

/* List Close & Back Button */
.list-close,
.back-button {
    outline: none;
    border: 1px solid var(--color-border);
    background: var(--color-btn-bg);
    font-size: 0.9rem;
    color: var(--color-gold-dark);
    height: 2.188rem;
    width: 2.188rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.list-close {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
}

.back-button {
    position: absolute;
    bottom: 0.8rem;
    left: 0.8rem;
}

.list-close:hover,
.back-button:hover {
    background: var(--color-btn-hover);
    border-color: var(--color-gold);
}

/* Songs List */
.songs-list {
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--color-bg-card);
    top: 0;
    left: 0;
    z-index: 10;
    visibility: hidden;
    opacity: 0;
    border-radius: 16px;
    padding: 0;
    overflow: hidden;
    transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}

.showlist {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.2s ease, visibility 0s linear 0s;
}

.songs-list #chapters-content {
    height: 100%;
    overflow-y: auto;
    padding: 3.5rem 1rem 1rem 1rem;
}

/* Swiper Pagination */
.swiper-pagination-bullet {
    background: var(--color-border);
    opacity: 1;
}

.swiper-pagination-bullet-active {
    background: var(--color-gold);
}

/* No Books */
.no-books {
    text-align: center;
    color: var(--color-text);
    padding: 50px;
}

.no-books i {
    font-size: 80px;
    margin-bottom: 20px;
    opacity: 0.3;
    color: var(--color-gold);
}

.no-books h2 {
    color: var(--color-text);
    margin-bottom: 10px;
}

.no-books p {
    color: var(--color-text-muted);
}

/* Validation Modal */
.validation-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(44, 44, 44, 0.5);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.validation-modal-backdrop.show {
    display: flex;
}

.validation-modal {
    width: 90%;
    max-width: 450px;
    background: var(--color-bg-card);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--color-border);
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s ease-out;
}

.validation-modal-backdrop.show .validation-modal {
    transform: scale(1);
    opacity: 1;
}

.validation-modal-header {
    background: var(--color-bg-elevated);
    color: var(--color-text);
    padding: 25px 30px;
    border-radius: 16px 16px 0 0;
    text-align: center;
    border-bottom: 1px solid var(--color-border);
}

.validation-modal-header h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--color-text);
}

.validation-modal-header p {
    margin: 8px 0 0 0;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.validation-modal-body {
    padding: 30px;
}

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

.validation-form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--color-text);
    font-weight: 600;
    font-size: 0.9rem;
}

.validation-form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg-card);
    color: var(--color-text);
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: 'Lato', sans-serif;
}

.validation-form-group input:focus {
    outline: none;
    border-color: var(--color-gold);
    box-shadow: 0 0 0 3px rgba(184, 149, 108, 0.15);
}

.validation-modal-footer {
    padding: 20px 30px;
    display: flex;
    gap: 10px;
}

.validation-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.validation-btn-primary {
    background: var(--color-gold);
    color: white;
}

.validation-btn-primary:hover {
    background: var(--color-gold-dark);
    transform: translateY(-1px);
}

.validation-btn-secondary {
    background: var(--color-bg-elevated);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

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

.validation-loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Responsive */
@media (max-width: 768px) {
    .filter-toggle-btn {
        top: 15px;
        right: 15px;
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .filter-modal {
        width: 95%;
        max-height: 95vh;
    }

    .modal-body {
        padding: 20px;
        max-height: calc(95vh - 160px);
    }

    .filter-form {
        grid-template-columns: 1fr;
    }

    .modal-footer {
        flex-direction: column;
        gap: 10px;
    }

    .btn-submit,
    .btn-clear {
        width: 100%;
    }

    .swiper {
        padding: 50px 20px;
    }

    .swiper-slide {
        width: 320px;
        height: 500px;
    }

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

    .action-buttons {
        gap: 15px;
    }

    .action-btn {
        padding: 12px 15px;
        min-width: 85px;
        width: 85px;
        height: 70px;
    }

    .action-btn i {
        font-size: 20px;
    }

    .music-controls {
        margin-top: 1.0rem;
    }

    .container {
        margin-top: -50px;
    }

    .footer img {
        height: 30px;
    }
}

/* Image Protection */
.book-cover-image,
.music-img img,
img {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    pointer-events: auto;
}

.book-cover-container img {
    -webkit-user-select: none !important;
    -webkit-user-drag: none !important;
    pointer-events: auto !important;
}