/* ===== ROOT VARIABLES ===== */
:root {
    --primary: #003432;
    --primary-light: #004f52;
    --primary-dark: #0d1f1a;
    --accent: #80003a;
    --accent-light: #aa0a34;
    --highlight: #e3ff70;
    --teal-light: #aaded9;
    --purple-light: #dbc7fe;
    --gold: #a87026;
    --bg-light: #f1f4f6;
    --bg-cream: #f0efe3;
    --text-dark: #21201e;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
    --radius: 8px;
    --radius-lg: 16px;
    --transition: all 0.3s ease;
}

/* ===== GLOBAL ===== */
* { box-sizing: border-box; }

body {
    font-family: 'Satoshi', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-dark);
    background: var(--bg-cream);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Lora', Georgia, serif;
}

main { flex: 1; }

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent); }

/* ===== NAVBAR ===== */
.navbar-lib {
    background: white;
    border-bottom: 3px solid var(--accent);
    padding: 0;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-lib .navbar-brand {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--primary-dark);
    letter-spacing: -0.5px;
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
}

.navbar-lib .navbar-brand img {
    height: 40px;
}

.navbar-lib .navbar-brand span {
    color: var(--accent);
    font-family: 'Satoshi', sans-serif;
}

.navbar-lib .nav-link {
    color: var(--text-dark);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 1rem 1.1rem !important;
    transition: var(--transition);
}

.navbar-lib .nav-link:hover,
.navbar-lib .nav-link.active {
    color: var(--accent);
}

.navbar-lib .nav-actions .btn {
    font-size: 0.9rem;
    font-weight: 500;
}

/* ===== LANGUAGE SWITCHER ===== */
.lang-switcher {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    margin-right: 0.5rem;
}

.lang-switcher .lang-btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
    letter-spacing: 0.5px;
}

.lang-switcher .lang-btn:hover {
    color: var(--primary);
    background: var(--bg-light);
}

.lang-switcher .lang-btn.active {
    background: var(--primary);
    color: white;
}

/* ===== HERO SECTION ===== */
.hero {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    color: white;
    padding: 5rem 0 4rem;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 1rem;
}

.hero p.lead {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto 2rem;
}

.hero-search {
    max-width: 650px;
    margin: 0 auto;
}

.hero-search .input-group {
    background: white;
    border-radius: 50px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

.hero-search input {
    border: none;
    padding: 1rem 1.5rem;
    font-size: 1.05rem;
}

.hero-search input:focus {
    box-shadow: none;
}

.hero-search .btn {
    padding: 0.8rem 2rem;
    font-weight: 600;
    border: none;
    background: var(--accent);
    color: white;
}

.hero-search .btn:hover {
    background: var(--accent-light);
}

/* ===== STATS BAR ===== */
.stats-bar {
    background: white;
    margin-top: -2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    position: relative;
    z-index: 10;
}

.stat-item {
    text-align: center;
    padding: 0.5rem;
}

.stat-number {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.3rem;
}

/* ===== SECTION HEADERS ===== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border);
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: var(--primary-dark);
}

.section-header a {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent);
}

/* ===== BOOK CARDS ===== */
.book-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.book-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.book-card .card-cover {
    position: relative;
    overflow: hidden;
    height: 260px;
    background: var(--bg-light);
}

.book-card .card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

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

.book-card .card-cover-placeholder {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    font-size: 3.5rem;
}

.book-card .card-body {
    padding: 1rem 1.2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.book-card .book-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-card .book-title a {
    color: var(--text-dark);
}

.book-card .book-title a:hover {
    color: var(--accent);
}

.book-card .book-author {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.book-card .card-footer-custom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.book-card .badge-cat {
    background: var(--bg-light);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3em 0.7em;
    border-radius: 4px;
}

.book-card .rating {
    color: var(--gold);
    font-size: 0.85rem;
}

/* ===== CATEGORY CARDS ===== */
.category-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition);
}

.category-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.category-card .cat-icon {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.category-card .cat-name {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.category-card .cat-count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== CATALOG PAGE ===== */
.filter-sidebar {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.filter-sidebar h5 {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.filter-sidebar .form-check-label {
    font-size: 0.9rem;
}

.sort-bar {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.sort-bar .results-count {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ===== BOOK DETAIL ===== */
.detail-page {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.detail-cover-wrap {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    padding: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.detail-cover-wrap img {
    max-height: 380px;
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

.detail-cover-wrap .placeholder-cover {
    width: 250px;
    height: 350px;
    background: rgba(255,255,255,0.1);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.5);
    font-size: 5rem;
}

.detail-info {
    padding: 2.5rem;
}

.detail-info h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 0.5rem;
}

.detail-info .author-name {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.detail-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.detail-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.detail-meta-item i {
    color: var(--primary);
    font-size: 1.1rem;
    width: 20px;
}

.detail-meta-item .label {
    color: var(--text-muted);
}

.detail-actions {
    display: flex;
    gap: 0.75rem;
    margin: 1.5rem 0;
}

.btn-download {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    transition: var(--transition);
}

.btn-download:hover {
    background: var(--accent-light);
    color: white;
}

.btn-favorite {
    background: transparent;
    border: 2px solid var(--border);
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    transition: var(--transition);
    color: var(--text-dark);
}

.btn-favorite:hover,
.btn-favorite.active {
    border-color: var(--accent);
    color: var(--accent);
    background: #fef2f6;
}

/* ===== REVIEWS ===== */
.review-section {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    margin-top: 2rem;
}

.review-item {
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--border);
}

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

.review-item .review-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.review-item .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.review-item .review-stars {
    color: var(--gold);
    font-size: 0.85rem;
}

.review-item .review-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== RATING STARS ===== */
.star-rating {
    display: flex;
    gap: 0.25rem;
    flex-direction: row-reverse;
    justify-content: flex-end;
}

.star-rating input { display: none; }

.star-rating label {
    cursor: pointer;
    font-size: 1.5rem;
    color: #ddd;
    transition: color 0.2s;
}

.star-rating label:hover,
.star-rating label:hover ~ label,
.star-rating input:checked ~ label {
    color: var(--gold);
}

/* ===== PROFILE PAGE ===== */
.profile-header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
    padding: 3rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    border: 3px solid rgba(255,255,255,0.3);
}

/* ===== ABOUT PAGE ===== */
.about-hero {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
    padding: 4rem 0;
    text-align: center;
}

/* ===== FOOTER ===== */
.footer-lib {
    background: var(--primary-dark);
    color: rgba(255,255,255,0.8);
    padding: 3rem 0 1.5rem;
    margin-top: 4rem;
}

.footer-lib h5 {
    color: white;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.footer-lib a {
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
    display: block;
    padding: 0.2rem 0;
    transition: var(--transition);
}

.footer-lib a:hover {
    color: white;
    padding-left: 5px;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 1.5rem;
    margin-top: 2rem;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.5);
}

/* ===== AUTH FORMS ===== */
.auth-card {
    max-width: 440px;
    margin: 3rem auto;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2.5rem;
}

.auth-card h2 {
    font-weight: 800;
    text-align: center;
    margin-bottom: 0.5rem;
}

.auth-card .auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* ===== PAGINATION ===== */
.pagination .page-link {
    border: 1px solid var(--border);
    color: var(--text-dark);
    font-weight: 500;
    padding: 0.5rem 1rem;
    margin: 0 2px;
    border-radius: var(--radius);
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
}

/* ===== UTILITIES ===== */
.btn-primary-lib {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    transition: var(--transition);
}

.btn-primary-lib:hover {
    background: var(--primary-light);
    color: white;
}

.btn-accent {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    transition: var(--transition);
}

.btn-accent:hover {
    background: var(--accent-light);
    color: white;
}

.breadcrumb-item a { color: var(--text-muted); }
.breadcrumb-item.active { color: var(--text-dark); font-weight: 600; }

/* ===== CONTACT STRIP ===== */
.contact-strip {
    background: var(--primary-dark);
    color: rgba(255,255,255,0.8);
    font-size: 0.8rem;
    padding: 0.4rem 0;
}

.contact-strip a {
    color: rgba(255,255,255,0.8);
    font-size: 0.8rem;
    display: inline;
    padding: 0;
    transition: var(--transition);
}

.contact-strip a:hover {
    color: var(--highlight);
    padding-left: 0;
}

.contact-strip i {
    margin-right: 0.3rem;
}

/* ===== HERO ENHANCEMENTS ===== */
.hero::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(170,222,217,0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(128,0,58,0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(227,255,112,0.05) 0%, transparent 60%);
    z-index: 1;
    pointer-events: none;
}

.hero .container {
    position: relative;
    z-index: 3;
}

/* ===== BACK TO TOP ===== */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    z-index: 999;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--accent);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* ===== COLORED CATEGORY CARDS ===== */
.cat-teal { border-top: 3px solid var(--primary); }
.cat-teal .cat-icon { background: rgba(0,52,50,0.08); border-radius: 50%; width: 56px; height: 56px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 0.5rem; color: var(--primary); }

.cat-purple { border-top: 3px solid #7c3aed; }
.cat-purple .cat-icon { background: rgba(124,58,237,0.08); border-radius: 50%; width: 56px; height: 56px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 0.5rem; color: #7c3aed; }

.cat-lime { border-top: 3px solid #65a30d; }
.cat-lime .cat-icon { background: rgba(101,163,13,0.08); border-radius: 50%; width: 56px; height: 56px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 0.5rem; color: #65a30d; }

.cat-gold { border-top: 3px solid var(--gold); }
.cat-gold .cat-icon { background: rgba(168,112,38,0.08); border-radius: 50%; width: 56px; height: 56px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 0.5rem; color: var(--gold); }

.cat-accent { border-top: 3px solid var(--accent); }
.cat-accent .cat-icon { background: rgba(128,0,58,0.08); border-radius: 50%; width: 56px; height: 56px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 0.5rem; color: var(--accent); }

.cat-primary { border-top: 3px solid var(--primary-light); }
.cat-primary .cat-icon { background: rgba(0,79,82,0.08); border-radius: 50%; width: 56px; height: 56px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 0.5rem; color: var(--primary-light); }

/* ===== FOOTER SOCIAL ICONS ===== */
.footer-social a {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    padding: 0;
}

.footer-social a:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-3px);
    padding-left: 0;
}

/* ===== HOVER MICRO-INTERACTIONS ===== */
.btn-primary-lib:hover,
.btn-accent:hover,
.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,52,50,0.25);
}

.book-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--teal-light);
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

/* Nav link animated underline */
.navbar-lib .nav-link {
    position: relative;
}

.navbar-lib .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: var(--accent);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.navbar-lib .nav-link:hover::after,
.navbar-lib .nav-link.active::after {
    width: 100%;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .hero h1 { font-size: 2rem; }
    .hero { padding: 3rem 0 2.5rem; }
    .stats-bar { margin-top: -1rem; }
    .stat-number { font-size: 1.5rem; }
    .detail-meta { grid-template-columns: 1fr; }
    .detail-actions { flex-direction: column; }
    .detail-cover-wrap { min-height: 280px; padding: 1.5rem; }
    .contact-strip .container { flex-direction: column; align-items: center; gap: 0.3rem; text-align: center; }
    .contact-strip .d-flex.gap-4 { gap: 1rem !important; flex-wrap: wrap; justify-content: center; }
}
