/* ============================================
   THEME VARIABLES & RESET
   Dark Purple & Pink Theme
   ============================================ */
:root {
    /* Color Palette */
    --bg-body: #13001C;
    /* Deep Dark Purple */
    --bg-surface: #240035;
    /* Lighter Dark Purple for cards/modals */
    --bg-card: #35004D;
    /* Card Background */

    --primary-color: #FF007F;
    /* Bright Pink - Main Accents/Boundaries */
    --primary-dark: #C50062;
    /* Darker Pink - Hover states */
    --secondary-color: #9C27B0;
    /* Purple - Secondary accents */

    --text-color: #FFC0CB;
    /* Light Pink - Main Text ("Words") */
    --light-text: #F3E5F5;
    /* Very Light Purple/Pink - Secondary Text */
    --dark-color: #000000;
    /* Black - High contrast elements */

    --border-color: #FF69B4;
    /* Hot Pink - Boundaries/Borders */

    --success-color: #00E676;
    --danger-color: #FF1744;
    --warning-color: #FFC400;
    --white: #F3E5F5;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #FF007F 0%, #9C27B0 100%);
    --gradient-secondary: linear-gradient(135deg, #9C27B0 0%, #6200EA 100%);

    /* Spacing & Layout */
    --padding-container: 20px;
    --radius-sm: 8px;
    --radius-md: 16px;

    /* Shadows - Glowy Pink/Purple Feel */
    --shadow-sm: 0 2px 4px rgba(255, 0, 127, 0.2);
    --shadow-md: 0 4px 8px rgba(156, 39, 176, 0.3);
    --shadow-lg: 0 8px 16px rgba(156, 39, 176, 0.4);

    /* Loading state animation */
    --skeleton-bg: #240035;
    --skeleton-shimmer: linear-gradient(90deg, transparent, rgba(255, 0, 127, 0.1), transparent);
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.book-cover {
    background-color: var(--skeleton-bg);
    position: relative;
    overflow: hidden;
}

.book-cover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--skeleton-shimmer);
    animation: shimmer 1.5s infinite;
}

.book-cover img {
    position: relative;
    z-index: 1;
    transition: opacity 0.3s ease-in-out;
}

.book-cover img[loading="lazy"] {
    opacity: 0;
}

.book-cover img.loaded {
    opacity: 1;
}

/* ============================================
   BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--white);
    margin-bottom: 0.5rem;
    font-weight: 700;
}

p {
    color: var(--text-color);
    margin-bottom: 1rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--primary-dark);
}

/* ============================================
   LAYOUT COMPONENTS
   ============================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--padding-container);
}

/* Header */
header {
    background: var(--bg-surface);
    padding: 1rem 0;
    border-bottom: 2px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

header h1 {
    color: var(--primary-color);
    font-size: 2.5rem;
    /* Increased size */
    display: flex;
    align-items: center;
    justify-content: center;
    /* Centered */
    gap: 15px;
}

header p {
    color: var(--light-text);
    font-size: 1rem;
    opacity: 0.8;
    text-align: center;
    /* Centered subtitle */
    max-width: 600px;
    margin: 0 auto 10px;
}

/* Navigation */
nav {
    background: var(--bg-surface);
    padding: 0.8rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 105, 180, 0.3);
    backdrop-filter: blur(10px);
}

#syncCodeModal {
    z-index: 30000 !important;
}

nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-links a {
    color: var(--light-text);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary-color);
}

/* Search Box */
.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border-radius: 20px;
    padding: 5px 15px;
    border: 1px solid var(--border-color);
    margin-right: 15px;
    width: 300px;
    position: relative;
    /* Added to constrain absolute suggestions */
}

.search-box input {
    background: transparent;
    border: none;
    color: var(--white);
    padding: 5px;
    width: 100%;
    outline: none;
}

.search-box input::placeholder {
    color: rgba(255, 192, 203, 0.5);
}

.search-box button {
    background: transparent;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

/* Global Form Inputs - Match Search Bar */
input,
textarea,
select {
    background: var(--bg-card) !important;
    color: var(--white) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-sm) !important;
    padding: 10px !important;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 10px rgba(255, 0, 127, 0.3);
}

/* Audio Player Dark Mode Hack */
audio {
    border-radius: 30px;
    opacity: 0.9;
    color-scheme: dark;
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--white);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Donate Button */
.donate-btn {
    background: var(--gradient-primary);
    color: var(--white);
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 0 10px rgba(255, 0, 127, 0.5);
    border: 1px solid var(--white);
}

.donate-btn:hover {
    transform: scale(1.05);
    color: var(--white);
}

/* Admin Button */
.admin-nav-btn {
    color: var(--light-text);
    margin-left: 15px;
    font-size: 1.1rem;
}

.admin-nav-btn:hover {
    color: var(--primary-color);
}

/* ============================================
   SECTIONS
   ============================================ */
section {
    padding: 2rem 0;
}

.hero {
    text-align: center;
    padding: 4rem 0;
    background: radial-gradient(circle at center, rgba(156, 39, 176, 0.2) 0%, transparent 70%);
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--white);
    text-shadow: 0 0 10px rgba(255, 0, 127, 0.5);
}

/* ============================================
   SCROLLBARS
   ============================================ */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 5px;
    border: 2px solid var(--bg-body);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* ============================================
   UTILITIES
   ============================================ */
.hidden {
    display: none !important;
}

/* ============================================
   FOOTER STYLES
   ============================================ */
footer {
    background: var(--bg-surface);
    color: var(--text-color);
    padding: 3rem 0 1rem;
    border-top: 2px solid var(--border-color);
    margin-top: 4rem;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.3);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    color: var(--white);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary-color);
    padding-left: 10px;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: var(--light-text);
    transition: all 0.2s;
}

.footer-links a:hover {
    color: var(--primary-color);
    padding-left: 5px;
}

.footer-bottom {
    text-align: center;
    border-top: 1px solid rgba(255, 105, 180, 0.2);
    padding-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--light-text);
    opacity: 0.8;
}

/* ============================================
   MINI PLAYER (Persistent Audio Player)
   ============================================ */
#miniPlayer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--bg-surface);
    border-top: 2px solid var(--primary-color);
    padding: 10px 0;
    z-index: 1000;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.5);
    display: none;
    /* Hidden by default until played */
    backdrop-filter: blur(10px);
}

#miniPlayer.active {
    display: block !important;
}

/* ============================================
   SEARCH SUGGESTIONS (FIX)
   ============================================ */
.search-suggestions {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    width: 100% !important;
    background: var(--bg-surface) !important;
    border: 2px solid var(--primary-color) !important;
    border-radius: 0 0 12px 12px !important;
    z-index: 10000 !important;
    display: none;
    max-height: 400px !important;
    overflow-y: auto !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8) !important;
    margin-top: 1px !important;
}

.suggestion-item {
    display: flex !important;
    align-items: center !important;
    padding: 12px !important;
    border-bottom: 1px solid rgba(255, 105, 180, 0.1) !important;
    cursor: pointer !important;
    transition: background 0.2s !important;
    background: var(--bg-surface) !important;
}

.suggestion-item:last-child {
    border-bottom: none !important;
}

.suggestion-item:hover {
    background: rgba(255, 0, 127, 0.1) !important;
}

.suggestion-thumb {
    width: 45px !important;
    height: 65px !important;
    object-fit: cover !important;
    border-radius: 6px !important;
    margin-right: 15px !important;
    border: 1px solid rgba(255, 105, 180, 0.3) !important;
}

.suggestion-info {
    flex: 1 !important;
}

.suggestion-title {
    font-weight: 700 !important;
    color: var(--white) !important;
    font-size: 1rem !important;
    margin-bottom: 4px !important;
}

.suggestion-author {
    color: var(--text-color) !important;
    font-size: 0.85rem !important;
}

.mini-player-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mini-player-cover {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    object-fit: cover;
    margin-right: 15px;
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.mini-player-info {
    flex: 1;
    cursor: pointer;
}

.mini-player-title {
    color: var(--white);
    margin: 0;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-player-author {
    color: var(--primary-color);
    margin: 0;
    font-size: 0.8rem;
}

.mini-player-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.mini-player-btn {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
    padding: 5px;
}

.mini-player-btn:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.mini-player-btn.play-pause {
    background: var(--gradient-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(255, 0, 127, 0.4);
}

/* ============================================
   MODALS
   ============================================ */
.modal-content {
    background: var(--bg-surface) !important;
    border: 2px solid var(--primary-color) !important;
    box-shadow: 0 0 30px rgba(156, 39, 176, 0.5) !important;
    color: var(--text-color) !important;
}

.modal-close {
    color: var(--primary-color) !important;
    transition: transform 0.3s;
}

.modal-close:hover {
    color: var(--danger-color) !important;
    transform: rotate(90deg);
}

/* Book Details text override to ensure visibility */
#modalBookTitle,
#audioPlayerTitle {
    color: var(--white) !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

#modalBookAuthor,
#audioPlayerAuthor {
    color: var(--primary-color) !important;
}

#modalBookDescription {
    color: var(--light-text) !important;
}

/* Audio Player within Modal */
#enhancedAudioPlayer {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
}

#syncCodeModal {
    z-index: 30000 !important;
}

/* Search Suggestions Enhancements */
.suggestion-category {
    padding: 10px 15px 5px !important;
    font-size: 0.75rem !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    color: var(--primary-color) !important;
    background: var(--bg-surface) !important;
    letter-spacing: 1px !important;
    border-bottom: 1px solid rgba(255, 105, 180, 0.1) !important;
}

.suggestion-icon {
    width: 45px !important;
    height: 45px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: var(--bg-card) !important;
    border-radius: 50% !important;
    margin-right: 15px !important;
    color: var(--primary-color) !important;
    border: 1px solid var(--border-color) !important;
    font-size: 1.2rem !important;
}

.author-suggestion {
    padding: 10px 12px !important;
}

.suggestion-author {
    color: var(--text-color) !important;
    font-size: 0.85rem !important;
}

/* Offline Status Badge */
#offlineBadge {
    position: fixed;
    top: 80px;
    right: 20px;
    background: var(--danger-color);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    z-index: 10001;
    display: none;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(255, 23, 68, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: badge-pulse 2s infinite;
}

@keyframes badge-pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* ============================================
   PROMO BANNER & ADS (RESPONSIVE)
   ============================================ */
.promo-banner-section {
    margin: 4rem 0;
}

.promo-banner {
    background: var(--bg-surface);
    color: var(--text-color);
    padding: 3rem 2rem;
    border-radius: 24px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    border: 2px solid var(--primary-color);
}

.promo-banner-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(208, 51, 255, 0.05) 0%, transparent 70%);
}

.promo-banner-content {
    position: relative;
    z-index: 1;
}

.promo-banner-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.promo-banner-text {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: var(--light-text);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.promo-banner-badges {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.promo-badge {
    background: var(--bg-card);
    padding: 0.6rem 1.2rem;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    color: var(--primary-light);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ad-wrapper {
    text-align: center;
    margin: 2rem auto;
    max-width: 100%;
    overflow: hidden;
}

/* Mobile Adjustments for Banner */
@media (max-width: 768px) {
    .promo-banner-section {
        margin: 2rem 0;
    }

    .promo-banner {
        padding: 2rem 1rem;
        border-radius: 16px;
    }

    .promo-banner-title {
        font-size: 1.8rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .promo-banner-text {
        font-size: 1rem;
    }

    .promo-badge {
        padding: 0.4rem 1rem;
        font-size: 0.85rem;
        flex: 1 1 140px;
        justify-content: center;
    }
}