/* Main stylesheet for the website */

/* CSS Variables for Light/Dark Theme */
:root {
    /* Colors */
    --primary-color: #667eea;
    --primary-hover: #5a6fd8;
    --secondary-color: #764ba2;
    --accent-color: #ff6b6b;
    --accent-hover: #ff5252;
    
    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --bg-hero: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    
    /* Text Colors */
    --text-primary: #333333;
    --text-secondary: #6c757d;
    --text-muted: #555555;
    --text-light: #ffffff;
    
    /* Border Colors */
    --border-color: #e9ecef;
    --border-color-hover: #667eea;
    
    /* Shadow Colors */
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.15);
    --shadow-heavy: rgba(0, 0, 0, 0.2);
    
    /* Chat Variables */
    --chat-bg: #ffffff;
    --chat-secondary-bg: #f8f9fa;
    --chat-border: #e9ecef;
    --chat-user-bubble: #667eea;
    --chat-assistant-bubble: #f1f3f4;
    --chat-assistant-text: #333333;
    --chat-input-bg: #ffffff;
    --chat-input-border: #ced4da;
    
    /* Form Variables */
    --form-bg: #ffffff;
    --form-border: #e9ecef;
    --form-focus: #667eea;
    --form-valid: #28a745;
    --form-invalid: #dc3545;
    
    /* Button Variables */
    --btn-primary-bg: #ff6b6b;
    --btn-primary-hover: #ff5252;
    --btn-secondary-bg: transparent;
    --btn-secondary-border: #ffffff;
    --btn-secondary-hover-bg: #ffffff;
    --btn-secondary-hover-text: #667eea;
}

/* Dark Theme Variables */
[data-theme="dark"] {
    /* Background Colors */
    --bg-primary: #1a1a1a;
    --bg-secondary: #2c2c2c;
    --bg-tertiary: #404040;
    --bg-hero: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    
    /* Text Colors */
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-muted: #9ca3af;
    --text-light: #ffffff;
    
    /* Border Colors */
    --border-color: #404040;
    --border-color-hover: #667eea;
    
    /* Shadow Colors */
    --shadow-light: rgba(0, 0, 0, 0.3);
    --shadow-medium: rgba(0, 0, 0, 0.4);
    --shadow-heavy: rgba(0, 0, 0, 0.5);
    
    /* Chat Variables */
    --chat-bg: #1a1a1a;
    --chat-secondary-bg: #2c2c2c;
    --chat-border: #404040;
    --chat-assistant-bubble: #333333;
    --chat-assistant-text: #e0e0e0;
    --chat-input-bg: #2c2c2c;
    --chat-input-border: #404040;
    
    /* Form Variables */
    --form-bg: #2c2c2c;
    --form-border: #404040;
    --form-focus: #667eea;
    --form-valid: #28a745;
    --form-invalid: #dc3545;
    
    /* Button Variables */
    --btn-primary-bg: #ff6b6b;
    --btn-primary-hover: #ff5252;
    --btn-secondary-bg: transparent;
    --btn-secondary-border: #e0e0e0;
    --btn-secondary-hover-bg: #e0e0e0;
    --btn-secondary-hover-text: #2c2c2c;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: all 0.3s ease;
}

/* Container utility */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header styles */
header {
    background-color: var(--bg-secondary);
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    transition: all 0.3s ease;
}

/* Navigation styles */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.nav-brand:hover {
    color: var(--primary-hover);
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 2rem;
    margin: 0;
    padding: 0;
}

.nav-menu a {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

.nav-menu a:hover {
    color: var(--primary-color);
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.nav-menu a:hover::after {
    width: 100%;
}

/* Mobile hamburger menu */
.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 0.5rem;
    background: none;
    border: none;
    aria-label: 'Toggle navigation';
}

.hamburger span {
    width: 25px;
    height: 3px;
    background-color: var(--text-primary);
    margin: 3px 0;
    transition: 0.3s;
    transform-origin: center;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Theme toggle button */
.theme-toggle {
    background: none;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.theme-icon {
    font-size: 1.2rem;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="20" cy="20" r="0.5" fill="%23ffffff" opacity="0.05"/><circle cx="80" cy="30" r="0.8" fill="%23ffffff" opacity="0.08"/><circle cx="30" cy="80" r="0.6" fill="%23ffffff" opacity="0.06"/><circle cx="70" cy="70" r="0.4" fill="%23ffffff" opacity="0.04"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.2);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    padding: 2rem;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: -0.02em;
}

.hero-cta {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Button Styles with Accessible Contrast */
.btn {
    display: inline-block;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    cursor: pointer;
    text-align: center;
    min-width: 200px;
    position: relative;
    overflow: hidden;
    font-family: inherit;
}

.btn:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background-color: var(--btn-primary-bg);
    color: var(--text-light);
    border-color: var(--btn-primary-bg);
    /* Ensure 4.5:1 contrast ratio for accessibility */
    font-weight: 700;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--btn-primary-hover);
    border-color: var(--btn-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--shadow-medium);
}

.btn-secondary {
    background-color: var(--btn-secondary-bg);
    color: var(--text-light);
    border-color: var(--btn-secondary-border);
    font-weight: 600;
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--btn-secondary-hover-bg);
    color: var(--btn-secondary-hover-text);
    border-color: var(--btn-secondary-hover-bg);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--shadow-light);
}

.btn-outline {
    background-color: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline:hover:not(:disabled) {
    background-color: var(--primary-color);
    color: var(--text-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--shadow-light);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    min-width: 120px;
}

.btn-large {
    padding: 1.25rem 2.5rem;
    font-size: 1.2rem;
    min-width: 250px;
}

/* Introduction Section */
.intro {
    padding: 4rem 0;
    background-color: #f8f9fa;
}

.intro-text {
    font-size: 1.2rem;
    line-height: 1.8;
    text-align: center;
    margin-bottom: 3rem;
    color: #555;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* Social Media Icons */
.social-media {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: white;
    color: #667eea;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.social-icon:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    color: #ff6b6b;
}

.social-icon svg {
    width: 24px;
    height: 24px;
}

/* Form Styles with Accessible Contrast */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--form-border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background-color: var(--form-bg);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--form-focus);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.form-group input:invalid,
.form-group textarea:invalid {
    border-color: var(--form-invalid);
}

.form-group input:valid,
.form-group textarea:valid {
    border-color: var(--form-valid);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

/* Error and success messages */
.error-message {
    color: var(--form-invalid);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    font-weight: 500;
}

.success-message {
    color: var(--form-valid);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    font-weight: 500;
}

/* Checkbox and radio styles */
.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: auto;
    margin: 0;
    accent-color: var(--primary-color);
}

.form-check label {
    margin: 0;
    font-weight: normal;
    cursor: pointer;
}

/* Main content styles */
main {
    /* Remove default padding since sections handle their own spacing */
}

/* Footer styles */
footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: 2rem;
}

/* Book Page Styles */
.book-showcase {
    padding: 4rem 0;
    background-color: #f8f9fa;
}

.book-layout {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 3rem;
    align-items: start;
    max-width: 1200px;
    margin: 0 auto;
}

.book-cover {
    position: sticky;
    top: 2rem;
}

.cover-image {
    width: 100%;
    max-width: 400px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

.cover-image:hover {
    transform: translateY(-5px);
}

.book-details {
    padding: 1rem 0;
}

.book-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.book-synopsis {
    margin-bottom: 2rem;
}

.book-synopsis p {
    font-size: 1.1rem;
    line-height: 1.7;
    color: #555;
    margin-bottom: 1rem;
}

.book-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.book-actions .btn {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    min-width: 180px;
    text-align: center;
}

/* Testimonials Section */
.testimonials-section {
    margin-top: 2rem;
    padding: 2rem;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.testimonials-section h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1.5rem;
    text-align: center;
}

.testimonials-carousel {
    position: relative;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.testimonial {
    display: none;
    text-align: center;
    padding: 1rem;
    animation: fadeIn 0.5s ease-in-out;
}

.testimonial.active {
    display: block;
}

.testimonial blockquote {
    border: none;
    margin: 0;
    padding: 0;
    font-style: italic;
}

.testimonial blockquote p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #555;
    margin-bottom: 1rem;
    quotes: "\201C""\201D""\2018""\2019";
}

.testimonial blockquote p::before {
    content: open-quote;
    font-size: 1.5em;
    color: #667eea;
    margin-right: 0.1em;
}

.testimonial blockquote p::after {
    content: close-quote;
    font-size: 1.5em;
    color: #667eea;
    margin-left: 0.1em;
}

.testimonial cite {
    font-weight: 600;
    color: #667eea;
    font-style: normal;
}

.carousel-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.carousel-btn {
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-btn:hover {
    background-color: #5a6fd8;
    transform: scale(1.1);
}

.carousel-indicators {
    display: flex;
    gap: 0.5rem;
}

.indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
}

.indicator.active {
    background-color: #667eea;
    transform: scale(1.2);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive Layout Utilities */
.flex {
    display: flex;
}

.grid {
    display: grid;
}

.flex-wrap {
    flex-wrap: wrap;
}

.justify-center {
    justify-content: center;
}

.items-center {
    align-items: center;
}

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }

/* Desktop-first responsive design with proper breakpoints */

/* Large screens (1024px and up) */
@media (min-width: 1024px) {
    .container {
        max-width: 1200px;
    }
    
    .hero-title {
        font-size: 3.5rem;
    }
    
    .chat-container {
        grid-template-columns: 1fr 320px;
        gap: 3rem;
    }
    
    .book-layout {
        grid-template-columns: 1fr 2.5fr;
        gap: 4rem;
    }
}

/* Medium screens (768px to 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .container {
        padding: 0 2rem;
    }
    
    .nav-menu {
        gap: 1.5rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .chat-container {
        grid-template-columns: 1fr 250px;
        gap: 1.5rem;
    }
    
    .book-layout {
        grid-template-columns: 1fr 2fr;
        gap: 2.5rem;
    }
}

/* Small screens (768px and below) - Mobile */
@media (max-width: 768px) {
    /* Navigation */
    .hamburger {
        display: flex;
    }
    
    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--bg-secondary);
        flex-direction: column;
        padding: 1rem;
        box-shadow: 0 4px 20px var(--shadow-light);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 1000;
    }
    
    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    .nav-menu a::after {
        display: none;
    }
    
    /* Hero section */
    .hero {
        min-height: 80vh;
        padding: 2rem 1rem;
    }
    
    .hero-title {
        font-size: 2rem;
        margin-bottom: 1.5rem;
    }
    
    .hero-cta {
        flex-direction: column;
        align-items: center;
    }
    
    /* Buttons */
    .btn {
        width: 100%;
        max-width: 300px;
        min-width: auto;
    }
    
    /* Sections */
    .intro {
        padding: 2rem 0;
    }
    
    .intro-text {
        font-size: 1.1rem;
        margin-bottom: 2rem;
    }
    
    /* Social media */
    .social-media {
        gap: 1rem;
    }
    
    .social-icon {
        width: 45px;
        height: 45px;
    }
    
    .social-icon svg {
        width: 20px;
        height: 20px;
    }
    
    /* Chat interface */
    .chat-container {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
    }
    
    .chat-interface {
        height: 500px;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .chat-messages {
        padding: 1rem;
    }
    
    .chat-input-area {
        padding: 1rem;
    }
    
    /* Book page mobile styles */
    .book-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .book-cover {
        position: static;
        order: -1;
    }
    
    .cover-image {
        max-width: 280px;
        margin: 0 auto;
    }
    
    .book-title {
        font-size: 2rem;
        text-align: center;
    }
    
    .book-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .book-actions .btn {
        width: 100%;
        max-width: 280px;
    }
    
    /* Forms */
    .contact-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .form-group input,
    .form-group textarea {
        padding: 0.6rem 0.8rem;
    }
    
    /* Testimonials */
    .testimonials-section {
        margin: 1.5rem 0;
        padding: 1.5rem;
    }
    
    .testimonial blockquote p {
        font-size: 1rem;
    }
    
    .carousel-btn {
        width: 35px;
        height: 35px;
        font-size: 1.2rem;
    }
}

/* Extra small screens (480px and below) */
@media (max-width: 480px) {
    .hero-title {
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    .hero-content {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
        min-width: auto;
    }
    
    .intro-text {
        font-size: 1rem;
        padding: 0 1rem;
    }
    
    .chat-interface {
        height: 450px;
    }
    
    .message-content {
        max-width: 90%;
    }
    
    .message-bubble {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .avatar-circle {
        width: 35px;
        height: 35px;
        font-size: 0.7rem;
    }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Accessibility styles */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--text-primary);
    color: var(--text-light);
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 6px;
}

/* Focus indicators */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.keyboard-focus {
    outline: 3px solid var(--primary-color) !important;
    outline-offset: 2px !important;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-primary: #000000;
        --bg-primary: #ffffff;
    }
    
    [data-theme="dark"] {
        --border-color: #ffffff;
        --text-primary: #ffffff;
        --bg-primary: #000000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print styles */
@media print {
    * {
        color: #000 !important;
        background: #fff !important;
        box-shadow: none !important;
    }
    
    .hamburger,
    .theme-toggle,
    .chat-interface,
    .btn {
        display: none !important;
    }
}

/* Chat Bubble Styles with Accessible Contrast */
.chat-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    min-height: 80vh;
}

.chat-interface {
    background-color: var(--chat-bg);
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--shadow-light);
    display: flex;
    flex-direction: column;
    height: 600px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

.message {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    animation: slideIn 0.3s ease-out;
}

.user-message {
    flex-direction: row-reverse;
}

.message-avatar {
    flex-shrink: 0;
}

.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
    background: var(--primary-color);
}

.user-message .avatar-circle {
    background: var(--accent-color);
}

.message-content {
    flex: 1;
    max-width: 70%;
}

.message-bubble {
    background-color: var(--chat-assistant-bubble);
    color: var(--chat-assistant-text);
    padding: 1rem 1.25rem;
    border-radius: 18px;
    line-height: 1.5;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    /* Ensure accessible contrast ratios */
    font-weight: 500;
}

.user-message .message-bubble {
    background-color: var(--chat-user-bubble);
    color: var(--text-light);
    border-bottom-right-radius: 6px;
    font-weight: 600;
}

.assistant-message .message-bubble {
    border-bottom-left-radius: 6px;
}

.message-bubble p {
    margin: 0;
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    padding-left: 1rem;
}

.user-message .message-time {
    text-align: right;
    padding-left: 0;
    padding-right: 1rem;
}

/* Chat input area with accessible styling */
.chat-input-area {
    border-top: 1px solid var(--chat-border);
    padding: 1.5rem;
    background-color: var(--chat-bg);
}

.input-container {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

#messageInput {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--chat-input-border);
    border-radius: 25px;
    font-size: 0.95rem;
    background-color: var(--chat-input-bg);
    color: var(--text-primary);
    transition: all 0.3s ease;
    outline: none;
}

#messageInput:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.send-button {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-weight: bold;
}

.send-button:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.send-button:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.chat-hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    padding: 3rem 0;
    position: relative;
    overflow: hidden;
}

.chat-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
}

.chat-hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    position: relative;
    z-index: 2;
}

.chat-hero p {
    font-size: 1.2rem;
    opacity: 0.9;
    position: relative;
    z-index: 2;
}

.chat-content {
    padding: 2rem 0;
    background-color: var(--chat-secondary-bg);
    min-height: 80vh;
    transition: background-color 0.3s ease;
}

.chat-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    height: 100%;
}

.chat-interface {
    background-color: var(--chat-bg);
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--chat-shadow);
    display: flex;
    flex-direction: column;
    height: 600px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

.message {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    animation: slideIn 0.3s ease-out;
}

.user-message {
    flex-direction: row-reverse;
}

.message-avatar {
    flex-shrink: 0;
}

.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.user-message .avatar-circle {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
}

.message-content {
    flex: 1;
    max-width: 70%;
}

.message-bubble {
    background-color: var(--chat-assistant-bubble);
    color: var(--chat-assistant-text);
    padding: 1rem 1.25rem;
    border-radius: 18px;
    line-height: 1.5;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.user-message .message-bubble {
    background-color: var(--chat-user-bubble);
    color: var(--chat-user-text);
    border-bottom-right-radius: 6px;
}

.assistant-message .message-bubble {
    border-bottom-left-radius: 6px;
}

.message-bubble p {
    margin: 0;
}

.message-time {
    font-size: 0.75rem;
    color: var(--chat-text-secondary);
    margin-top: 0.5rem;
    padding-left: 1rem;
}

.user-message .message-time {
    text-align: right;
    padding-left: 0;
    padding-right: 1rem;
}

/* Typing indicator */
.typing-indicator {
    padding: 0 1.5rem;
}

.message-bubble.typing {
    background-color: var(--chat-assistant-bubble);
    padding: 1rem 1.25rem;
    width: fit-content;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--chat-text-secondary);
    animation: typingDots 1.5s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDots {
    0%, 60%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    30% {
        transform: scale(1.2);
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat input area */
.chat-input-area {
    border-top: 1px solid var(--chat-border);
    padding: 1.5rem;
    background-color: var(--chat-bg);
}

.input-container {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

#messageInput {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--chat-input-border);
    border-radius: 25px;
    font-size: 0.95rem;
    background-color: var(--chat-input-bg);
    color: var(--chat-text);
    transition: all 0.3s ease;
    outline: none;
}

#messageInput:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.send-button {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.send-button:hover {
    opacity: 1;
    transform: scale(1.05);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.input-hint {
    font-size: 0.8rem;
    color: var(--chat-text-secondary);
    margin-top: 0.5rem;
    text-align: center;
}

/* Chat info sidebar */
.chat-info {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.chat-guidelines {
    background-color: var(--chat-bg);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--chat-shadow);
    transition: all 0.3s ease;
}

.chat-guidelines h3 {
    color: var(--chat-text);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.chat-guidelines ul {
    list-style: none;
    padding: 0;
}

.chat-guidelines li {
    color: var(--chat-text);
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
    font-size: 0.9rem;
    line-height: 1.4;
}

.chat-guidelines li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

/* Theme toggle */
.theme-toggle {
    background-color: var(--chat-bg);
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--chat-shadow);
    transition: all 0.3s ease;
}

.theme-toggle-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--chat-border);
    border-radius: 8px;
    background-color: var(--chat-input-bg);
    color: var(--chat-text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.theme-toggle-btn:hover {
    border-color: #667eea;
    transform: translateY(-1px);
}

.theme-icon {
    font-size: 1.2rem;
}

@media (max-width: 768px) {
    .chat-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .chat-interface {
        height: 500px;
    }
    
    .chat-hero h1 {
        font-size: 2rem;
    }
    
    .chat-hero p {
        font-size: 1rem;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .chat-messages {
        padding: 1rem;
    }
    
    .chat-input-area {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    .hero-content {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }
    
    .intro-text {
        font-size: 1rem;
        padding: 0 1rem;
    }
    
    .chat-interface {
        height: 450px;
    }
    
    .chat-hero h1 {
        font-size: 1.8rem;
    }
    
    .message-content {
        max-width: 90%;
    }
    
    .message-bubble {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .avatar-circle {
        width: 35px;
        height: 35px;
        font-size: 0.7rem;
    }
    
    /* Book page very small screen styles */
    .book-showcase {
        padding: 2rem 0;
    }
    
    .book-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .book-synopsis p {
        font-size: 0.9rem;
        line-height: 1.6;
    }
    
    .testimonials-section {
        padding: 1rem;
        margin: 1rem 0;
    }
    
    .testimonials-section h3 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }
    
    .testimonial blockquote p {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    .carousel-controls {
        gap: 0.5rem;
    }
    
    .carousel-btn {
        width: 30px;
        height: 30px;
        font-size: 1rem;
    }
}

/* Contact Page Styles */
.contact-hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    padding: 3rem 0;
    position: relative;
    overflow: hidden;
}

.contact-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
}

.contact-hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    position: relative;
    z-index: 2;
}

.contact-hero p {
    font-size: 1.2rem;
    opacity: 0.9;
    position: relative;
    z-index: 2;
}

.contact-content {
    padding: 3rem 0;
    background-color: #f8f9fa;
}

.contact-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
}

.contact-form {
    background-color: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.contact-form h2 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1.5rem;
    text-align: center;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background-color: #fff;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}

.contact-info {
    background-color: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.contact-info h2 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1.5rem;
    text-align: center;
}

.contact-details h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 1rem;
    margin-top: 2rem;
}

.contact-details h3:first-child {
    margin-top: 0;
}

.contact-details p {
    font-size: 1rem;
    line-height: 1.6;
    color: #555;
    margin-bottom: 1rem;
}

.contact-details ul {
    list-style: none;
    padding: 0;
}

.contact-details li {
    color: #555;
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
    font-size: 0.95rem;
    line-height: 1.5;
}

.contact-details li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

/* Alert Styles */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid transparent;
    font-size: 0.95rem;
    line-height: 1.5;
}

.alert-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert-error {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.alert strong {
    font-weight: 600;
}

/* Contact page responsive styles */
@media (max-width: 768px) {
    .contact-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .contact-hero h1 {
        font-size: 2rem;
    }
    
    .contact-hero p {
        font-size: 1rem;
    }
    
    .contact-content {
        padding: 2rem 0;
    }
    
    .contact-form,
    .contact-info {
        padding: 1.5rem;
    }
    
    .contact-form h2,
    .contact-info h2 {
        font-size: 1.5rem;
    }
    
    .form-group input,
    .form-group textarea {
        padding: 0.6rem 0.8rem;
    }
}
