/* FILE LOCATION: public/assets/css/style.css */

/* --- 1. FONTS & VARIABLES --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@300;400;700&display=swap');

:root {
    /* Old Book / Soft Vibe Palette */
    --primary: #8d6e63;       /* Warm Brown */
    --primary-hover: #6d4c41; /* Darker Brown */
    --primary-light: #efebe9; /* Very Light Brown */
    
    --bg-body: #fdfbf7;       /* Cream/Paper White */
    --card-bg: #ffffff;       
    --text-main: #3e2723;     /* Dark Coffee */
    --text-light: #795548;    /* Soft Brown Text */
    --border-color: #d7ccc8;  /* Tan Border */
    
    /* Footer Colors */
    --footer-bg: #fdfbf7;     
    --footer-text: #795548;
    --footer-title: #3e2723;
    
    /* Neumorphic Shadows (Warm) */
    --neu-light: #ffffff;
    --neu-dark: #d7ccc8;
    --neu-flat: 6px 6px 12px var(--neu-dark), -6px -6px 12px var(--neu-light);
    --neu-pressed: inset 4px 4px 8px var(--neu-dark), inset -4px -4px 8px var(--neu-light);
    
    /* Navbar Glass - NOW CREAM (Matches Body) NOT WHITE */
    --glass-bg: rgba(253, 251, 247, 0.95);
    
    --shadow-soft: 0 4px 12px rgba(93, 64, 55, 0.08); 
    --radius: 20px;
    --font-main: 'Inter', sans-serif;
    --font-serif: 'Merriweather', serif;
}

/* Dark Mode */
[data-theme="dark"] {
    --bg-body: #1c1917;
    --card-bg: #292524;
    --text-main: #e7e5e4;
    --text-light: #a8a29e;
    --border-color: #44403c;
    --primary: #d6d3d1;
    --primary-hover: #ffffff;
    
    --footer-bg: #1c1917;
    --footer-text: #a8a29e;
    --footer-title: #e7e5e4;
    
    --neu-light: #292524;
    --neu-dark: #0c0a09;
    --neu-flat: 5px 5px 10px var(--neu-dark), -5px -5px 10px var(--neu-light);
    --neu-pressed: inset 5px 5px 10px var(--neu-dark), inset -5px -5px 10px var(--neu-light);
    
    /* Dark Glass */
    --glass-bg: rgba(28, 25, 23, 0.95);
}

/* Sepia Mode */
[data-theme="sepia"] {
    --bg-body: #f4ecd8;
    --card-bg: #f4ecd8;
    --text-main: #5b4636;
    --text-light: #8f7966;
    --primary: #d35400;
    --glass-bg: rgba(244, 236, 216, 0.95);
}

/* --- 2. GLOBAL STYLES --- */
* { box-sizing: border-box; margin: 0; padding: 0; outline: none; }

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: var(--font-main);
    transition: background 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 15px;
}

a { text-decoration: none; color: inherit; transition: 0.2s ease; }
ul { list-style: none; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 25px;
    width: 100%;
}

/* --- 3. NAVBAR (Fixed White Background) --- */
.navbar {
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--glass-bg) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-soft);
    transition: background-color 0.3s ease;
}

.nav-flex { display: flex; justify-content: space-between; align-items: center; }

.logo {
    font-family: var(--font-serif);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.5px;
}
.logo i { color: var(--primary); }

.nav-links { display: flex; align-items: center; gap: 10px; }

.nav-links a { 
    font-weight: 600; font-size: 0.95rem; color: var(--text-light);
    padding: 10px 20px; border-radius: 50px; transition: all 0.2s ease;
}
.nav-links a:hover { 
    background-color: var(--primary-light); 
    color: var(--primary-hover); 
}

/* Soft Theme Toggle Button */
#theme-toggle.neu-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    margin-left: 10px;
}

#theme-toggle.neu-btn:hover {
    transform: rotate(30deg);
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* --- 4. CARDS --- */
.grid-books {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 35px;
    padding: 20px 0;
}

.book-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: all 0.3s ease; padding: 12px;
}

.book-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}

.book-card-image {
    width: 100%; aspect-ratio: 2/3; overflow: hidden;
    border-radius: 12px; position: relative;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.book-cover {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.5s ease;
}
.book-card:hover .book-cover { transform: scale(1.05); }

.cat-badge {
    position: absolute; top: 12px; left: 12px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    color: var(--text-main); padding: 5px 12px;
    border-radius: 50px; font-size: 0.75rem; font-weight: 700;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1); z-index: 2;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.book-card-body { padding-top: 15px; padding-left: 5px; padding-right: 5px; flex: 1; display: flex; flex-direction: column; }
.book-card-body h3 { font-family: var(--font-serif); font-size: 1.15rem; font-weight: 700; color: var(--text-main); margin-bottom: 5px; }
.book-author { font-size: 0.9rem; color: var(--text-light); margin-bottom: 15px; font-weight: 500; }

.book-stats {
    display: flex; justify-content: space-between; font-size: 0.8rem;
    color: var(--text-light); background: var(--bg-body);
    padding: 10px 15px; border-radius: 12px; margin-bottom: 15px;
}
.stat-item i { color: var(--primary); margin-right: 5px; }

.book-actions { margin-top: auto; }
.btn-premium {
    display: block; width: 100%; text-align: center; padding: 12px 0;
    border-radius: 50px; font-size: 0.95rem; font-weight: 600;
    transition: 0.2s; font-family: var(--font-main);
}
.btn-read { background: var(--primary); color: #fff; box-shadow: 0 4px 10px rgba(141, 110, 99, 0.3); }
.btn-read:hover { background: var(--primary-hover); transform: translateY(-2px); }

/* --- 5. SEARCH BAR --- */
.header-search { flex: 1; max-width: 450px; margin: 0 40px; position: relative; }
.header-search input {
    width: 100%; padding: 12px 50px 12px 25px; border-radius: 50px;
    border: 1px solid var(--border-color);
    background: var(--bg-body) !important; 
    color: var(--text-main) !important;
    font-family: inherit;
    transition: 0.3s;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}
.header-search input:focus {
    background: var(--card-bg) !important;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}
.header-search button {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary);
    border: none;
    color: white;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}
.header-search button:hover { background: var(--primary-hover); }

/* --- 6. NEUMORPHIC FOOTER --- */
.site-footer {
    background-color: var(--footer-bg);
    color: var(--footer-text);
    padding: 80px 0 30px;
    margin-top: 60px;
    font-family: var(--font-main);
    box-shadow: 0 -10px 20px -10px rgba(0,0,0,0.05);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: 50px;
}

.footer-col h3 { 
    color: var(--footer-title); 
    font-family: var(--font-serif);
    font-size: 1.8rem; 
    margin-bottom: 20px; 
    font-weight: 700; 
}
.footer-col h4 { 
    color: var(--footer-title); 
    font-size: 1rem; 
    margin-bottom: 25px; 
    font-weight: 700; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
}
.footer-col p { line-height: 1.7; margin-bottom: 25px; opacity: 0.9; }

.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 12px; }
.footer-col ul li a { 
    color: var(--footer-text); 
    transition: all 0.2s; 
    display: inline-block;
}
.footer-col ul li a:hover { 
    color: var(--primary); 
    padding-left: 5px; 
}

/* Neumorphic Social Buttons */
.social-links { display: flex; gap: 15px; }
.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 45px; height: 45px; 
    background: var(--footer-bg);
    border-radius: 50%; 
    color: var(--footer-title); 
    text-decoration: none; 
    transition: all 0.3s;
    box-shadow: var(--neu-flat);
    border: none;
}

.social-links a:hover { 
    color: var(--primary); 
    box-shadow: var(--neu-pressed);
    transform: translateY(0);
}

/* Neumorphic Theme Toggle */
.theme-btn-footer, #theme-toggle-desk {
    display: inline-flex; align-items: center; gap: 10px;
    background: var(--footer-bg);
    color: var(--footer-title);
    padding: 12px 24px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: 0.3s;
    font-weight: 600;
    border: none;
    box-shadow: var(--neu-flat);
}

.theme-btn-footer:hover, #theme-toggle-desk:hover { 
    color: var(--primary);
    box-shadow: var(--neu-pressed);
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding-top: 30px;
    margin-top: 40px;
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.9rem; opacity: 0.8;
}

/* --- 7. MOBILE NAVIGATION (Fixed) --- */
.mobile-nav { 
    display: none !important; 
}

@media (max-width: 768px) {
    .nav-links, .header-search { display: none; }
    .grid-books { grid-template-columns: 1fr 1fr; gap: 15px; }
    
    .footer-grid { grid-template-columns: 1fr; gap: 40px; text-align: center; }
    .social-links { justify-content: center; }
    .footer-bottom { flex-direction: column; gap: 15px; text-align: center; }
    .theme-btn-footer { margin: 20px auto 0; }
    
    .mobile-nav {
        display: flex !important; 
        position: fixed; bottom: 0; left: 0; width: 100%;
        background: var(--glass-bg); backdrop-filter: blur(15px);
        padding: 12px 0; justify-content: space-around;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.05); z-index: 999; 
        border-top: 1px solid var(--border-color);
    }
    
    .mobile-nav a {
        color: var(--text-light); text-decoration: none; display: flex;
        flex-direction: column; align-items: center; font-size: 0.7rem; flex: 1; cursor: pointer;
        transition: 0.2s; font-weight: 500;
    }
    .mobile-nav a i { font-size: 1.4rem; margin-bottom: 5px; }
    .mobile-nav a.active { color: var(--primary); font-weight: 700; transform: translateY(-2px); }
    
    body { padding-bottom: 80px; }
}

/* Utilities */
.section-title { margin-bottom: 30px; display: flex; justify-content: space-between; align-items: center; }
.section-title h1, .section-title h2 { font-family: var(--font-serif); font-size: 2rem; color: var(--text-main); }

/* Theme Modal */
.theme-modal {
    display: none; position: fixed; bottom: 80px; right: 15px; width: 220px;
    background: var(--card-bg); border-radius: 20px;
    box-shadow: var(--neu-flat); border: 1px solid var(--border-color);
    z-index: 10000; overflow: hidden; animation: slideUp 0.3s ease-out;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.theme-option {
    display: flex; align-items: center; padding: 15px 20px; cursor: pointer;
    border-bottom: 1px solid rgba(0,0,0,0.05); color: var(--text-main); font-size: 0.95rem; font-weight: 500;
}
.theme-option:last-child { border-bottom: none; }
.theme-option:hover { background: var(--bg-body); color: var(--primary); box-shadow: var(--neu-pressed); }
.theme-option i { width: 30px; margin-right: 10px; text-align: center; }

/* Color Dots */
.color-options {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 15px;
    background: var(--bg-body); border-top: 1px solid var(--border-color);
}
.color-dot {
    width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
    border: 2px solid var(--border-color); margin: 0 auto;
}
.color-dot:hover { transform: scale(1.1); border-color: var(--text-main); }


/* --- 8. SINGLE BOOK DETAILS & SHARED COMPONENTS --- */

/* The Main Card Container */
.neu-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft); 
    border: 1px solid var(--border-color);
    padding: 40px;
    margin-bottom: 40px;
}

/* Layout Grid for the Book Details */
.book-details-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 50px;
}

/* Left Side: Cover Image */
.book-cover-section {
    flex: 1;
    min-width: 280px;
    max-width: 350px;
}

.book-cover-large {
    width: 100%;
    border-radius: 15px;
    /* Nice shadow for the cover */
    box-shadow: 0 10px 25px rgba(0,0,0,0.1); 
    margin-bottom: 25px;
    display: block;
    object-fit: cover;
}

/* Right Side: Text Info */
.book-info-section {
    flex: 2;
    min-width: 300px;
}

/* Generic Neumorphic Buttons */
.neu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 25px;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-align: center;
    cursor: pointer;
    text-decoration: none;
    font-family: var(--font-main);
    background: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

/* Primary Button Modifier */
.btn-primary {
    background: var(--primary);
    color: #fff;
    border: 1px solid var(--primary);
    box-shadow: 0 4px 15px rgba(141, 110, 99, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(141, 110, 99, 0.4);
    color: #fff;
}

/* Outline Button Modifier */
.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--bg-body);
}

/* Input Fields (Added for Search) */
.neu-input {
    width: 100%;
    padding: 14px 25px;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    background: var(--bg-body);
    color: var(--text-main);
    font-family: var(--font-main);
    /* Neumorphic Pressed Effect */
    box-shadow: var(--neu-pressed);
    outline: none;
    transition: 0.3s ease;
}

.neu-input:focus {
    border-color: var(--primary);
    box-shadow: inset 2px 2px 5px var(--neu-dark), inset -2px -2px 5px var(--neu-light);
}

/* Stats Row (Language | Year | Views) */
.book-meta-grid {
    display: flex;
    align-items: center;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 20px 0;
    margin: 30px 0;
}

.meta-item {
    flex: 1;
    text-align: center;
    position: relative;
}

.meta-item:not(:last-child)::after {
    content: '';
    position: absolute; right: 0; top: 10%;
    height: 80%; width: 1px;
    background: var(--border-color);
}

.meta-value {
    display: block; font-size: 1.4rem; font-weight: 700;
    color: var(--text-main); font-family: var(--font-serif);
}

.meta-label {
    font-size: 0.85rem; color: var(--text-light);
    text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600;
}

.badge {
    display: inline-flex; align-items: center; padding: 6px 14px;
    background: var(--bg-body); border: 1px solid var(--border-color);
    border-radius: 50px; font-size: 0.85rem; color: var(--text-light);
    margin-right: 8px; margin-bottom: 8px; font-weight: 500; transition: 0.2s; text-decoration: none;
}
.badge:hover { border-color: var(--primary); color: var(--primary); }
.badge i { margin-right: 6px; color: var(--primary); }

.license-box {
    background: var(--bg-body); padding: 20px;
    border-radius: 12px; border: 1px solid var(--border-color);
    font-size: 0.95rem; color: var(--text-light);
}
.license-box strong { color: var(--text-main); }

@media (max-width: 768px) {
    .neu-card { padding: 25px 20px; }
    .book-details-wrapper { flex-direction: column; gap: 30px; }
    .book-cover-section { max-width: 100%; }
    .book-meta-grid { margin: 20px 0; }
    .neu-btn { width: 100%; margin-bottom: 10px; }
}