/*
Theme Name: TojiMangas Theme
Theme URI: https://tojimangas.com
Author: EasTheme Team
Author URI: https://eastheme.com
Description: A customized version of ZenithStream for TojiMangas.com. Child theme of EastManga.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Template: eastmanga
Text Domain: toji-zenith
*/

/* ==========================================
   CSS Custom Properties (Design Tokens)
   ========================================== */
:root {
    /* Colors - Slate Palette */
    --color-slate-50: #f8fafc;
    --color-slate-100: #f1f5f9;
    --color-slate-200: #e2e8f0;
    --color-slate-300: #cbd5e1;
    --color-slate-400: #94a3b8;
    --color-slate-500: #64748b;
    --color-slate-700: #334155;
    --color-slate-800: #1e293b;
    --color-slate-900: #0f172a;
    --color-slate-950: #020617;

    /* Accent Colors */
    --color-blue-400: #60a5fa;
    --color-blue-500: #3b82f6;
    --color-blue-600: #2563eb;
    --color-amber-400: #fbbf24;
    --color-amber-500: #f59e0b;
    --color-emerald-400: #34d399;
    --color-emerald-500: #10b981;
    --color-pink-500: #ec4899;
    --color-pink-600: #db2777;

    /* Typography */
    --font-family: 'Inter', sans-serif;

    /* Spacing */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-3xl: 2rem;
    --radius-full: 9999px;
}

/* ==========================================
   Base Styles
   ========================================== */
body {
    font-family: var(--font-family);
    background-color: var(--color-slate-900);
    color: var(--color-slate-50);
    overflow-x: hidden;
    line-height: 1.5;
}

/* ==========================================
   Custom Scrollbar
   ========================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-slate-800);
}

::-webkit-scrollbar-thumb {
    background: var(--color-blue-500);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-blue-600);
}

/* ==========================================
   Utility Classes
   ========================================== */
.aspect-card {
    aspect-ratio: 2 / 3;
}

.aspect-video-custom {
    aspect-ratio: 16 / 9;
}

.gradient-overlay {
    background: linear-gradient(to top, rgba(15, 23, 42, 1) 0%, rgba(15, 23, 42, 0.4) 100%);
}

.hidden-view {
    display: none !important;
}

.transition-all-custom {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-4 {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==========================================
   Filter Tags States
   ========================================== */
.filter-tag {
    padding: 0.375rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid var(--color-slate-700);
    color: var(--color-slate-400);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.filter-tag:hover {
    color: var(--color-slate-200);
    border-color: var(--color-slate-500);
}

.filter-tag.active {
    background-color: var(--color-blue-600);
    color: white;
    border-color: var(--color-blue-500);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.home-filter {
    padding: 0.375rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.6875rem;
    font-weight: 700;
    border: 1px solid var(--color-slate-700);
    color: var(--color-slate-500);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.home-filter:hover {
    color: var(--color-slate-300);
    border-color: var(--color-slate-500);
}

.home-filter.active {
    background-color: var(--color-blue-500);
    color: white;
    border-color: var(--color-blue-500);
}

/* ==========================================
   Navigation
   ========================================== */
.nav-link {
    color: var(--color-slate-400);
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: var(--color-slate-200);
}

.nav-link.active {
    color: white;
    border-bottom-color: var(--color-blue-500);
}

/* ==========================================
   Hero Slider
   ========================================== */
.slide-enter {
    opacity: 0;
    transform: translateY(20px);
}

.slide-active {
    opacity: 1;
    transform: translateY(0);
}

.slide-bg-active {
    opacity: 1;
    transform: scale(1.05);
}

.slide-bg-inactive {
    opacity: 0;
    transform: scale(1);
}

.hero-transition {
    transition: all 0.7s ease-in-out;
}

/* ==========================================
   Card Styles
   ========================================== */
.manga-card {
    position: relative;
    border-radius: var(--radius-2xl);
    overflow: hidden;
    border: 1px solid var(--color-slate-800);
    transition: all 0.3s ease;
    cursor: pointer;
}

.manga-card:hover {
    border-color: var(--color-blue-500);
    transform: translateY(-4px);
}

.manga-card:hover .manga-card-img {
    transform: scale(1.1);
}

.manga-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s ease;
}

.manga-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(2, 6, 23, 0.9) 0%, transparent 60%);
}

.manga-card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
}

/* ==========================================
   Chapter List
   ========================================== */
.chapter-btn {
    background: var(--color-slate-800);
    border: 1px solid var(--color-slate-700);
    padding: 0.75rem;
    border-radius: var(--radius-xl);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-slate-300);
    transition: all 0.2s ease;
    cursor: pointer;
}

.chapter-btn:hover {
    background: var(--color-slate-700);
    color: white;
    border-color: var(--color-slate-500);
}

/* ==========================================
   Reader Styles
   ========================================== */
.reader-image {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    display: block;
}

/* ==========================================
   Glassmorphism
   ========================================== */
.glass {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* ==========================================
   Type Badges
   ========================================== */
.badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-md);
    font-size: 0.5625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-manga {
    background: var(--color-blue-600);
    color: white;
}

.badge-manhwa {
    background: var(--color-emerald-500);
    color: white;
}

.badge-manhua {
    background: var(--color-amber-500);
    color: var(--color-slate-900);
}

.badge-anime {
    background: var(--color-pink-500);
    color: white;
}

.badge-novel {
    background: var(--color-slate-500);
    color: white;
}

.badge-movie {
    background: var(--color-blue-500);
    color: white;
}

/* ==========================================
   Buttons
   ========================================== */
.btn-primary {
    background: var(--color-blue-600);
    color: white;
    font-weight: 700;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-xl);
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    background: var(--color-blue-500);
}

.btn-secondary {
    background: var(--color-slate-800);
    border: 1px solid var(--color-slate-700);
    color: var(--color-slate-200);
    font-weight: 700;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-xl);
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--color-slate-700);
}

/* ==========================================
   Form Elements
   ========================================== */
.input-field {
    background: var(--color-slate-800);
    border: 1px solid var(--color-slate-700);
    border-radius: var(--radius-xl);
    padding: 0.75rem 1rem;
    color: var(--color-slate-200);
    font-size: 0.875rem;
    outline: none;
    transition: all 0.2s ease;
}

.input-field:focus {
    border-color: var(--color-blue-500);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.input-field::placeholder {
    color: var(--color-slate-500);
}

.select-field {
    background: var(--color-slate-800);
    border: 1px solid var(--color-slate-700);
    border-radius: var(--radius-xl);
    padding: 0.5rem 2rem 0.5rem 1rem;
    color: var(--color-slate-200);
    font-size: 0.75rem;
    font-weight: 700;
    outline: none;
    appearance: none;
    cursor: pointer;
}

/* ==========================================
   Modals
   ========================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.9);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-backdrop.open {
    display: flex;
}

.modal-content {
    background: var(--color-slate-900);
    border-radius: var(--radius-3xl);
    border: 1px solid var(--color-slate-800);
    max-width: 64rem;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* ==========================================
   Comments
   ========================================== */
.comment-card {
    background: var(--color-slate-800);
    padding: 1rem;
    border-radius: var(--radius-2xl);
    border: 1px solid var(--color-slate-700);
}

.comment-user {
    font-weight: 700;
    color: var(--color-blue-400);
    font-size: 0.875rem;
}

.comment-time {
    font-size: 0.5625rem;
    color: var(--color-slate-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.comment-text {
    color: var(--color-slate-200);
    font-size: 0.875rem;
    line-height: 1.625;
}

/* ==========================================
   Rating
   ========================================== */
.rating-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(251, 191, 36, 0.1);
    color: var(--color-amber-400);
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 700;
}

/* ==========================================
   Empty States
   ========================================== */
.empty-state {
    padding: 4rem 2rem;
    text-align: center;
    background: rgba(15, 23, 42, 0.5);
    border-radius: var(--radius-3xl);
    border: 2px dashed var(--color-slate-800);
    color: var(--color-slate-500);
}

/* ==========================================
   Responsive Grids
   ========================================== */
.manga-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (min-width: 640px) {
    .manga-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }
}

@media (min-width: 768px) {
    .manga-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1024px) {
    .manga-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 1.5rem;
    }
}

@media (min-width: 1280px) {
    .manga-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* Chapter Grid */
.chapter-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .chapter-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .chapter-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ==========================================
   Container
   ========================================== */
.container-zenith {
    max-width: 80rem;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .container-zenith {
        padding: 0 1.5rem;
    }
}

/* ==========================================
   Section Headers
   ========================================== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.section-icon {
    padding: 0.5rem;
    background: rgba(37, 99, 235, 0.2);
    border-radius: var(--radius-xl);
    color: var(--color-blue-500);
}

.section-link {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-blue-500);
    transition: color 0.2s ease;
}

.section-link:hover {
    color: var(--color-blue-400);
}

/* ==========================================
   Toast Notifications
   ========================================== */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--color-slate-800);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-xl);
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 9999;
    border: 1px solid var(--color-slate-700);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: var(--color-emerald-500);
    border-color: var(--color-emerald-400);
}

.toast.error {
    background: #ef4444;
    border-color: #f87171;
}

.toast.info {
    background: var(--color-blue-600);
    border-color: var(--color-blue-500);
}

/* ==========================================
   User Levels (Premium)
   ========================================== */
.user-level-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: 0.5rem;
    line-height: 1;
    color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    vertical-align: middle;
}

/* Shine effect on badges */
.user-level-badge::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.user-level-badge:hover::after {
    left: 100%;
}

.level-novice {
    background: linear-gradient(135deg, #475569, #334155);
    color: #cbd5e1;
    border-color: #475569;
}

.level-apprentice {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.2);
}

.level-otaku {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.2);
}

.level-veteran {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.2);
    color: white;
}

.level-sensei {
    background: linear-gradient(135deg, #ec4899, #db2777);
    box-shadow: 0 2px 15px rgba(236, 72, 153, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.level-legend {
    background: linear-gradient(135deg, #8b5cf6, #d946ef, #f43f5e);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
    animation: gradient-shift 3s ease infinite;
    background-size: 200% 200%;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* ==========================================
   Threaded Comments (Enhanced)
   ========================================== */
.comment-list .children {
    position: relative;
    margin-top: 1.5rem;
    padding-left: 1.5rem;
}

/* Curved connector line */
.comment-list .children::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--color-slate-700) 0%, var(--color-slate-700) 80%, transparent 100%);
    border-radius: 2px;
}

/* Hover effect on thread line */
.comment-list .children:hover::before {
    background: linear-gradient(to bottom, var(--color-blue-500) 0%, var(--color-blue-600) 80%, transparent 100%);
}

.comment-list .children .comment-body {
    position: relative;
}

/* Horizontal connector */
.comment-list .children .comment-body::before {
    content: '';
    position: absolute;
    top: 2rem;
    left: -1.5rem;
    width: 1rem;
    height: 2px;
    background: var(--color-slate-700);
}

.comment-list .children:hover .comment-body::before {
    background: var(--color-blue-500);
}

/* Comment Body Styles */
.comment-body {
    background: rgba(30, 41, 59, 0.3);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.comment-body:hover {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.3);
}

/* Mobile adjustments */
@media (max-width: 640px) {
    .comment-list .children {
        padding-left: 1rem;
        margin-top: 1rem;
    }

    .comment-list .children .comment-body::before {
        left: -1rem;
        width: 0.75rem;
    }
}

@media (min-width: 1024px) {
    .reader-settings-panel {
        top: 4.5rem;
    }
}

/* ==========================================
   Reader Enhancements
   ========================================== */

/* Progress Bar */
.reading-progress-container {
    transition: transform 0.3s ease;
}

/* Sidebar */
#reader-sidebar {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#reader-sidebar.open {
    transform: translateX(0);
}

.sidebar-chapter-item.active {
    background-color: rgba(37, 99, 235, 0.1);
    border-left: 3px solid #2563eb;
}

/* Settings Panel */
#reader-settings {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

#reader-settings.open {
    transform: translateX(0);
}

.mode-btn.active {
    background-color: var(--color-blue-600);
    border-color: var(--color-blue-500);
}

.mode-btn.active span {
    color: white !important;
}

/* Fit Width Toggle */
#toggle-fit-width.active {
    background-color: var(--color-blue-500);
}

#toggle-fit-width.active span {
    transform: translateX(1.25rem);
}

/* Reader Content - Fit Width Logic */
#reader-content.fit-width {
    max-width: 100% !important;
    padding-left: 0;
    padding-right: 0;
}

/* Paged Mode */
.reader-mode-paged .reader-page {
    display: none;
}

.reader-mode-paged .reader-page.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Paged Mode overlay navigation */
.reader-mode-paged #paged-nav-overlay {
    display: grid;
}

.reader-mode-paged #paged-controls {
    display: flex;
}

.reader-mode-paged .reading-progress-bar {
    background-color: var(--color-emerald-500);
}

/* Hide normal scroll in paged mode if desired, but usually keeping it is safer */

/* Mobile adjustments */
@media (max-width: 768px) {
    #reader-sidebar {
        width: 85%;
        max-width: 300px;
    }
}

/* ==========================================
   Comment Toolbar
   ========================================== */
.zenith-comment-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--color-slate-700);
    border-bottom: none;
    border-radius: 0.75rem 0.75rem 0 0;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.375rem;
    color: var(--color-slate-400);
    transition: all 0.2s;
}

.toolbar-btn:hover {
    background: var(--color-slate-700);
    color: var(--color-blue-400);
}

.zenith-spoiler {
    background: var(--color-slate-700);
    color: transparent;
    border-radius: 4px;
    padding: 0 4px;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s;
    filter: blur(4px);
}

.zenith-spoiler.revealed {
    background: transparent;
    color: inherit;
    filter: none;
    user-select: text;
}

/* GIF Modal */
#gif-modal {
    z-index: 9999;
}

#gif-results {
    scrollbar-width: thin;
    scrollbar-color: var(--color-slate-700) var(--color-slate-900);
}

.gif-result-item {
    transition: all 0.2s;
}

.gif-result-item:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}


/* Rating Widget */
.zenith-rating-widget .star-btn span {
    transition: font-variation-settings 0.2s ease;
}

.zenith-rating-widget:hover .star-btn span {
    font-variation-settings: 'FILL' 0;
}