/*
Theme Name: Manga Reader Theme
Description: A lightweight, production-ready WordPress theme for manga reading websites. Features a clean dark design with responsive layout and custom post type support for manga chapters.
Version: 1.0
Author: Your Name
Text Domain: manga-reader-theme
*/

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color, #1a1a1a);
    color: var(--text-color, #e0e0e0);
    line-height: 1.6;
    font-size: 16px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--heading-color, #ffffff);
    margin-bottom: 1rem;
    font-weight: 600;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
    margin-bottom: 1rem;
}

a {
    color: var(--accent-color, #4a9eff);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--accent-color, #4a9eff);
    filter: brightness(1.2);
}

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

/* Particles */
#tsparticles {
  position: fixed;
  width: 100%;
  height: 100%;
  z-index: -1;
  top: 0;
  left: 0;
}



/* Header */
.site-header {
    background-color: transparent;
    padding: 1rem 0;
    position: relative;
    z-index: 100;
}

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

.site-title {
    font-size: 1.8rem;
    font-weight: bold;
    color: #ffffff;
    display: none; /* Hide site title */
}

.site-title a {
    color: #ffffff;
}

.site-title a:hover {
    color: #4a9eff;
}

.main-navigation ul {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.main-navigation a {
    color: #e0e0e0;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.main-navigation a:hover {
    background-color: var(--accent-color, #4a9eff);
    color: var(--heading-color, #ffffff);
}

/* Main Content */
.site-main {
    padding: 2rem 0 2rem 0;
    min-height: calc(100vh - 200px);
}

/* Homepage Styles */
.manga-info {
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.manga-header {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.manga-cover {
    flex: 0 0 200px;
}

.manga-cover img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.manga-rating {
    text-align: center;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--accent-color, #4a9eff);
}

.manga-rating .rating {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.manga-rating .stars {
    display: flex;
    gap: 0.2rem;
}

.manga-rating .star {
    color: #ffd700;
    font-size: 1.2rem;
}

.manga-rating .star.empty {
    color: #666;
}

/* Hover glow on stars (within manga-rating) */
.manga-rating .stars .star {
    transition: text-shadow 0.2s ease;
}
.manga-rating .stars .star:hover {
    text-shadow: 0 0 6px #ffd700, 0 0 12px #ffd700;
}
.manga-rating .stars .star.half:hover .star-inner {
    text-shadow: 0 0 6px #ffd700, 0 0 12px #ffd700;
}

/* Half star support */
.manga-rating .star.half {
    position: relative;
    display: inline-block;
    color: #666; /* base as empty */
}
.manga-rating .star.half::before {
    content: '★';
    position: absolute;
    left: 0;
    top: 0;
    width: 50%;
    overflow: hidden;
    color: #ffd700;
}
.manga-rating .star.half .star-inner {
    position: absolute;
    left: 0;
    top: 0;
    width: 50%;
    overflow: hidden;
    color: #ffd700;
}

.manga-rating .rating-text {
    font-size: 1rem;
    font-weight: bold;
    color: var(--accent-color, #4a9eff);
}

.manga-details {
    flex: 1;
    min-width: 300px;
}

.manga-title {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--heading-color, #ffffff);
}

.manga-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.meta-label {
    font-size: 0.9rem;
    color: #a0a0a0;
    margin-bottom: 0.25rem;
}

.meta-value {
    font-weight: 500;
    color: #e0e0e0;
}

/* Mobile: Display meta items in a single line */
@media (max-width: 768px) {
	
	.site-header .container {
        flex-direction: column;
    }
	
    .manga-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 0.75rem;
        justify-content: space-evenly;
    }
    
    .meta-item {
        flex: 0 0 auto;
        min-width: 0;
    }
    
    .meta-label {
        font-size: 0.8rem;
        margin-bottom: 0.15rem;
    }
    
    .meta-value {
        font-size: 0.85rem;
    }
}

.rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stars {
    display: flex;
    gap: 2px;
}

.star {
    color: #ffd700;
    font-size: 1.2rem;
}

.star.empty {
    color: #555;
}

/* Generic hover glow on stars */
.stars .star {
    transition: text-shadow 0.2s ease;
}
.stars .star:hover {
    text-shadow: 0 0 6px #ffd700, 0 0 12px #ffd700;
}
.stars .star.half:hover .star-inner {
    text-shadow: 0 0 6px #ffd700, 0 0 12px #ffd700;
}

/* Half star support in generic stars */
.star.half {
    position: relative;
    display: inline-block;
    color: #555;
}
.star.half::before {
    content: '★';
    position: absolute;
    left: 0;
    top: 0;
    width: 50%;
    overflow: hidden;
    color: #ffd700;
}
.star.half .star-inner {
    position: absolute;
    left: 0;
    top: 0;
    width: 50%;
    overflow: hidden;
    color: #ffd700;
}

.genres {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.genre-tag {
    background-color: #4a9eff;
    color: #ffffff;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Mobile: Center genre tags */
@media (max-width: 768px) {
    .genres {
        justify-content: center;
    }
}

.synopsis {
    background-color: #1a1a1a;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #4a9eff;
    margin-top: 1.5rem;
}

.synopsis h3 {
    margin-bottom: 1rem;
    color: #4a9eff;
}

/* Chapter List */
.chapter-list {
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
}

/* Chapter Search */
.chapter-search {
    margin-bottom: 2rem;
}

.search-with-icon {
    position: relative;
}

.search-with-icon .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-text-color, #a0a0a0);
    pointer-events: none;
}

.search-with-icon .sort-inline {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    padding: 0;
}

.search-input {
    width: 100%;
    max-width: 100%;
    padding: 0.75rem 2.25rem 0.75rem 2.25rem;
    background-color: #1a1a1a;
    border: 2px solid #333;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #4a9eff;
}

.search-input::placeholder {
    color: #a0a0a0;
}

.no-results {
    text-align: center;
    padding: 2rem;
    color: #a0a0a0;
    font-style: italic;
    grid-column: 1 / -1;
}

/* Sort Button */
.sort-button {
    background-color: var(--accent-color, #4a9eff);
    color: #ffffff;
    border: none;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.sort-button:hover {
    background-color: var(--accent-color, #4a9eff);
    filter: brightness(0.9);
}

.sort-button.active {
    background-color: #ff6b6b;
}

.sort-icon {
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.sort-button.active .sort-icon {
    transform: rotate(180deg);
}

.chapter-list-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.chapter-list-header h2 {
    color: #ffffff;
    margin: 0;
}

.quick-links {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: nowrap;
    align-items: stretch;
	text-align:center;
}

.quick-link {
    background-color: var(--card-bg-color, #2d2d2d);
    color: var(--text-color, #e0e0e0);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color, #333);
}

.quick-link:hover {
    border-color: var(--accent-color, #4a9eff);
}

.chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

/* Quick link card layout */
.quick-link-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    width: auto;
    flex: 1 1 0;
}
.quick-link-card .ql-label {
    color: var(--secondary-text-color, #a0a0a0);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}
.quick-link-card .ql-number {
    color: var(--heading-color, #fff);
    font-size: 1.1rem;
}

.chapter-item {
    background-color: #1a1a1a;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #333;
    transition: all 0.3s ease;
}

.chapter-item:hover {
    border-color: #4a9eff;
    transform: translateY(-2px);
}

.chapter-item a {
    color: #e0e0e0;
    display: block;
}

.chapter-item h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.chapter-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.chapter-number {
    font-size: 0.9rem;
    color: #4a9eff;
    font-weight: 600;
}

.chapter-date {
    font-size: 0.85rem;
    color: #a0a0a0;
}

/* Single Chapter Page */
.chapter-header {
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}

.chapter-dropdown-container {
    width: 100%;
    max-width: 300px;
}

/* Report button next to dropdown */
.chapter-report-container {
    display: inline-flex;
    align-items: center;
    margin-left: 0.5rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.report-button {
    display: inline-flex;
    align-items: center;
    background-color:#b30000;
    color: var(--text-color, #e0e0e0);
    border: 1px solid var(--border-color, #333);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.report-button:hover {
    border-color: var(--accent-color, #4a9eff);
    filter: brightness(1.05);
}

/* Modal (theme-styled) */
#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
}

.modal {
    position: fixed;
    z-index: 1001;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    display: none;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.6);
}

/* Show modal when explicitly opened */
.modal.is-open {
    display: flex;
}

.modal-content {
    background-color: var(--bg-color, #1a1a1a);
    color: var(--text-color, #e0e0e0);
    border: 1px solid var(--border-color, #333);
    border-radius: 10px;
    width: 95%;
    max-width: 520px;
    padding: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.modal-header .close {
    cursor: pointer;
    font-size: 1.4rem;
    color: var(--secondary-text-color, #a0a0a0);
}

#reportForm select,
#reportForm textarea {
    width: 100%;
    background-color: var(--bg-color, #1a1a1a);
    color: var(--text-color, #e0e0e0);
    border: 1px solid var(--border-color, #333);
    border-radius: 8px;
    padding: 0.5rem;
    margin-top: 0.25rem;
}

#reportFormSubmit {
    margin-top: 0.75rem;
    background-color: var(--accent-color, #4a9eff);
    color: #fff;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    cursor: pointer;
}

#reportFormSubmit:hover {
    filter: brightness(0.95);
}

.chapter-navigation.top-nav {
    display: flex;
    width: 100%;
    gap: 1rem;
    justify-content: space-between;
}

.chapter-navigation.top-nav .nav-button {
    flex: 1;
    text-align: center;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background-color: var(--accent-color, #4a9eff);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    text-decoration: none;
    min-height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chapter-navigation.top-nav .nav-button:hover:not(.is-disabled) {
    background-color: var(--accent-color, #4a9eff);
    filter: brightness(0.9);
    transform: translateY(-1px);
}

.chapter-navigation.top-nav .nav-button.is-disabled {
    background-color: #555;
    color: #888;
    opacity: 0.6;
    cursor: not-allowed;
}

/* Desktop: Previous Chapter [Dropdown] Next Chapter */
@media (min-width: 769px) {
    .chapter-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .chapter-navigation-container {
        display: grid;
        grid-template-columns: auto 1fr auto auto;
        align-items: center;
        gap: 1rem;
        width: 100%;
    }
    
    .chapter-dropdown-container {
        width: 100%;
        max-width: 100%;
        grid-column: 2;
    }
    
    .chapter-navigation.top-nav {
        width: auto;
        gap: 1rem;
    }
    
    .chapter-navigation.top-nav .nav-button {
        flex: none;
        min-width: 120px;
    }

    .chapter-report-container {
        grid-column: 3;
        justify-self: end;
    }
}

/* Mobile: Hide top navigation, keep only dropdown */
@media (max-width: 768px) {
    .chapter-header {
        flex-direction: column;
        text-align: center;
    }
    
    .chapter-navigation-container {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: 0.75rem;
        width: 100%;
    }
    
    .chapter-dropdown-container {
        width: 100%;
        max-width: 100%;
        grid-column: 1;
    }
    
    .chapter-report-container {
        grid-column: 2;
        justify-self: end;
    }
    
    .chapter-navigation.top-nav {
        display: none;
    }
}

.chapter-title {
    font-size: 1.8rem;
    color: #ffffff;
}

.chapter-navigation {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-button {
    background-color: #4a9eff;
    color: #ffffff;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.nav-button:hover {
    background-color: #3a8eef;
}

.nav-button:disabled {
    background-color: #555;
    color: #888;
    cursor: not-allowed;
}

/* Bottom nav row: three buttons on one line */

.nav-button.is-disabled {
    background-color: #555;
    color: #888;
    pointer-events: none;
}

/* Mobile sticky navigation */
@media (max-width: 768px) {
    .chapter-navigation-bottom {
        position: fixed !important;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: rgba(45, 45, 45, 0.65);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        border-top: 2px solid var(--accent-color, #4a9eff);
        padding: 0;
        z-index: 1000;
        box-shadow: 0 -2px 15px rgba(0, 0, 0, 0.4);
    }
    
    .chapter-navigation-bottom .chapter-navigation {
        display: flex !important;
        flex-direction: row !important;
        width: 100% !important;
        margin: 0 !important;
        gap: 0 !important;
        align-items: stretch !important;
    }
    
    .chapter-navigation-bottom .nav-button {
        flex: 1 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0.75rem 0.5rem !important;
        font-size: 0.85rem !important;
        font-weight: bold !important;
        text-transform: uppercase !important;
        letter-spacing: 0.3px !important;
        background-color: transparent !important;
        color: var(--text-color, #e0e0e0) !important;
        border: none !important;
        border-right: 1px solid rgba(255, 255, 255, 0.2) !important;
        border-radius: 0 !important;
        transition: all 0.3s ease !important;
        min-height: 45px !important;
        text-decoration: none !important;
    }
    
    .chapter-navigation-bottom .nav-button:last-child {
        border-right: none !important;
    }
    
    .chapter-navigation-bottom .nav-button:hover:not(.is-disabled) {
        background-color: rgba(74, 158, 255, 0.3) !important;
        color: #ffffff !important;
        transform: none !important;
    }
    
    .chapter-navigation-bottom .nav-button.is-disabled {
        background-color: transparent !important;
        color: rgba(255, 255, 255, 0.4) !important;
        opacity: 0.6 !important;
    }
    
    /* Add bottom padding to main content to prevent overlap */
    .site-main {
        padding-bottom: 65px;
    }
}

.chapter-dropdown {
    background-color: #1a1a1a;
    color: #e0e0e0;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 0.5rem;
    width: 100%;
    min-width: 0;
}

.chapter-content {
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.chapter-content img {
    max-width: 100%;
    height: auto;
    display: block;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Footer */
.site-footer {
    padding: 1rem 0;
    text-align: center;
    margin-top: 3rem;
}

.site-footer p {
    color: #a0a0a0;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0px;
    }
    
    .manga-header {
        flex-direction: column;
        text-align: center;
    }
    
    .manga-cover {
        flex: none;
        max-width: 200px;
        margin: 0 auto;
    }
    
    .manga-title {
        font-size: 1.6rem;
    }
    
    .manga-meta {
        grid-template-columns: 1fr;
    }
    
    .chapter-header {
        flex-direction: column;
        text-align: center;
    }
    
    .chapter-navigation {
        flex-direction: column;
        width: 100%;
    }
    
    .chapter-dropdown {
        width: 100%;
    }
    
    .chapters-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-links {
        justify-content: center;
    }
    
    .chapter-list-header {
        flex-direction: column;
        align-items: flex-start;
        text-align: center;
    }
    
    .search-input {
        max-width: none;
    }
    
    .chapter-content {
        padding: 0;
    }
}

@media (max-width: 480px) {
    
    .manga-title {
        font-size: 1.5rem;
    }
    
    .chapter-title {
        font-size: 1.4rem;
    }
    
    .chapter-content {
        padding: 0;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }