/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #8B1538;
    --secondary: #D4AF37;
    --text-dark: #1a1a1a;
    --text-light: #666;
    --bg-light: #f8f9fa;
    --white: #ffffff;
    --border: #e0e0e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--bg-light);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--white);
    box-shadow: var(--shadow);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo img {
    height: 100px;
    border-radius: 8px;
}

.logo-text h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.logo-text p {
    font-size: 11px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s;
}

.nav-link:hover {
    background: var(--bg-light);
}

.nav-link.active {
    color: var(--primary);
}

.btn-admin {
    background: var(--primary);
    color: var(--white);
}

.btn-admin:hover {
    background: #6d0f2a;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, #a01745 100%);
    color: var(--white);
    padding: 80px 0;
    text-align: center;
}

.hero-title {
    font-size: 56px;
    font-weight: 700;
    margin-bottom: 16px;
}

.hero-title .highlight {
    color: var(--secondary);
}

.hero-subtitle {
    font-size: 18px;
    margin-bottom: 40px;
    opacity: 0.9;
}

/* Search Box */
.search-box {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    gap: 12px;
    background: var(--white);
    padding: 8px;
    border-radius: 50px;
    box-shadow: var(--shadow-lg);
}

.search-input {
    flex: 1;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    outline: none;
    border-radius: 50px;
}

.search-btn {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 12px 32px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.search-btn:hover {
    background: #6d0f2a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 21, 56, 0.3);
}

/* Search Results */
.search-results {
    padding: 60px 0;
}

.section-title {
    font-size: 28px;
    margin-bottom: 30px;
    color: var(--text-dark);
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
    font-size: 18px;
}

/* Stories Grid */
.stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 30px;
}

.story-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    text-decoration: none;
    color: var(--text-dark);
    display: block;
}

.story-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.story-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.story-content {
    padding: 20px;
}

.story-category {
    display: inline-block;
    font-size: 12px;
    color: var(--primary);
    background: rgba(139, 21, 56, 0.1);
    padding: 4px 12px;
    border-radius: 12px;
    margin-bottom: 8px;
}

.story-title {
    font-size: 18px;
    font-weight: 600;
    margin: 8px 0;
    line-height: 1.4;
}

.story-excerpt {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.6;
}

/* Categories Section */
.categories {
    padding: 60px 0;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.category-card {
    background: var(--white);
    padding: 32px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    border-top: 4px solid var(--primary);
}

.category-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.category-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.category-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-dark);
}

.category-description {
    color: var(--text-light);
    font-size: 15px;
    margin-bottom: 20px;
    line-height: 1.6;
}

.category-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.category-link:hover {
    gap: 12px;
}

/* Chatbot */
.chatbot-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 16px 24px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
    z-index: 999;
}

.chatbot-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 24px rgba(139, 21, 56, 0.3);
}

.chat-icon {
    font-size: 24px;
}

.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 400px;
    height: 500px;
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    display: none;
    flex-direction: column;
    z-index: 1000;
}

.chatbot-window.active {
    display: flex;
}

.chatbot-header {
    background: var(--primary);
    color: var(--white);
    padding: 20px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-header h4 {
    font-size: 16px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: var(--white);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 80%;
    line-height: 1.5;
    animation: slideIn 0.3s ease;
}

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

.bot-message {
    background: var(--bg-light);
    align-self: flex-start;
}

.user-message {
    background: var(--primary);
    color: var(--white);
    align-self: flex-end;
}

.chatbot-input {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
}

.chatbot-input input {
    flex: 1;
    border: 1px solid var(--border);
    padding: 10px 16px;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

.chatbot-input button {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.chatbot-input button:hover {
    background: #6d0f2a;
}

/* Footer */
.footer {
    background: var(--text-dark);
    color: var(--white);
    padding: 40px 0;
    margin-top: 60px;
}

.footer-content {
    text-align: center;
}

.footer-info h4 {
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--secondary);
}

.footer-info p {
    font-size: 14px;
    opacity: 0.8;
    margin: 4px 0;
}

/* Category Page Styles */
.category-header {
    background: linear-gradient(135deg, var(--primary) 0%, #a01745 100%);
    color: var(--white);
    padding: 40px 0 60px;
}

.category-hero {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.category-icon-large {
    font-size: 80px;
    margin-bottom: 20px;
}

.category-title-large {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 16px;
}

.category-desc-large {
    font-size: 20px;
    opacity: 0.9;
    margin-bottom: 20px;
}

.category-stats {
    font-size: 16px;
    opacity: 0.8;
}

.stories-section {
    padding: 60px 0;
}

.no-stories {
    text-align: center;
    padding: 80px 20px;
}

.no-stories p {
    font-size: 18px;
    color: var(--text-light);
    margin-bottom: 20px;
}

.btn-back {
    display: inline-block;
    background: var(--primary);
    color: var(--white);
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-back:hover {
    background: #6d0f2a;
    transform: translateY(-2px);
}

.story-meta-footer {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-light);
}

.story-views-small, .story-date-small {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 60px;
    flex-wrap: wrap;
}

.page-link {
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    transition: all 0.3s;
}

.page-link:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

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

/* Story Page Styles */
.story-header {
    background: linear-gradient(135deg, var(--primary) 0%, #a01745 100%);
    color: var(--white);
    padding: 40px 0 60px;
}

.breadcrumb {
    display: flex;
    gap: 8px;
    font-size: 14px;
    margin-bottom: 20px;
    opacity: 0.9;
}

.breadcrumb a {
    color: var(--white);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.story-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.category-badge {
    background: rgba(255,255,255,0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.story-views, .story-date {
    font-size: 14px;
    opacity: 0.9;
}

.story-detail-title {
    font-size: 42px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 12px;
}

.story-subtitle {
    font-size: 18px;
    opacity: 0.9;
    font-style: italic;
    margin-bottom: 30px;
}

.audio-player-container {
    margin-top: 30px;
}

.audio-player {
    background: var(--white);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.play-btn {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
}

.play-btn:hover {
    background: #6d0f2a;
    transform: scale(1.05);
}

.audio-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-dark);
    font-size: 14px;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
}

.progress {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.1s;
}

.story-content-section {
    padding: 60px 0;
    background: var(--white);
}

.story-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 40px;
}

.story-main {
    background: var(--white);
}

.story-featured-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 30px;
}

.story-body {
    font-size: 18px;
    line-height: 1.8;
    color: var(--text-dark);
}

.story-body p {
    margin-bottom: 20px;
}

.story-tags {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--border);
}

.tag {
    display: inline-block;
    background: var(--bg-light);
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 14px;
    margin: 4px;
    color: var(--text-dark);
}

.story-sidebar {
    position: sticky;
    top: 100px;
    height: fit-content;
}

.sidebar-widget {
    background: var(--bg-light);
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.sidebar-widget h3 {
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--text-dark);
}

.btn-generate-toc {
    width: 100%;
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 12px;
    transition: all 0.3s;
}

.btn-generate-toc:hover {
    background: #6d0f2a;
}

.quick-chat-messages {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.quick-chat-form {
    display: flex;
    gap: 8px;
}

.quick-chat-form input {
    flex: 1;
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
}

.quick-chat-form button {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.related-stories {
    padding: 60px 0;
    background: var(--bg-light);
}

/* Responsive */
@media (max-width: 768px) {
    .hero-title {
        font-size: 36px;
    }
    
    .story-detail-title {
        font-size: 28px;
    }
    
    .story-layout {
        grid-template-columns: 1fr;
    }
    
    .story-sidebar {
        position: static;
    }
    
    .categories-grid {
        grid-template-columns: 1fr;
    }
    
    .chatbot-window {
        width: 90%;
        right: 5%;
        bottom: 90px;
    }
    
    .chatbot-toggle {
        padding: 12px 20px;
    }
    
    .chat-text {
        display: none;
    }
}