/* ============================================
ARKANA — Library Pages Styles
============================================ */

/* Library Home */
.library-home {
    position: relative;
    z-index: 5;
    padding: var(--spacing-xl) var(--spacing-md);
    min-height: 80vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.library-home-container {
    max-width: 1000px;
    width: 100%;
}

/* Ahura Welcome */
.ahura-welcome {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xxl);
    padding: var(--spacing-lg);
}

.ahura-mascot {
    flex-shrink: 0;
    width: 140px;
    height: 160px;
}

.ahura-mascot img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(44, 28, 18, 0.5));
    animation: mascotFloat 3s ease-in-out infinite;
}

@keyframes mascotFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.ahura-bubble {
    position: relative;
    background: linear-gradient(135deg, #f5e6d3 0%, #e8d5b5 100%);
    border: 3px solid var(--ancient-gold);
    border-radius: 20px;
    padding: var(--spacing-lg) var(--spacing-xl);
    flex: 1;
    box-shadow: 0 8px 25px rgba(44, 28, 18, 0.4);
}

.bubble-text {
    font-family: var(--font-body);
    font-size: 1.15rem;
    color: var(--dark-wood);
    line-height: 1.6;
    margin: 0;
}

.bubble-text strong {
    color: var(--wine-red);
}

.bubble-tail {
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 15px solid transparent;
    border-bottom: 15px solid transparent;
    border-right: 20px solid var(--ancient-gold);
}

.bubble-tail::after {
    content: '';
    position: absolute;
    left: 3px;
    top: -12px;
    width: 0;
    height: 0;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    border-right: 17px solid #f5e6d3;
}

/* Section Cards Grid */
.library-sections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-lg);
}

.section-card {
    background: linear-gradient(135deg, rgba(91, 29, 39, 0.9) 0%, rgba(61, 18, 25, 0.95) 100%);
    border: 3px solid var(--ancient-gold);
    border-radius: 12px;
    padding: var(--spacing-xl);
    text-decoration: none;
    color: var(--parchment);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.section-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(201, 164, 76, 0.4);
    border-color: var(--bright-gold);
}

.section-card-icon { font-size: 3rem; margin-bottom: var(--spacing-md); }
.section-card-title { font-family: var(--font-title); font-size: 1.6rem; color: var(--bright-gold); margin-bottom: var(--spacing-sm); }
.section-card-desc { font-family: var(--font-body); font-size: 1.05rem; line-height: 1.5; margin-bottom: var(--spacing-md); }
.section-card-arrow { position: absolute; bottom: var(--spacing-md); right: var(--spacing-md); font-size: 1.5rem; color: var(--ancient-gold); }

/* Subpage Content */
.subpage-content {
    position: relative;
    z-index: 5;
    padding: var(--spacing-xl) var(--spacing-md);
    min-height: 100vh;
}

.subpage-container {
    max-width: 900px;
    margin: 0 auto;
}

/* Back Button with semi-transparent gold background */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-title);
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark-wood);
    text-decoration: none;
    margin-bottom: var(--spacing-lg);
    padding: 10px 20px;
    background: rgba(201, 164, 76, 0.25); /* Semi-transparent gold */
    border: 2px solid var(--ancient-gold);
    border-radius: 8px;
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.back-btn:hover {
    background: rgba(201, 164, 76, 0.45);
    transform: translateX(-5px);
    box-shadow: 0 6px 15px rgba(201, 164, 76, 0.3);
}

/* Scroll Header */
.scroll-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--spacing-xl);
}

.scroll-frame-wrapper {
    position: relative;
    width: 100%;
    max-width: 700px;
}

.scroll-frame-image {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 10px 30px rgba(44, 28, 18, 0.7));
}

.scroll-content {
    position: absolute;
    top: 12%;
    left: 12%;
    right: 12%;
    bottom: 12%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
}

.scroll-title {
    font-family: var(--font-title);
    font-size: 2.2rem;
    color: var(--dark-wood);
    margin-bottom: var(--spacing-sm);
}

.scroll-text {
    font-family: var(--font-body);
    font-size: 1.1rem;
    color: var(--dark-wood);
    font-style: italic;
}

.guardian-character {
    position: absolute;
    width: 120px;
    height: 140px;
    left: -40px;
    bottom: -10px;
}

.guardian-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(44, 28, 18, 0.5));
    animation: guardianFloat 3s ease-in-out infinite;
}

@keyframes guardianFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Caramel Content & Educational Text Styles */
.caramel-content {
    background: linear-gradient(135deg, #f5e6d3 0%, #ede0c8 50%, #e8d5b5 100%);
    border: 3px solid var(--dark-gold);
    border-radius: 10px;
    padding: var(--spacing-xl);
    box-shadow: inset 0 0 30px rgba(139, 107, 40, 0.2);
    color: var(--dark-wood);
}

.caramel-content h3 {
    font-family: var(--font-title);
    color: var(--wine-red);
    font-size: 1.5rem;
    margin-top: 25px;
    margin-bottom: 15px;
    border-bottom: 2px solid var(--dark-gold);
    padding-bottom: 5px;
}

.caramel-content h3:first-child { margin-top: 0; }

.caramel-content h4 {
    font-family: var(--font-title);
    color: var(--dark-wood);
    font-size: 1.2rem;
    margin-top: 20px;
    margin-bottom: 10px;
}

.caramel-content p {
    font-family: var(--font-body);
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 15px;
}

.caramel-content ul {
    list-style-type: none;
    padding-left: 0;
    margin-bottom: 15px;
}

.caramel-content li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 8px;
    font-size: 1.05rem;
}

.caramel-content li::before {
    content: '✦';
    position: absolute;
    left: 0;
    color: var(--ancient-gold);
}

/* Specific styles for formulas and examples */
.formula {
    font-family: 'Courier New', monospace;
    background: rgba(201, 164, 76, 0.2);
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: bold;
    display: inline-block;
    margin: 5px 0;
    color: var(--dark-wood);
}

.example-box {
    background: rgba(255, 255, 255, 0.4);
    border-left: 4px solid var(--ancient-gold);
    padding: 10px 15px;
    margin: 10px 0 20px 0;
    border-radius: 0 8px 8px 0;
}

.example-box p {
    margin: 5px 0;
    font-style: italic;
}

.example-box .translation {
    color: var(--wine-red-dark);
    font-size: 0.95rem;
}

.verb-list-item {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px dashed var(--dark-gold);
}

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

.verb-list-item strong {
    color: var(--wine-red);
    font-size: 1.2rem;
    font-family: var(--font-title);
}

/* Media Sections */
.media-section {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px dashed var(--dark-gold);
}

.media-title {
    font-family: var(--font-title);
    font-size: 1.4rem;
    color: var(--wine-red);
    margin-bottom: var(--spacing-md);
}

/* Video Wrapper - CORREGIDO para mostrar YouTube correctamente */
.video-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: var(--spacing-sm);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.video-container {
    background: rgba(0, 0, 0, 0.8);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: var(--spacing-sm);
}

.library-video { width: 100%; height: auto; max-height: 400px; display: block; }

.youtube-link {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: #ff0000;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    padding: var(--spacing-sm) var(--spacing-md);
    background: rgba(255, 255, 255, 0.9);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.youtube-link:hover { background: #fff; transform: translateY(-2px); }

.audio-container { background: rgba(255, 255, 255, 0.3); border-radius: 8px; padding: var(--spacing-md); }
.library-audio { width: 100%; height: 40px; }

/* Flipbook */
.flipbook-container { background: rgba(255, 255, 255, 0.5); border-radius: 8px; padding: var(--spacing-lg); }
.flipbook-pages { position: relative; width: 100%; max-width: 600px; margin: 0 auto var(--spacing-md); aspect-ratio: 3/4; background: #fff; border-radius: 6px; overflow: hidden; }
.flipbook-page { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 0.5s ease; }
.flipbook-page.active { opacity: 1; }
.page-image { max-width: 100%; max-height: 100%; object-fit: contain; }
.flipbook-controls { display: flex; align-items: center; justify-content: center; gap: var(--spacing-md); flex-wrap: wrap; }
.flip-btn { font-family: var(--font-title); font-size: 0.95rem; font-weight: 600; color: var(--dark-wood); background: linear-gradient(135deg, var(--ancient-gold) 0%, var(--dark-gold) 100%); border: 2px solid var(--dark-gold); border-radius: 6px; padding: var(--spacing-sm) var(--spacing-md); cursor: pointer; transition: all 0.3s ease; }
.flip-btn:hover { background: linear-gradient(135deg, var(--bright-gold) 0%, var(--ancient-gold) 100%); transform: translateY(-2px); }
.page-indicator { font-family: var(--font-body); font-size: 1rem; color: var(--dark-wood); font-weight: 600; }

/* Citation */
.citation-section { margin-top: var(--spacing-xl); text-align: center; }
.citation-btn { display: inline-flex; align-items: center; gap: var(--spacing-sm); padding: var(--spacing-md) var(--spacing-xl); background: linear-gradient(135deg, var(--wine-red) 0%, var(--wine-red-dark) 100%); color: var(--parchment); font-family: var(--font-title); font-size: 1rem; font-weight: 600; text-decoration: none; border-radius: 8px; border: 2px solid var(--ancient-gold); transition: all 0.3s ease; }
.citation-btn:hover { background: linear-gradient(135deg, var(--wine-red-light) 0%, var(--wine-red) 100%); transform: translateY(-3px); box-shadow: 0 8px 20px rgba(201, 164, 76, 0.4); }

/* Flashcard Game */
.flashcard-game { background: linear-gradient(135deg, #f5e6d3 0%, #ede0c8 100%); border: 3px solid var(--dark-gold); border-radius: 12px; padding: var(--spacing-xl); margin-top: var(--spacing-xl); }
.game-header { display: flex; justify-content: space-around; margin-bottom: var(--spacing-lg); padding-bottom: var(--spacing-md); border-bottom: 2px solid var(--dark-gold); }
.score-display, .progress-display { text-align: center; }
.score-label, .progress-label { display: block; font-family: var(--font-title); font-size: 0.9rem; color: var(--dark-wood); margin-bottom: var(--spacing-xs); }
.score-value, .progress-value { font-family: var(--font-title); font-size: 1.5rem; font-weight: 700; color: var(--wine-red); }
.flashcard-container { perspective: 1000px; width: 100%; max-width: 400px; height: 300px; margin: 0 auto var(--spacing-lg); }
.flashcard { position: relative; width: 100%; height: 100%; transition: transform 0.6s; transform-style: preserve-3d; cursor: pointer; }
.flashcard.flipped { transform: rotateY(180deg); }
.flashcard-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; background: linear-gradient(135deg, var(--wine-red) 0%, var(--wine-red-dark) 100%); border: 3px solid var(--ancient-gold); border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--spacing-lg); box-shadow: 0 8px 25px rgba(44, 28, 18, 0.4); }
.flashcard-back { transform: rotateY(180deg); background: linear-gradient(135deg, var(--dark-gold) 0%, var(--bronze) 100%); }
.flashcard-label { font-family: var(--font-title); font-size: 0.9rem; color: var(--bright-gold); letter-spacing: 0.1em; margin-bottom: var(--spacing-sm); }
.flashcard-word { font-family: var(--font-title); font-size: 3rem; font-weight: 700; color: var(--parchment); text-align: center; }
.flashcard-hint { font-family: var(--font-body); font-size: 0.9rem; color: var(--parchment-dark); font-style: italic; margin-top: var(--spacing-md); }
.game-controls { display: flex; justify-content: center; gap: var(--spacing-md); margin-bottom: var(--spacing-md); flex-wrap: wrap; }
.game-btn { font-family: var(--font-title); font-size: 1rem; font-weight: 600; padding: var(--spacing-md) var(--spacing-lg); border-radius: 8px; border: 2px solid var(--ancient-gold); cursor: pointer; transition: all 0.3s ease; }
.btn-didnt-know { background: linear-gradient(135deg, #8B0000 0%, #5C0000 100%); color: var(--parchment); }
.btn-flip { background: linear-gradient(135deg, var(--ancient-gold) 0%, var(--dark-gold) 100%); color: var(--dark-wood); }
.btn-knew { background: linear-gradient(135deg, #2E8B57 0%, #1E5C3A 100%); color: var(--parchment); }
.game-nav { display: flex; justify-content: center; gap: var(--spacing-md); }
.nav-btn { font-family: var(--font-title); font-size: 0.95rem; padding: var(--spacing-sm) var(--spacing-lg); background: rgba(44, 28, 18, 0.3); color: var(--parchment); border: 2px solid var(--dark-gold); border-radius: 6px; cursor: pointer; transition: all 0.3s ease; }
.nav-btn:hover { background: rgba(201, 164, 76, 0.2); border-color: var(--ancient-gold); }
.game-complete { text-align: center; padding: var(--spacing-xl); background: rgba(201, 164, 76, 0.2); border-radius: 12px; margin-top: var(--spacing-lg); }
.game-complete h3 { font-family: var(--font-title); font-size: 2rem; color: var(--wine-red); margin-bottom: var(--spacing-md); }
.final-score { font-family: var(--font-title); font-size: 1.3rem; font-weight: 700; color: var(--wine-red); margin: var(--spacing-md) 0; }
.btn-restart { background: linear-gradient(135deg, var(--ancient-gold) 0%, var(--bright-gold) 100%); color: var(--dark-wood); font-size: 1.1rem; padding: var(--spacing-md) var(--spacing-xl); }

/* Responsive */
@media (max-width: 767px) {
    .ahura-welcome { flex-direction: column; text-align: center; }
    .bubble-tail { left: 50%; top: auto; bottom: -20px; transform: translateX(-50%) rotate(90deg); }
    .library-sections-grid { grid-template-columns: 1fr; }
    .scroll-header { flex-direction: column; }
    .guardian-character { position: relative; left: auto; bottom: auto; margin-top: var(--spacing-md); }
    .game-controls { flex-direction: column; }
    .game-btn { width: 100%; }
    
    .video-wrapper {
        aspect-ratio: 16 / 9;
    }
}