/* ===== VARIABLES ===== */
:root {
    --primary-color: #8B4513;
    --primary-hover: #6B3410;
    --secondary-color: #D4AF37;
    --accent-color: #E8D5B7;
    --text-dark: #1a1a1a;
    --text-muted: #6b7280;
    --bg-white: #ffffff;
    --bg-off-white: #f9fafb;
    --bg-light-gray: #f3f4f6;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

[data-theme="dark"] {
    --primary-color: #A0713D;
    --primary-hover: #8B4513;
    --secondary-color: #F0C75E;
    --accent-color: #4A4A4A;
    --text-dark: #e5e5e5;
    --text-muted: #9ca3af;
    --bg-white: #1e1e1e;
    --bg-off-white: #121212;
    --bg-light-gray: #2a2a2a;
    --border-color: #3a3a3a;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.7);
}

/* ===== GLOBAL STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background-color: var(--bg-off-white);
    color: var(--text-dark);
    line-height: 1.6;
    scroll-behavior: smooth;
}

html {
    scroll-behavior: smooth;
}

/* ===== NAVBAR ===== */
.navbar {
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%) !important;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    transition: transform 0.2s ease;
    font-family: 'Georgia', serif;
    letter-spacing: 1px;
}

.navbar-brand:hover {
    transform: scale(1.05);
}

.nav-link {
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-link:hover {
    transform: translateY(-2px);
}

/* Dark Mode Toggle */
#darkModeToggle {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
}

#darkModeToggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

/* ===== HERO SECTION ===== */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    position: relative;
    overflow: hidden;
    min-height: 70vh;
    display: flex;
    align-items: center;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(212, 175, 55, 0.15) 0%, transparent 50%);
    pointer-events: none;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.hero-section .container {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 4rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    animation: fadeInUp 1s ease;
}

.hero-subtitle {
    font-size: 1.5rem;
    opacity: 0.95;
    animation: fadeInUp 1.2s ease;
}

.hero-cta {
    animation: fadeInUp 1.4s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Glassmorphism Card */
.glass-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .glass-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.card-body {
    padding: 1.5rem;
}

/* Book cards */
.book-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

.book-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.book-card:hover::before {
    transform: scaleX(1);
}

.book-card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.book-card .card-title {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.book-card .card-text {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Featured Book Card */
.featured-book {
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.1) 0%, rgba(212, 175, 55, 0.1) 100%);
    border: 2px solid var(--secondary-color);
}

.featured-badge {
    background: var(--secondary-color);
    color: var(--text-dark);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    position: absolute;
    top: 10px;
    right: 10px;
}

/* ===== QUOTE CARDS ===== */
.quote-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    margin-bottom: 1rem;
    animation: slideIn 0.3s ease;
}

.quote-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

.quote-card .quote-text {
    font-size: 1.05rem;
    color: var(--text-dark);
    font-style: italic;
    line-height: 1.7;
    margin-bottom: 0.75rem;
    font-family: 'Georgia', serif;
}

.quote-card .quote-author {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ===== DISCUSSION CARDS ===== */
.discussion-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--text-muted);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
    animation: slideIn 0.3s ease;
}

.discussion-card:hover {
    box-shadow: var(--shadow-md);
    border-left-color: var(--primary-color);
}

.discussion-content {
    font-size: 1rem;
    color: var(--text-dark);
    line-height: 1.7;
    margin-bottom: 0.75rem;
}

.discussion-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.reply-card {
    background: var(--bg-light-gray);
    border: 1px solid var(--border-color);
    border-left: 2px solid #d1d5db;
    border-radius: var(--radius-sm);
    margin-left: 2.5rem;
    margin-top: 0.75rem;
    padding: 0.75rem;
    transition: all 0.2s ease;
    animation: slideIn 0.3s ease;
}

.reply-card:hover {
    background: var(--border-color);
    border-left-color: var(--primary-color);
}

/* Vote buttons */
.vote-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    min-width: 50px;
    padding-right: 1rem;
}

.vote-btn {
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s ease;
    font-size: 1.5rem;
}

.vote-btn:hover {
    color: var(--primary-color);
    transform: scale(1.15);
}

.vote-btn.active {
    color: var(--primary-color);
}

.vote-score {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-dark);
}

.like-btn {
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s ease;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.like-btn:hover {
    color: #dc3545;
    transform: scale(1.1);
}

.like-btn.liked {
    color: #dc3545;
}

/* ===== FORMS ===== */
.form-control, .form-select {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.625rem 0.875rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    background-color: var(--bg-white);
    color: var(--text-dark);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
    outline: none;
}

.form-label {
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* ===== BUTTONS ===== */
.btn {
    border-radius: var(--radius-sm);
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--text-dark);
}

.btn-secondary:hover {
    background-color: #C4A037;
    transform: translateY(-1px);
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: white;
}

/* ===== SEARCH & FILTER ===== */
.search-bar {
    position: relative;
}

.search-bar input {
    padding-left: 2.5rem;
}

.search-bar .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.filter-chip {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    background: var(--bg-light-gray);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-chip:hover, .filter-chip.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ===== RATING STARS ===== */
.rating-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.rating-stars {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
}

.rating-star {
    cursor: pointer;
    font-size: 2rem;
    color: #d1d5db;
    transition: all 0.2s ease;
}

.rating-star:hover,
.rating-star.active {
    color: var(--secondary-color);
    transform: scale(1.15);
}

.rating-display {
    text-align: center;
}

.rating-number {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.rating-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ===== BADGES ===== */
.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge.bg-primary {
    background-color: var(--primary-color) !important;
}

.badge.bg-secondary {
    background-color: var(--secondary-color) !important;
    color: var(--text-dark) !important;
}

/* ===== ALERTS ===== */
.alert {
    border-radius: var(--radius-sm);
    border: 1px solid;
    animation: slideIn 0.3s ease;
}

/* ===== ANIMATIONS ===== */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

/* ===== SECTION DIVIDERS ===== */
.section-title {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.section-title i {
    color: var(--primary-color);
    margin-right: 0.5rem;
}

/* ===== FOOTER ===== */
footer {
    margin-top: 4rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-white);
}

/* ===== SCROLL TO TOP ===== */
#scrollTopBtn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

#scrollTopBtn.visible {
    opacity: 1;
    visibility: visible;
}

#scrollTopBtn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 25px rgba(139, 69, 19, 0.4);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.2rem;
    }
    
    .reply-card {
        margin-left: 1rem;
    }
    
    .rating-star {
        font-size: 1.5rem;
    }
    
    .rating-number {
        font-size: 2rem;
    }
}

/* ===== LOADING SPINNER ===== */
.spinner-border {
    border-color: var(--primary-color);
    border-right-color: transparent;
}

/* ===== PROFANITY FILTER NOTICE ===== */
.moderation-notice {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

[data-theme="dark"] .moderation-notice {
    background: #4a3f1a;
    border-color: #6b5a1a;
    color: #f0c75e;
}


/* ===== TOAST NOTIFICATIONS ===== */
.toast {
    min-width: 300px;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
}

.toast.bg-success {
    background-color: #10b981 !important;
    color: white;
}

.toast.bg-danger {
    background-color: #ef4444 !important;
    color: white;
}

.toast.bg-warning {
    background-color: #f59e0b !important;
    color: white;
}

.toast.bg-info {
    background-color: #3b82f6 !important;
    color: white;
}

.toast .btn-close {
    filter: brightness(0) invert(1);
}

.toast-body {
    padding: 1rem;
    font-weight: 500;
}

/* ===== CHATBOT WIDGET ===== */
.chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Chat Toggle Button */
.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.chatbot-toggle:active {
    transform: scale(0.95);
}

.chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--secondary-color);
    color: var(--text-dark);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    border: 2px solid white;
}

/* Chat Window */
.chatbot-window {
    width: 380px;
    height: 600px;
    background: var(--bg-white);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat Header */
.chatbot-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chatbot-header-content i {
    font-size: 1.5rem;
}

.chatbot-header-content h5 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.chatbot-header-content small {
    font-size: 0.75rem;
    opacity: 0.9;
}

.chatbot-header-actions {
    display: flex;
    gap: 0.5rem;
}

.chatbot-action-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chatbot-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Messages Container */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: var(--bg-off-white);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Message Bubbles */
.chatbot-message {
    display: flex;
    gap: 0.75rem;
    animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.message-content {
    flex: 1;
    background: var(--bg-white);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.message-content p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-dark);
}

.message-content ul {
    margin: 0.5rem 0;
    padding-left: 1.25rem;
}

.message-content li {
    font-size: 0.9rem;
    color: var(--text-dark);
}

.message-content strong {
    font-weight: 600;
    color: var(--primary-color);
}

.user-message {
    flex-direction: row-reverse;
}

.user-message .message-content {
    background: var(--primary-color);
    color: white;
}

.user-message .message-content p {
    color: white;
}

.error-message .message-content {
    background: #fee;
    border-left: 3px solid #dc3545;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 0.5rem 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}



/* Input Container */
.chatbot-input-container {
    padding: 1rem;
    background: var(--bg-white);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.chatbot-input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem;
    font-size: 0.9rem;
    resize: none;
    max-height: 120px;
    overflow-y: auto;
    font-family: inherit;
    background: var(--bg-white);
    color: var(--text-dark);
}

.chatbot-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
}

.chatbot-input::-webkit-scrollbar {
    width: 4px;
}

.chatbot-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chatbot-send-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.chatbot-send-btn:active {
    transform: scale(0.95);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .chatbot-window {
        width: 100vw;
        height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    
    .chatbot-toggle {
        bottom: 15px;
        right: 15px;
    }
}

/* Dark Mode Support */
[data-theme="dark"] .chatbot-window {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .message-content {
    background: var(--bg-light-gray);
}

[data-theme="dark"] .user-message .message-content {
    background: var(--primary-color);
}

[data-theme="dark"] .quick-action-btn {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

[data-theme="dark"] .chatbot-input {
    background: var(--bg-light-gray);
    border-color: var(--accent-color);
}