/* style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-color: #fffbeb; 
    --text-color: #292524; 
    --primary: #d97706; 
    --primary-hover: #b45309; 
    --secondary: #fef3c7; 
    --accent-sale: #059669; 
    --accent-rent: #ea580c; 
    --accent-exchange: #7c3aed; 
    --accent-loan: #db2777; 
    --accent-gift: #0ea5e9;
    --glass-bg: rgba(255, 255, 255, 0.85); 
    --glass-border: rgba(0, 0, 0, 0.05); 
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* Rimuove il flash blu su iOS Safari */
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(to right, #d97706, #ea580c, #db2777);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

/* Map Animations */
.map-pin {
    position: absolute;
    font-size: 1.5rem;
    animation: bounce 2s infinite;
    cursor: pointer;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    transition: transform 0.2s;
}
.map-pin:hover {
    transform: scale(1.3);
    animation: none;
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}


/* Bookshelf Visuals */
.shelf-container {
    position: relative;
    width: 100%;
    margin: 2rem 0;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}
.shelf-books {
    display: flex;
    align-items: flex-end;
    gap: 5px;
    padding: 0 10px;
    z-index: 2;
    height: 120px;
}
.shelf-board {
    width: 100%;
    height: 20px;
    background: linear-gradient(to bottom, #d97706, #78350f);
    border-radius: 3px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.3);
    z-index: 1;
}
.spine-book {
    width: 40px;
    height: 110px;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 2px 0 5px rgba(255,255,255,0.2), inset -2px 0 5px rgba(0,0,0,0.3), 2px 0 4px rgba(0,0,0,0.4);
    transition: transform 0.2s;
    position: relative;
    overflow: hidden;
}
.spine-book:hover {
    transform: translateY(-10px);
}
.spine-title {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    transform: rotate(180deg);
}
.chara {
    position: absolute;
    bottom: 20px;
    left: -50px;
    font-size: 3rem;
    z-index: 3;
    transition: left 1s ease-in-out, opacity 0.5s;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    opacity: 0.8;
    transition: all 0.3s ease;
    padding: 0.5rem 0;
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.nav-icon {
    font-size: 1.25rem;
    display: inline-block;
}

.nav-badge {
    position: absolute;
    top: -5px;
    right: -8px;
    width: 12px;
    height: 12px;
    background: #ef4444; /* red */
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 10;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
}

.nav-links a:hover {
    opacity: 1;
    color: var(--primary);
}

.nav-links a.active::after {
    width: 100%;
}

.nav-links a.active {
    opacity: 1;
    color: var(--primary);
}

/* Main Content */
main {
    flex: 1;
    padding: 3rem 5%;
    display: flex;
    flex-direction: column;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 5rem 1rem;
    background: radial-gradient(circle at center, rgba(217, 119, 6, 0.1), transparent 60%);
    border-radius: 1rem;
    margin-bottom: 3rem;
    animation: fadeIn 1s ease-out;
}

.hero h1 {
    font-size: 4rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #44403c, #78716c);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.1;
}

.hero p {
    font-size: 1.25rem;
    color: #57534e;
    max-width: 600px;
    margin: 0 auto 2.5rem;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Utilities */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    color: white;
}

.btn:active {
    transform: scale(0.95);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
}

.btn-primary:hover {
    box-shadow: 0 10px 15px -3px rgba(217, 119, 6, 0.4), 0 4px 6px -2px rgba(217, 119, 6, 0.2);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
}

.btn-success:hover {
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.4);
    transform: translateY(-2px);
}

/* Filters */
.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}

.filters .btn {
    background: #f3f4f6;
    color: #44403c;
    border: 1px solid #e7e5e4;
    box-shadow: none;
}

.filters .btn:hover {
    background: #e7e5e4;
}

.filters .btn.active {
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.filters .btn-primary.active { background: linear-gradient(135deg, var(--primary), var(--primary-hover)); border-color: transparent; }
.filters .btn-sale.active { background: var(--accent-sale); border-color: transparent; }
.filters .btn-exchange.active { background: var(--accent-exchange); border-color: transparent; }
.filters .btn-rent.active { background: var(--accent-rent); border-color: transparent; }
.filters .btn-loan.active { background: var(--accent-loan); border-color: transparent; }
.filters .btn-gift.active { background: var(--accent-gift); border-color: transparent; }


/* Books Grid */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

/* Book Card */
.book-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 380px;
    background-color: #292524;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

.book-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
    z-index: 10;
}

.book-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
    border-color: rgba(0,0,0,0.1);
}

.book-card:hover::before {
    transform: scaleX(1);
}

.book-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: #fff;
    font-weight: 700;
    z-index: 5;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.book-card .author {
    color: #fca5a5;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    flex-grow: 1;
    z-index: 5;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.badge {
    align-self: flex-start;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 5;
}

.book-card .owner {
    font-size: 0.85rem;
    color: #d6d3d1;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.2);
    z-index: 5;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.book-card.badge-sale::before { background: var(--accent-sale); }
.book-card.badge-exchange::before { background: var(--accent-exchange); }
.book-card.badge-rent::before { background: var(--accent-rent); }
.book-card.badge-loan::before { background: var(--accent-loan); }

/* Form */
.form-container {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 2rem;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #44403c;
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #fff;
    border: 1px solid #d6d3d1;
    border-radius: 0.5rem;
    color: var(--text-color);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.2);
    background: #fff;
}

.form-control::placeholder {
    color: #a8a29e;
}

/* Chat Styles */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 60vh;
    min-height: 400px;
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    overflow: hidden;
}
.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #fdfbf7;
}
.chat-bubble {
    max-width: 75%;
    padding: 0.8rem 1.2rem;
    border-radius: 1.2rem;
    font-size: 0.95rem;
    position: relative;
    animation: fadeIn 0.2s ease-out;
}
.chat-bubble.received {
    align-self: flex-start;
    background: #f5f5f4; 
    color: #292524;
    border-bottom-left-radius: 0.2rem;
}
.chat-bubble.sent {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    border-bottom-right-radius: 0.2rem;
}
.chat-input {
    display: flex;
    padding: 1rem;
    background: #fff;
    border-top: 1px solid #e7e5e4;
    gap: 0.5rem;
}
.chat-input input {
    flex: 1;
    padding: 0.8rem 1.5rem;
    border: 1px solid #d6d3d1;
    border-radius: 999px;
    outline: none;
    font-family: inherit;
    font-size: 1rem;
}
.chat-input button {
    border-radius: 50%;
    width: 45px;
    height: 45px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
}

.translation-bubble {
    margin-top: 0.8rem;
    padding: 0.8rem;
    background: rgba(217, 119, 6, 0.05);
    border-left: 3px solid var(--primary);
    border-radius: 0.5rem;
    font-size: 0.95rem;
    color: #44403c;
    animation: fadeIn 0.3s ease-out;
}

.bot-tag {
    font-size: 0.65rem;
    font-weight: 800;
    background: var(--primary);
    color: white;
    padding: 1px 4px;
    border-radius: 4px;
    vertical-align: middle;
    margin-right: 5px;
}

.translation-toggle-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: #78716c;
    cursor: pointer;
    background: #f8fafc;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    width: fit-content;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}

.translation-toggle-container:hover {
    background: #f1f5f9;
    border-color: var(--primary);
}

.chat-list-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #fff;
    border-radius: 1rem;
    margin-bottom: 1rem;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--glass-border);
}
.chat-list-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.05);
}
.chat-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-right: 1rem;
    flex-shrink: 0;
}

/* Map Container Styles */
#map-container {
    width: 100%;
    height: 400px;
    border-radius: 1rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border: 1px solid var(--glass-border);
    z-index: 10;
}

.leaflet-popup-content-wrapper {
    border-radius: 0.5rem;
}

.leaflet-popup-content {
    margin: 10px;
    line-height: 1.4;
    text-align: center;
}

.custom-map-popup img {
    margin-bottom: 5px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    width: 80px; 
    height: 120px;
    object-fit: cover;
}
.custom-map-popup h4 {
    margin: 5px 0;
    font-size: 1rem;
    color: var(--text-color);
    font-weight: bold;
}
.custom-map-popup button {
    margin-top: 5px;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    width: 100%;
}


/* Onboarding Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(41, 37, 36, 0.85); /* quasi nero semi-trasparente */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Start from top to allow scrolling */
    overflow-y: auto; /* Enable scrolling for tall content */
    padding: 2rem 1rem;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.4s ease, visibility 0.4s;
}

.modal-overlay.hidden, .hidden {
    display: none !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal-content {
    background: var(--bg-color);
    padding: 3rem;
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    max-width: 500px;
    width: 90%;
    text-align: center;
    transform: translateY(0) scale(1);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid var(--glass-border);
}

.modal-overlay.hidden .modal-content {
    transform: translateY(30px) scale(0.95);
}

/* Navbar Actions (Register, Languages) */
.navbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.language-switcher {
    position: fixed;
    bottom: 2rem;
    left: 1.5rem;
    display: flex;
    flex-direction: column-reverse;
    gap: 0.5rem;
    z-index: 4000;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(217, 119, 6, 0.2);
    border-radius: 14px;
    padding: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.language-switcher:hover {
    height: 148px; /* Adjusted for 3 languages: (38*3) + (2*gap) + (2*padding) = 114 + 10 + 8 = 132... let's give it some air */
}

.lang-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    background: transparent;
    color: #78716c;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.lang-btn:hover {
    background: rgba(217, 119, 6, 0.1);
    color: var(--primary);
}

.lang-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    order: -1; /* Bottom position in column-reverse */
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.2);
}

/* Hide inactive buttons when not hovered */
.language-switcher:not(:hover) .lang-btn:not(.active) {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

/* Tooltip style indicator on hover */
.language-switcher::after {
    content: '▲';
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6rem;
    color: var(--primary);
    opacity: 0;
    transition: opacity 0.3s;
}

.language-switcher:hover::after {
    opacity: 0; /* Hide when expanded */
}

.language-switcher:not(:hover)::after {
    opacity: 0.5;
    top: 2px;
}


/* ==============================================================
   MOBILE APP RESPONSIVENESS
   ============================================================== */
@media screen and (max-width: 768px) {
    body {
        padding-bottom: 2rem;
        background-color: #f8fafc;
    }

    /* ── TOP NAVBAR ── */
    .navbar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        padding: 0.6rem 1rem !important;
        background: #ffffff !important;
        border-bottom: 1px solid rgba(217, 119, 6, 0.2) !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
        z-index: 9999 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 0.5rem !important;
        min-height: 56px !important;
    }

    /* Logo: shrink it a bit */
    .navbar .logo {
        font-size: 1rem;
        gap: 0.35rem;
        flex-shrink: 0;
    }

    .navbar .logo img {
        width: 28px !important;
        height: 28px !important;
    }

    /* Nav links: horizontal inside the navbar, icon-only */
    .nav-links {
        position: static !important;
        display: flex !important;
        flex-direction: row !important;
        gap: 0 !important;
        background: none !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        width: auto !important;
        flex: 1;
        justify-content: center;
    }

    .nav-links li { display: inline-flex; }

    .nav-links a {
        flex-direction: column;
        align-items: center;
        gap: 0;
        padding: 0.35rem 0.6rem;
        color: #78716c;
        font-size: 0.6rem;
        border-radius: 0.75rem;
        transition: all 0.2s ease;
    }

    .nav-links a.active {
        color: var(--primary);
        background: rgba(217, 119, 6, 0.1);
        transform: none;
    }

    .nav-links a::after { display: none !important; }

    .nav-icon {
        display: block;
        font-size: 1.2rem;
        line-height: 1;
    }

    .nav-text {
        font-size: 0.55rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        margin-top: 1px;
    }

    /* Register button: compact */
    .navbar-actions {
        flex-shrink: 0;
    }

    .navbar .btn {
        font-size: 0.75rem !important;
        padding: 0.35rem 0.75rem !important;
        font-weight: 700;
        white-space: nowrap;
    }

    /* ── MAIN CONTENT ── */
    main {
        padding: 5rem 1rem 2rem 1rem; /* 5rem clears the fixed navbar */
    }

    .hero {
        padding: 2.5rem 1rem;
        margin: 0 -1rem 1.5rem -1rem;
        border-radius: 0;
        background: linear-gradient(160deg, rgba(217, 119, 6, 0.08) 0%, transparent 60%);
    }

    .hero h1 { font-size: 1.9rem; letter-spacing: -0.02em; }
    .hero p { font-size: 1rem; }
    h1[style] { font-size: 1.8rem !important; }
    h2[style] { font-size: 1.4rem !important; }

    /* ── FILTERS ── */
    .filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        margin-bottom: 1.5rem;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .filters::-webkit-scrollbar { display: none; }
    .filters .btn {
        flex: 0 0 auto;
        white-space: nowrap;
        font-size: 0.82rem;
        padding: 0.5rem 0.9rem;
    }

    /* ── BOOK CARDS ── */
    .books-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        padding-bottom: 2rem;
    }

    .book-card {
        border-radius: 1.25rem;
        padding: 1.25rem;
        background: white;
        border: 1px solid rgba(0,0,0,0.05);
        box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    }

    .book-card h3 { font-size: 1.05rem; }
    .book-card .author { font-size: 0.85rem; }
    .badge { font-size: 0.75rem; }
    .book-card .owner { font-size: 0.75rem; }

    /* ── FORMS ── */
    .form-container {
        padding: 1.75rem 1.25rem;
        border-radius: 1.25rem;
    }

    /* ── MODALS ── */
    .modal-overlay {
        align-items: flex-start;
        padding: 4.5rem 0.75rem 1rem 0.75rem;
        background: rgba(0, 0, 0, 0.6);
        z-index: 99999 !important;
    }

    .modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 85vh;
        border-radius: 1.75rem;
        padding: 2.5rem 1.5rem 2rem 1.5rem;
        margin: 0 auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        box-shadow: 0 20px 40px rgba(0,0,0,0.3);
        background: white;
        border: none;
    }

    .modal-content > button[aria-label="Chiudi"] {
        position: absolute !important;
        top: 1rem !important;
        right: 1rem !important;
        width: 36px !important;
        height: 36px !important;
        font-size: 1.2rem !important;
        background: #ef4444 !important;
        color: white !important;
        border: none !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        z-index: 10 !important;
    }

    /* ── LANGUAGE SWITCHER ── */
    .language-switcher {
        position: fixed;
        bottom: 1rem;
        left: 50%;
        transform: translateX(-50%);
        top: auto;
        right: auto;
        z-index: 5000;
        padding: 0.3rem;
        border-radius: 1rem;
        background: rgba(255,255,255,0.97);
        box-shadow: 0 4px 15px rgba(0,0,0,0.12);
    }

    /* ── CHAT ── */
    .chat-container { height: 65vh; border-radius: 1rem; }
}


/* Photo Upload Preview Styles */
.photo-preview-container {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding: 1rem 0;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    min-height: 200px;
    align-items: flex-start;
    flex-wrap: wrap;
}
.photo-preview-container::-webkit-scrollbar {
    display: none;
}
.photo-preview-item {
    position: relative;
    flex: 0 0 100px;
    height: 100px;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    border: 3px solid white;
    transition: all 0.3s ease;
}
.photo-preview-item:hover {
    transform: scale(1.02);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}
.photo-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.photo-preview-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(239, 68, 68, 0.95);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 10;
}
.photo-add-button {
    flex: 0 0 100px;
    height: 100px;
    border: 2px dashed #cbd5e1;
    border-radius: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}
.photo-add-button:hover {
    border-color: var(--primary);
    background: var(--secondary);
}

/* Quick Replies */
.quick-replies-container {
    display: flex;
    gap: 0.8rem;
    padding: 1rem 1.5rem;
    overflow-x: auto;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--glass-border);
    white-space: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.quick-replies-container::-webkit-scrollbar { display: none; }
.quick-reply-chip {
    padding: 0.6rem 1.2rem;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
}
.quick-reply-chip:hover, .quick-reply-chip:active {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    border-color: var(--primary);
    color: #d97706;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(217, 119, 6, 0.15);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive Overrides */
@media screen and (max-width: 480px) {
    .books-grid {
        grid-template-columns: 1fr;
    }
}

/* Footer Legal Section */
.footer {
    background: #ffffff;
    border-top: 1px solid var(--glass-border);
    padding: 1.5rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: auto;
    font-size: 0.85rem;
    color: #78716c;
    z-index: 50;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: #78716c;
    text-decoration: none;
    transition: color 0.2s;
    cursor: pointer;
}

.footer-links a:hover {
    color: var(--primary);
}

/* Cookie Banner */
#cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    box-shadow: 0 -10px 25px rgba(0,0,0,0.1);
    padding: 1.5rem 5%;
    z-index: 5000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    border-top: 3px solid var(--primary);
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

#cookie-banner p {
    flex: 1;
    min-width: 280px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #44403c;
}

/* Onboarding Checkbox Styling */
.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    text-align: left;
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: #57534e;
    line-height: 1.4;
}

.checkbox-group input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    margin-top: 0.1rem;
    cursor: pointer;
}

.checkbox-group label {
    cursor: pointer;
}

.checkbox-group a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}


/* Translator Bot Styles */
.translation-toggle-container {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem 1rem;
    background: rgba(217, 119, 6, 0.1);
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid rgba(217, 119, 6, 0.2);
    margin-bottom: 1rem;
    width: fit-content;
}

.translation-toggle-container:hover {
    background: rgba(217, 119, 6, 0.15);
}

.translation-bubble {
    font-size: 0.9rem;
    color: #475569;
    padding-top: 0.5rem;
    margin-top: 0.5rem;
    border-top: 1px dashed rgba(0,0,0,0.1);
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.bot-tag {
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 0.05em;
}

/* User Location Marker Styling */
.user-location-wrapper {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-location-dot {
    width: 14px;
    height: 14px;
    background: #3b82f6; /* Blue 500 */
    border: 2px solid white;
    border-radius: 50%;
    z-index: 2;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.user-location-accuracy {
    position: absolute;
    width: 14px;
    height: 14px;
    background: rgba(59, 130, 246, 0.3);
    border-radius: 50%;
    z-index: 1;
    animation: location-pulse 2s infinite ease-out;
}

@keyframes location-pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}
/* QR Code Share Button */
.btn-share {
    background: var(--secondary);
    color: var(--text-color);
    border: 1px solid rgba(0,0,0,0.05);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-share:hover {
    background: #fde68a;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.qr-image {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
}
