:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-radius: 0.5rem;
    --transition: all 0.3s ease;
}

html,
body {
    scroll-behavior: smooth;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #ffffff;
    color: #333;
    line-height: 1.6;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    color: #000;
}

a {
    color: var(--primary-color);
    transition: var(--transition);
}

a:hover {
    color: #0056b3;
    text-decoration: none;
}

/* Navigation Bar */
.navbar {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff !important;
}

.navbar-brand i {
    margin-right: 0.5rem;
}

.nav-link {
    transition: var(--transition);
    margin: 0 0.5rem;
}

.nav-link:hover {
    color: var(--warning-color) !important;
}

/* Hero Banner */
.hero-banner {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    padding: 80px 0;
    text-align: center;
}

.hero-banner h1 {
    color: white;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.hero-banner p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.2rem;
}

/* Cards */
.card {
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
    border-radius: var(--border-radius);
}

.card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-4px);
}

.book-card {
    height: 100%;
    overflow: hidden;
}

.book-card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.book-cover {
    height: 250px;
    object-fit: cover;
    transition: var(--transition);
}

.book-card:hover .book-cover {
    transform: scale(1.05);
}

.book-detail-cover {
    height: auto;
    max-height: 500px;
    object-fit: cover;
}

/* Buttons */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.btn-outline-secondary:hover {
    transform: translateY(-2px);
}

/* Forms */
.form-control,
.form-select {
    border-radius: var(--border-radius);
    border: 1px solid #e0e0e0;
    transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-label {
    font-weight: 500;
    color: #333;
    margin-bottom: 0.5rem;
}

.invalid-feedback {
    display: block;
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Auth Section */
.auth-section {
    min-height: calc(100vh - 300px);
    display: flex;
    align-items: center;
}

/* Star Rating */
.star-rating {
    font-size: 2rem;
    cursor: pointer;
    display: flex;
    gap: 0.5rem;
}

.star-rating .star {
    color: #ddd;
    transition: var(--transition);
    cursor: pointer;
}

.star-rating .star:hover,
.star-rating .star.hover {
    color: var(--warning-color);
    transform: scale(1.2);
}

.star-rating .star.active {
    color: var(--warning-color);
}

/* Badges */
.badge {
    padding: 0.5rem 0.75rem;
    font-weight: 500;
}

/* CTA Section */
.cta-section {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border-radius: var(--border-radius);
    text-align: center;
}

.cta-section h2 {
    color: white;
}

.cta-section p {
    color: rgba(255, 255, 255, 0.9);
}

/* Footer */
footer {
    margin-top: auto;
}

footer a {
    text-decoration: none;
    transition: var(--transition);
}

footer a:hover {
    color: white !important;
}

footer h5 {
    color: white;
    margin-bottom: 1rem;
}

/* Alerts */
.alert {
    border-radius: var(--border-radius);
    border: none;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
}

/* Search Bar */
#navSearchInput {
    border-radius: var(--border-radius);
}

#navSearchInput:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Profile Avatar */
.profile-avatar {
    padding: 20px;
    background-color: var(--light-color);
    border-radius: 50%;
    display: inline-block;
}

/* Utility Classes */
.text-white-50 {
    color: rgba(255, 255, 255, 0.5);
}

.text-white-50:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* Responsive Images */
.img-fluid {
    max-width: 100%;
    height: auto;
}

/* Shadows */
.shadow-sm {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
}

.shadow-lg {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.10);
}

/* Container Padding */
.container {
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Modal Customization */
.modal-content {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    border-bottom: 1px solid #e0e0e0;
    background-color: var(--light-color);
}

.modal-title {
    font-weight: 600;
    color: #333;
}

/* Tabs */
.nav-tabs {
    border-bottom: 2px solid #e0e0e0;
}

.nav-tabs .nav-link {
    color: #666;
    border: none;
    border-bottom: 3px solid transparent;
    transition: var(--transition);
    padding-bottom: 0.5rem;
}

.nav-tabs .nav-link:hover {
    color: var(--primary-color);
    border-color: transparent;
}

.nav-tabs .nav-link.active {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background-color: transparent;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-banner {
        padding: 50px 0;
    }

    .hero-banner h1 {
        font-size: 2rem;
    }

    .book-cover {
        height: 200px;
    }

    .card {
        margin-bottom: 1rem;
    }

    .navbar-brand {
        font-size: 1.2rem;
    }

    .profile-avatar {
        margin-bottom: 1rem;
    }

    .d-flex.ms-3 {
        margin-left: 0 !important;
        margin-top: 1rem;
        width: 100%;
    }

    #navSearchInput {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .star-rating {
        font-size: 1.5rem;
    }

    h1 {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 576px) {
    .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .card-body {
        padding: 1rem;
    }

    .btn-lg {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .display-4 {
        font-size: 2rem;
    }

    .lead {
        font-size: 1rem;
    }

    .book-cover {
        height: 150px;
    }

    .star-rating {
        font-size: 1.2rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.3s ease;
}

/* Hover Effects */
.book-card {
    position: relative;
    overflow: hidden;
}

.book-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.1);
    transition: left 0.3s ease;
    z-index: -1;
}

.book-card:hover::before {
    left: 0;
}

/* Text Selection */
::selection {
    background-color: var(--primary-color);
    color: white;
}

/* Scrollbar */
html {
    scroll-padding-top: 70px;
}

/* Loading State */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Border Customization */
.border-primary {
    border-color: var(--primary-color) !important;
    border-width: 2px !important;
}

/* Color Utilities */
.text-primary {
    color: var(--primary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.text-success {
    color: var(--success-color) !important;
}

.bg-success {
    background-color: var(--success-color) !important;
}

.text-warning {
    color: var(--warning-color) !important;
}

.bg-warning {
    background-color: var(--warning-color) !important;
}

.text-danger {
    color: var(--danger-color) !important;
}

.bg-danger {
    background-color: var(--danger-color) !important;
}

/* Divider */
hr {
    opacity: 0.1;
}

/* Link Customization */
.text-white-50 {
    color: rgba(255, 255, 255, 0.5) !important;
}

/* Transition Classes */
.transition {
    transition: var(--transition);
}

/* Focus Visible */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print Styles */
@media print {

    .navbar,
    footer,
    #chatbot-widget {
        display: none;
    }

    body {
        background-color: white;
    }

    .card {
        box-shadow: none;
        border: 1px solid #999;
    }
}

/* ========================================
   BookBot Chatbot Widget
   ======================================== */

/* Floating Toggle Button */
.chatbot-toggle {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 123, 255, 0.45);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(0, 123, 255, 0.55);
}

.chatbot-toggle:active {
    transform: scale(0.95);
}

.chatbot-toggle-icon,
.chatbot-toggle-close {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Pulse Animation */
.chatbot-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(0, 123, 255, 0.4);
    animation: chatbot-pulse-ring 2s ease-out infinite;
    pointer-events: none;
}

@keyframes chatbot-pulse-ring {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }

    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

/* Chat Window */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 28px;
    width: 380px;
    height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.04);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.chatbot-window-open {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Header */
.chatbot-header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: white;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    backdrop-filter: blur(8px);
}

.chatbot-header-text {
    display: flex;
    flex-direction: column;
}

.chatbot-title {
    margin: 0;
    color: white;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.chatbot-status {
    font-size: 0.75rem;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 5px;
}

.chatbot-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
    animation: chatbot-dot-pulse 2s ease-in-out infinite;
}

@keyframes chatbot-dot-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.chatbot-close-btn {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: background 0.2s ease;
}

.chatbot-close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 14px;
    background: #f8f9fb;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chatbot-messages::-webkit-scrollbar {
    width: 5px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #c4c9d4;
    border-radius: 10px;
}

/* Message Styles */
.chatbot-msg {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    animation: chatbot-msg-in 0.3s ease;
}

@keyframes chatbot-msg-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-msg-user {
    justify-content: flex-end;
}

.chatbot-msg-bot {
    justify-content: flex-start;
}

.chatbot-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a1a2e, #0f3460);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.chatbot-msg-bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.88rem;
    line-height: 1.55;
    word-break: break-word;
}

.chatbot-msg-bubble-user {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border-bottom-right-radius: 4px;
}

.chatbot-msg-bubble-bot {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.chatbot-msg-bubble-bot strong {
    color: #0056b3;
}

.chatbot-bullet {
    color: #007bff;
    font-weight: bold;
    margin-right: 2px;
}

/* Typing Indicator */
.chatbot-typing-bubble {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 18px;
}

.chatbot-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #a0aec0;
    animation: chatbot-typing-bounce 1.4s ease-in-out infinite;
}

.chatbot-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.chatbot-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes chatbot-typing-bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-6px);
    }
}

/* Quick Actions */
.chatbot-quick-actions {
    display: flex;
    gap: 6px;
    padding: 8px 14px;
    overflow-x: auto;
    background: #fff;
    border-top: 1px solid #eef0f5;
    flex-shrink: 0;
}

.chatbot-quick-actions::-webkit-scrollbar {
    height: 0;
}

.chatbot-quick-btn {
    flex-shrink: 0;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid #dde1e9;
    background: #f8f9fb;
    color: #4a5568;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-weight: 500;
}

.chatbot-quick-btn:hover {
    background: #007bff;
    color: white;
    border-color: #007bff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.25);
}

/* Input Area */
.chatbot-input-area {
    padding: 12px 14px;
    background: #fff;
    border-top: 1px solid #eef0f5;
    flex-shrink: 0;
}

.chatbot-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chatbot-input {
    flex: 1;
    padding: 10px 16px;
    border: 1.5px solid #dde1e9;
    border-radius: 24px;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #f8f9fb;
    color: #333;
}

.chatbot-input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.12);
    background: #fff;
}

.chatbot-input::placeholder {
    color: #a0aec0;
}

.chatbot-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}

.chatbot-send-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 3px 12px rgba(0, 123, 255, 0.35);
}

.chatbot-send-btn:active {
    transform: scale(0.95);
}

/* ── Chatbot Responsive ── */
@media (max-width: 480px) {
    .chatbot-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .chatbot-toggle {
        bottom: 16px;
        right: 16px;
        width: 52px;
        height: 52px;
        font-size: 1.3rem;
    }
}