
:root {
    --primary-color: #4A60A1; /* Deep Indigo Footer and Main Accents */
    --secondary-color: #3B82F6; /* Bright Action Blue */
    --accent-color: #A78BFA; /* Light Lavender */
    --accent-teal: #64C5B1; /* Light Teal for icons */
    --bg-color: #F8F9FA; /* Off-white main background */
    --text-dark: #333333;
    --text-light: #ffffff;
    --text-muted: #666666;
    --card-bg: #ffffff; /* White for cards */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Sarabun', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-dark);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Navbar */
.navbar {
    background-color: var(--primary-color);
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

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

.logo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
}

.brand-name {
    color: white;
    font-size: 24px;
    font-weight: 600;
}

.hamburger {
    display: none; /* ซ่อนบนหน้าจอปกติ */
    cursor: pointer;
    font-size: 28px;
    color: white;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 30px;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 16px;
    transition: 0.3s;
    position: relative;
}

.nav-links a:hover, .nav-links a.active {
    color: white;
    font-weight: 500;
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: white;
}

/* Main Content */
.main-content {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    flex: 1;
    width: 100%;
}

/* Hero Section */
.hero-section {
    margin-bottom: 50px;
}

.hero-banner {
    background-size: cover;
    background-position: center;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(82, 108, 174, 0.2);
    position: relative;
    overflow: hidden;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    text-align: center;
}

.hero-title {
    flex: 1;
}

.hero-title h2 {
    color: var(--primary-color);
    font-size: 24px;
    line-height: 1.2;
}

.highlight-large {
    font-size: 36px;
    font-weight: 600;
}

.subtitle {
    color: var(--primary-color);
    font-size: 14px;
    margin-top: 10px;
    opacity: 0.8;
}

.hero-logo .center-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.crown-icon, .star-icon {
    width: 30px;
    margin-bottom: 10px;
}

.carousel-container {
    position: relative;
    display: flex;
    align-items: center;
    margin: 0 -20px; /* Pull out slightly to give room for absolute buttons */
}

.book-cards {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding: 20px 40px; /* Add horizontal padding for absolute buttons */
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
    width: 100%;
}
.book-cards::-webkit-scrollbar {
    display: none; /* Safari and Chrome */
}

.book-card-small {
    min-width: 180px; /* Increased size to force scrolling */
    background: white;
    border-radius: 10px;
    padding: 8px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: transform 0.3s;
    cursor: pointer;
    flex-shrink: 0; /* Prevent shrinking */
}

.book-card-small:hover {
    transform: translateY(-5px);
}

.book-card-small img {
    width: 100%;
    height: 240px; /* Match new aspect ratio */
    object-fit: cover;
    border-radius: 8px;
}

.rank-badge, .new-badge {
    position: absolute;
    top: 15px;
    left: -5px;
    background: var(--primary-color);
    color: white;
    width: 25px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border-radius: 0 5px 5px 0;
    z-index: 1;
    font-size: 14px;
}

.new-badge {
    width: 40px;
    background: #FF6B6B;
}

.book-info-small {
    margin-top: 10px;
    text-align: center;
}

.book-info-small h4 {
    font-size: 12px;
    color: var(--primary-color);
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-info-small span {
    font-size: 12px;
    color: var(--secondary-color);
}

.tags {
    font-size: 10px !important;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    color: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    z-index: 10;
    transition: 0.3s;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.prev-btn {
    left: 0;
}

.next-btn {
    right: 0;
}

.nav-btn:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 20px 0;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(82, 108, 174, 0.3);
    cursor: pointer;
}

.dot.active {
    background: var(--primary-color);
}

.hero-actions {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(167, 139, 250, 0.3);
}

.btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

/* Sections */
.section {
    margin-bottom: 60px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
}

.section-icon {
    width: 30px;
    height: 30px;
}

.section-header h2 {
    font-size: 24px;
    color: var(--text-dark);
}

.category-title {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--text-dark);
}

/* Recently Read Cards */
.recent-books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
}

.recent-book-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.05);
    position: relative;
    border: 1px solid rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.recent-book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(74, 96, 161, 0.15);
}

.card-inner {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.book-cover {
    width: 120px;
    height: 180px;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.book-details {
    flex: 1;
}

.book-details .brand {
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 5px;
}

.book-details h3 {
    font-size: 20px;
    color: var(--primary-color);
    line-height: 1.2;
    margin-bottom: 10px;
}

.book-details .author {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.book-details .description {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.6);
    padding: 10px 15px;
    border-radius: 15px;
}

.read-progress {
    display: flex;
    align-items: center;
    gap: 15px;
}

.read-progress i {
    color: var(--primary-color);
    font-size: 20px;
}

.read-progress .label {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
}

.read-progress .chapter {
    display: block;
    font-size: 14px;
    color: var(--primary-color);
    font-weight: 600;
}

.continue-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.continue-btn:hover {
    background: var(--secondary-color);
    transform: scale(1.1);
}

/* Category Grid */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.category-card {
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    position: relative;
    background: white; /* Changed to white to fit text */
    display: flex;
    flex-direction: column;
}

.category-card-title {
    padding: 12px 10px 5px;
    text-align: center;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chapter-info {
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
}

.chapter-count {
    font-size: 14px;
    color: var(--primary-color);
    font-weight: 600;
}

.add-chapter-btn {
    font-size: 13px;
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Sarabun', sans-serif;
    font-weight: 500;
    transition: 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 5px rgba(59, 130, 246, 0.3);
}

.add-chapter-btn:hover {
    background: #2563EB; /* Darker blue */
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}

.category-card img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    transition: 0.3s;
}

.category-card:hover img {
    transform: scale(1.05);
}

/* Footer */
.footer {
    background-color: var(--primary-color);
    color: white;
    padding: 30px 20px;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 30px;
    align-items: center;
}

.footer-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.footer-logo img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    background-color: white;
}

.footer-logo h2 {
    font-size: 18px;
    font-weight: 500;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    align-items: center;
}

.footer-links a {
    color: white;
    text-decoration: none;
    font-size: 14px;
    transition: 0.3s;
}

.footer-links a:hover {
    opacity: 0.8;
}

.footer-contact {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.footer-contact h3 {
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
}

.footer-contact p {
    font-size: 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.9;
}

/* Author Profile */
.author-profile-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 60px;
    padding-top: 40px;
}

.author-avatar-container {
    margin-bottom: 25px;
}

.author-avatar {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    border: 5px solid white;
}

.author-info {
    text-align: center;
    margin-bottom: 30px;
}

.author-real-name {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.author-pen-name {
    font-size: 16px;
    color: var(--text-dark);
}

.author-stats {
    display: flex;
    justify-content: center;
    gap: 80px;
    width: 100%;
    max-width: 600px;
}

.stat-group-left, .stat-group-right {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.stat-group-left {
    align-items: flex-start;
}

.stat-group-right {
    align-items: flex-start;
}

.stat-item {
    font-size: 16px;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-item i {
    font-size: 20px;
}

/* Works Grid */
.works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 40px;
    margin-top: 30px;
    padding: 0 40px;
}

.author-works-section {
    max-width: 1000px;
    margin: 0 auto 60px auto;
}

/* Filter Section */
.filter-section {
    max-width: 1200px;
    margin: 20px auto 40px auto;
}

.filter-container {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    background: transparent;
    padding: 10px 0;
}

.filter-label {
    font-size: 20px;
    font-weight: 600;
    min-width: 90px;
    padding-top: 5px;
    color: var(--text-dark);
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.filter-btn {
    padding: 8px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.3s;
    color: #000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.filter-btn:hover {
    opacity: 0.8;
    transform: translateY(-2px);
}

.btn-all { background-color: #FFF3B0; }
.btn-romance { background-color: #FFA3F2; }
.btn-romanza { background-color: #FFA4A4; }
.btn-ancient { background-color: #A3F2FF; }
.btn-gl { background-color: #D97373; color: black; }
.btn-bl { background-color: #738CD9; color: black; }

/* Discussion Section */
.discussion-section {
    max-width: 900px;
    margin: 40px auto 100px auto;
}

.discussion-header {
    margin-bottom: 50px;
}

.megaphone-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.announcement-list {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.announcement-card {
    background-color: #DFDFDF;
    border-radius: 20px;
    padding: 30px 40px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

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

.announcement-icon {
    font-size: 24px;
    color: #000;
    width: 30px;
    text-align: center;
}

.announcement-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-dark);
}

.announcement-bottom {
    display: flex;
    align-items: center;
    padding-left: 10px;
}

.announcement-details-link {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    color: var(--text-dark);
    font-size: 15px;
    cursor: pointer;
}

.announcement-details-link i {
    font-size: 24px;
}

.announcement-date {
    font-size: 15px;
    color: var(--text-dark);
    padding-right: 150px;
}

/* Contact Page */
.contact-section {
    max-width: 800px;
    margin: 40px auto 100px auto;
}

.contact-section-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 35px;
}

.contact-title-icon {
    width: 48px;
    height: 48px;
    background: #4a4a4a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    position: relative;
}

.contact-title-icon::after {
    content: '+';
    position: absolute;
    bottom: -2px;
    right: -4px;
    background: #4a4a4a;
    color: white;
    font-size: 14px;
    font-weight: bold;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-color);
}

.contact-section-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-dark);
}

/* Author Contact Card */
.author-contact-card {
    background: #f0f0f0;
    border-radius: 20px;
    padding: 25px 30px;
    display: flex;
    align-items: flex-start;
    gap: 25px;
    margin-bottom: 50px;
}

.author-contact-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.author-contact-info {
    flex: 1;
}

.author-contact-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.author-contact-channel {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.author-social-links {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.social-link {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--text-dark);
    font-size: 13px;
    transition: 0.3s;
}

.social-link:hover { color: var(--primary-color); }
.social-icon { font-size: 18px; }
.facebook-icon { color: #1877F2; }
.x-icon { color: #000; }
.tiktok-icon { color: #000; }

.social-handle {
    font-size: 12px;
    color: var(--secondary-color);
}

/* Message Section */
.message-section-title {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 25px;
}

.message-card {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 30px;
}

.commenter-avatar {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.message-content { flex: 1; }

.commenter-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.message-text {
    font-size: 14px;
    color: var(--text-dark);
    line-height: 1.8;
}

/* Message Form */
.message-form-area {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.message-input {
    width: 100%;
    padding: 15px 20px;
    border: 1px solid #ddd;
    border-radius: 12px;
    font-family: 'Sarabun', sans-serif;
    font-size: 14px;
    color: var(--text-dark);
    resize: vertical;
    outline: none;
    transition: border-color 0.3s;
    background: #fafafa;
}

.message-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(82, 108, 174, 0.1);
}

.message-form-actions {
    display: flex;
    justify-content: center;
}

.send-btn {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 12px 50px;
    border-radius: 25px;
    font-size: 16px;
    font-family: 'Sarabun', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: 0.3s;
}

.send-btn:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(82, 108, 174, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .hamburger {
        display: block; /* แสดงเมื่อเป็นหน้าจอมือถือ */
    }

    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        background-color: var(--primary-color);
        position: absolute;
        top: 90px;
        left: 0;
        padding: 20px 0;
        box-shadow: 0 10px 10px rgba(0,0,0,0.1);
        z-index: 1000;
        gap: 15px;
        text-align: center;
    }

    .nav-links.active {
        display: flex;
    }
    
    .hero-banner {
        padding: 20px 10px;
    }

    .hero-header {
        flex-direction: column;
        gap: 15px;
    }

    .hero-logo .center-logo {
        display: none; /* ซ่อนโลโก้ตรงกลางในมือถือเพื่อประหยัดพื้นที่ */
    }

    .hero-title h2 {
        font-size: 20px;
    }
    
    .highlight-large {
        font-size: 26px;
    }

    .book-card-small {
        min-width: 140px;
    }

    .book-card-small img {
        height: 190px;
    }

    .hero-actions {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }

    .btn-primary {
        width: 100%;
        justify-content: center;
    }
    
    .recent-books-grid {
        grid-template-columns: 1fr;
    }

    .card-inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .book-cover {
        width: 140px;
        height: 210px;
        margin-bottom: 15px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 15px;
    }
    
    .footer-contact {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    /* Author and Filter Responsive */
    .author-stats {
        flex-direction: column;
        gap: 20px;
        align-items: center;
    }
    .stat-group-left, .stat-group-right {
        align-items: center;
    }
    
    .filter-container {
        flex-direction: column;
        align-items: center;
    }
    .filter-buttons {
        justify-content: center;
    }
}

