/*
Theme Name: VanManga Theme
Description: Custom WordPress theme for manga/manhwa/novel websites, inspired by modern manga communities.
Version: 2.7.9
Author: VanCity Developer
Text Domain: vanmanga
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: manga, manhwa, novel, dark-theme, custom-post-types, responsive
*/

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* Fix highlight biru di mobile */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

body.no-scroll {
    overflow: hidden;
}

/* Dark Modern Theme Colors */
:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1c1c1c;
    --bg-tertiary: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --accent-primary: #6c5ce7;
    --accent-secondary: #a29bfe;
    --border-color: #333333;
}

body.light-mode {
    --bg-primary: #f3f4f6;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --accent-primary: #6c5ce7;
    --accent-secondary: #8b7df0;
    --border-color: #e5e7eb;
}

a {
    color: var(--accent-secondary);
    text-decoration: none;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* Cards */
.card {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    background-color: var(--accent-primary);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: background-color 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn:hover {
    background-color: var(--accent-secondary);
}

/* Avatar */
.avatar {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    object-fit: cover;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .card {
        padding: 15px;
    }
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Slider Styles for Banner */
.slider {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 30px;
}

.slider img {
    width: 100%;
    height: 300px;
    object-fit: cover;
}

/* Chapter List */
.chapter-list {
    list-style: none;
}

.chapter-list li {
    background-color: var(--bg-tertiary);
    margin-bottom: 10px;
    padding: 15px;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.chapter-list li:hover {
    background-color: var(--bg-secondary);
}

/* Reader Styles */
.reader {
    max-width: 800px;
    margin: 0 auto;
}

.reader img {
    width: 100%;
    margin-bottom: 10px;
    border-radius: 8px;
}

/* Navigation */
.chapter-nav {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

/* Sidebar */
.sidebar {
    background-color: var(--bg-secondary);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

/* Header */
header,
.site-header {
    background-color: var(--bg-primary); /* Dark Black */
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: auto; /* Allow height to grow */
    z-index: 1000;
    box-shadow: 0 4px 20px -5px rgba(108, 92, 231, 0.4); /* Purple Glow Effect */
    -webkit-transform: translateZ(0); /* Fix jitter pada iOS saat scroll */
    transform: translateZ(0);
    padding: 10px 0 15px;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Top Row: Grid Layout for Perfect Centering */
.header-top {
    position: relative; /* robust centering across browsers */
    display: grid;
    grid-template-columns: 1fr auto 1fr; /* left / center / right */
    align-items: center;
    height: 50px;
    width: 100%;
    column-gap: 12px;
}

.header-col-left {
    flex: 1 1 0; /* allow shrinking to avoid pushing right column to next line */
    min-width: 0;     /* important for flex children to be able to shrink */
    display: flex;
    justify-self: start;
}

.header-col-center {
    flex: 0 1 auto; /* allow shrinking when space is limited */
    min-width: 0; /* allow flex item to be smaller than its content */
    justify-self: center; /* center in grid */
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible;
}

.header-col-right {
    flex: 1 1 0; /* allow shrinking to keep in one line */
    min-width: 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    position: relative;
    z-index: 3; /* keep controls above the centered logo */
    justify-self: end;
}

.burger-menu-toggle {
    z-index: 4; /* ensure toggle is top-most and clickable */
}

.logo-link {
    text-decoration: none;
    display: flex;
    align-items: center;
}

.logo-text {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.light-mode .logo-text {
    color: var(--text-primary);
}

/* Small screen safety: prevent long site title from pushing/hiding controls in Chrome */
@media (max-width: 420px) {
    .header-top { grid-template-columns: auto 1fr auto; }
    .header-col-center .logo-text {
        max-width: 60vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: inline-block;
        padding-right: 8px;
    }
}

/* Bottom Row: Search Bar */
.header-bottom {
    width: 100%;
    display: flex;
    justify-content: center;
}

/* Search Form Modern */
.search-form {
    display: flex;
    align-items: center;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 9999px; /* Full Rounded */
    padding: 10px 20px;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 600px; /* Max width on desktop */
    box-sizing: border-box;
}

body.light-mode .search-form {
    background-color: #ffffff;
    border-color: #e5e7eb;
}

.search-form:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.25); /* Purple Glow Focus */
}

.search-input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 16px;
    flex: 1; /* Fix overflow in flex container */
    min-width: 0;
    outline: none;
    border-radius: 0; /* Fix rounded corners otomatis di iOS */
    -webkit-appearance: none; /* Reset iOS style */
    appearance: none; /* Standard reset untuk browser modern */
    margin: 0; /* Reset margin bawaan browser */
}

body.light-mode .search-input {
    color: var(--text-primary);
}

/* Hapus tombol X default di Chrome search input */
.search-input::-webkit-search-decoration,
.search-input::-webkit-search-cancel-button,
.search-input::-webkit-search-results-button,
.search-input::-webkit-search-results-decoration {
    -webkit-appearance: none;
    display: none;
}

.search-button {
    background: none;
    border: none;
    color: #888;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    -webkit-appearance: none;
    appearance: none;
    margin-left: 10px;
}

.search-button:hover {
    color: var(--accent-primary);
}

/* Hamburger Menu */
.burger-menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-appearance: none;
    appearance: none;
}

body.light-mode .burger-menu-toggle {
    color: var(--text-primary);
}

.burger-menu-dropdown {
    display: none; /* Di-toggle oleh JS */
    position: absolute;
    top: 100%;
    right: 0;
    width: 260px;
    max-width: 90vw;
    max-height: 80vh; /* Scrollable jika konten terlalu panjang */
    overflow-y: auto;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    margin-top: 10px;
    z-index: 1001;
}

.menu-social {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    text-decoration: none;
    padding: 8px;
    border-radius: 6px;
    transition: background-color 0.2s;
    font-size: 14px;
}

.menu-item:hover {
    background-color: var(--bg-tertiary);
    color: var(--accent-primary);
}

/* Menu Profile Section */
.menu-profile-section {
    margin-bottom: 10px;
}

.menu-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 5px 10px;
    margin-bottom: 5px;
}

.menu-user-info img {
    border-radius: 50%;
    border: 2px solid var(--accent-primary);
}

.menu-user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: bold;
    font-size: 14px;
    color: var(--text-primary);
}

.menu-guest-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.menu-btn-full {
    flex: 1;
    text-align: center;
    padding: 8px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    transition: 0.2s;
}

.menu-btn-full:hover {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.menu-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 8px 0;
}

/* Mobile Header Adjustments */
@media (max-width: 768px) {
    .logo-text {
        font-size: 20px;
    }
    .search-form {
        padding: 8px 15px;
    }
    .search-input {
        font-size: 14px;
    }
}

/* Main Content Padding */
.site-content {
    padding-top: 140px; /* Adjusted for taller header (Top + Bottom + Padding) */
}



/* Content Tabs */
.content-tabs-nav {
    height: 44px; /* 40-44px range */
    background-color: var(--bg-secondary);
    overflow-x: auto;
    white-space: nowrap;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.content-tabs-nav::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.tabs-container {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 10px;
}

.tab-item {
    display: inline-block;
    padding: 0 15px;
    line-height: 44px;
    font-size: 14px; /* 13-14px range */
    color: var(--text-secondary);
    position: relative;
    text-decoration: none;
}

.tab-item.active {
    color: var(--text-primary);
    font-weight: 500;
}

.tab-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 15px;
    right: 15px;
    height: 3px;
    background-color: var(--accent-primary);
    border-radius: 2px;
}

/* Footer */
.site-footer {
    padding: 30px 0; /* 24-32px range */
    text-align: center;
    margin-top: 50px;
}

/* Mobile Menu */
.mobile-menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: block;
}

/* Featured Series */
.featured-series {
    margin-top: 30px;
}

.section-title {
    font-size: 17px; /* 16-17px range */
    font-weight: bold;
    margin-bottom: 15px;
}

.ranked-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ranked-list li {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.rank-number {
    font-weight: bold;
    color: var(--accent-primary);
    margin-right: 15px;
    width: 20px;
    text-align: center;
}

/* Footer adjustments */
.footer-content {
    display: flex;
    gap: 20px;
}

@media (max-width: 768px) {
    .footer-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px 20px;
    }
    .footer-links a, .copyright p {
        font-size: 12px;
    }
}

/*--------------------------------------------------------------
## Single Chapter Page (Mobile First)
--------------------------------------------------------------*/
.site-main.single-chapter {
    padding-top: 0; /* Header is fixed, content starts right below */
}

/* Breadcrumb */
.breadcrumb-nav {
    background-color: var(--bg-secondary);
    padding: 12px 0;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    margin-top: a {
    color: var(--accent-secondary);
    text-decoration: none;
}

.breadcrumb-nav a:hover {
    text-decoration: underline;
}

/* Chapter Header */
.chapter-header {
    background-color: var(--bg-primary);
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
}

.chapter-info {
    text-align: center;
}

.series-main-title-chapter-page {
    font-size: 24px; /* Large font for series title */
    font-weight: bold;
    margin-bottom: 10px;
    line-height: 1.3;
}

.series-main-title-chapter-page a {
    color: var(--text-primary);
    text-decoration: none;
}

.series-main-title-chapter-page a:hover {
    color: var(--accent-primary);
}

.chapter-meta-details {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px 10px;
}

.chapter-label {
    font-weight: 600;
    color: var(--accent-primary);
}

.chapter-author, .chapter-date {
    font-style: italic;
}

.chapter-nav {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.chapter-nav-btn {
    flex: 1 1 auto; /* Allow buttons to grow and shrink */
    min-width: 100px; /* Minimum width for buttons */
    padding: 10px 15px;
    font-size: 14px;
    text-align: center;
}

/* Chapter Content Images */
.chapter-content-images {
    padding: 0;
}

.chapter-image {
    margin-bottom: 0; /* No spacing between images */
}

.chapter-image img {
    width: 100%;
    height: auto; /* Maintain aspect ratio */
    display: block;
    border-radius: 0;
    margin: 0;
}

/* Share Button */
.chapter-share-area {
    text-align: center;
    margin: 30px 0;
}

.btn-share {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 16px;
    background-color: var(--accent-primary);
    color: #ffffff;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    transition: background-color 0.3s ease;
}

.btn-share:hover {
    background-color: var(--accent-secondary);
}

/* Suggested / Continue Reading */
.suggested-reading-area,
.related-series-area {
    margin-top: 40px;
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
}

.suggested-reading-area .section-title,
.related-series-area .section-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 20px;
    text-align: center;
}

.suggested-series-carousel {
    display: flex;
    overflow-x: auto;
    gap: 15px;
    padding-bottom: 15px; /* For scrollbar */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

.suggested-series-carousel::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.suggested-series-item {
    flex: 0 0 120px; /* Fixed width for each item */
    text-align: center;
}

.suggested-series-item a {
    display: block;
    color: var(--text-primary);
    text-decoration: none;
}

.suggested-series-item img {
    width: 100%;
    height: 120px; /* Square thumbnail */
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 8px;
}

.suggested-series-item .no-cover-thumb {
    width: 100%;
    height: 120px;
    background-color: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 8px;
}

.suggested-series-item .suggested-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.suggested-series-item .suggested-genre {
    font-size: 11px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 4px;
}

.suggested-series-item .suggested-rating .star-icon {
    color: gold; /* Active star color */
    width: 14px;
    height: 14px;
}

@media (max-width: 480px) {
    .series-main-title-chapter-page {
        font-size: 20px;
    }

    .chapter-meta-details {
        font-size: 12px;
    }

    .chapter-nav-btn {
        font-size: 13px;
        padding: 8px 10px;
    }

    .suggested-series-item {
        flex: 0 0 100px;
    }

    .suggested-series-item img,
    .suggested-series-item .no-cover-thumb {
        height: 100px;
    }

    .suggested-series-item .suggested-title {
        font-size: 13px;
    }

}

/*--------------------------------------------------------------
## Single Series Page (Mobile First)
--------------------------------------------------------------*/
.series-detail-page {
    padding-top: 24px;
    padding-bottom: 40px;
}

.series-title-area {
    margin-bottom: 16px;
}

.series-main-title {
    font-size: 26px; /* Font besar dan tebal */
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
}

.series-meta-actions {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}

.series-short-info {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
}

.series-short-info .info-item {
    font-size: 13px;
    color: var(--text-secondary);
    background-color: var(--bg-tertiary);
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.series-short-info .status-ongoing {
    color: #45d49c; /* Warna untuk status 'sedang berjalan' */
    border-color: #45d49c;
}

.series-short-info .status-completed {
    color: #a29bfe; /* Warna untuk status 'selesai' */
    border-color: #a29bfe;
}

body.light-mode .series-short-info .status-ongoing {
    color: #059669;
    border-color: #059669;
}

body.light-mode .series-short-info .status-completed {
    color: #7c3aed;
    border-color: #7c3aed;
}

.series-main-actions .btn-follow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 44px; /* Ukuran tombol mudah disentuh */
    font-size: 15px;
    font-weight: 600;
    background-color: var(--accent-primary);
    color: #ffffff;
    border: none;
}

.series-main-actions .btn-follow:hover {
    background-color: var(--accent-secondary);
}

.series-synopsis {
    margin-bottom: 24px;
}

.synopsis-content {
    font-size: 14px;
    line-height: 1.7; /* Jarak antar baris nyaman */
    color: var(--text-secondary);
}

.expandable-text {
    max-height: 100px; /* Batasi tinggi awal sinopsis */
    overflow: hidden;
    position: relative;
}

.expandable-text.expanded {
    max-height: none;
}

.read-more-btn {
    background: none;
    border: none;
    color: var(--accent-primary);
    font-weight: 600;
    cursor: pointer;
    padding: 8px 0;
    margin-top: 8px;
    display: none; /* Hide by default, JS will show it if needed */
}

.series-genres {
    margin-bottom: 32px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.series-genres a {
    display: inline-block;
    font-size: 12px;
    color: var(--text-secondary);
    background-color: var(--bg-tertiary);
    padding: 6px 12px;
    border-radius: 16px; /* Bentuk chip/label */
    border: 1px solid var(--border-color);
    text-decoration: none;
    transition: all 0.2s ease;
}

.series-genres a:hover {
    background-color: var(--accent-primary);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.series-rating-area {
    background-color: var(--bg-secondary);
    padding: 20px;
    border-radius: 12px;
}

.rating-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.rating-categories {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rating-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.rating-stars .star-icon {
    color: #444; /* Warna bintang non-aktif */
}

body.light-mode .rating-stars .star-icon {
    color: #d1d5db;
}

/* Account Page Styles */
.account-wrapper {
  min-height: 80vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.account-box {
  width: 360px;
  background: var(--bg-secondary, #fff);
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
}

.tabs {
  display: flex;
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  padding: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-weight: bold;
  opacity: .6;
  color: var(--text-primary);
}

.tab.active {
  opacity: 1;
  border-bottom: 2px solid var(--accent-primary, #ff4d4d);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.account-box input {
  width: 100%;
  padding: 10px;
  margin-bottom: 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color, #ddd);
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.account-box button {
  width: 100%;
  padding: 10px;
  background: var(--accent-primary, #ff4d4d);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
