/**
 * ============================================================
 * MANGAVERSE - Custom Styles
 * ============================================================
 * Premium dark theme with smooth animations
 * ============================================================
 */

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #404040;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #f97316;
}

/* Selection color */
::selection {
    background: rgba(249, 115, 22, 0.3);
    color: white;
}

/* Page loader fade out */
#page-loader.loaded {
    opacity: 0;
    pointer-events: none;
}

/* Manga card hover glow */
.manga-card {
    will-change: transform;
}

/* Reading progress bar */
.reading-progress {
    background: linear-gradient(90deg, #f97316 0%, #ea580c 100%);
}

/* Chapter image loading */
.chapter-img {
    background: linear-gradient(135deg, #1a1a1a 0%, #262626 100%);
    min-height: 200px;
}

.chapter-img.loaded {
    background: none;
    min-height: auto;
}

/* Sticky reader navigation */
.reader-nav {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Auto-scroll animation */
@keyframes autoScroll {
    from { scroll-top: 0; }
    to { scroll-top: 100%; }
}

.auto-scrolling {
    scroll-behavior: smooth;
}

/* Comment nested reply line */
.comment-reply-line {
    position: relative;
}

.comment-reply-line::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #333;
}

/* Emoji picker grid */
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
}

/* Skeleton loading animation */
@keyframes skeleton {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton {
    background: linear-gradient(90deg, #1a1a1a 25%, #262626 50%, #1a1a1a 75%);
    background-size: 200% 100%;
    animation: skeleton 1.5s infinite;
    border-radius: 8px;
}

/* Slider dots */
.slider-dot {
    transition: all 0.3s ease;
}

.slider-dot.active {
    width: 24px;
    background-color: #f97316;
}

/* Toast notification */
.toast {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.toast.hiding {
    animation: fadeOut 0.3s ease-out forwards;
}

/* Modal backdrop */
.modal-backdrop {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Hover line animation */
.hover-line {
    position: relative;
}

.hover-line::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: #f97316;
    transition: width 0.3s ease;
}

.hover-line:hover::after {
    width: 100%;
}

/* Image fade in */
.img-fade-in {
    animation: imgFadeIn 0.5s ease-out;
}

@keyframes imgFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Pulse dot for live indicator */
.pulse-dot {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Rating stars */
.star-filled { color: #fbbf24; }
.star-empty { color: #404040; }

/* Tooltip */
.tooltip {
    position: relative;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    padding: 4px 8px;
    background: #333;
    color: white;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.tooltip:hover::before {
    opacity: 1;
}

/* Focus styles */
*:focus-visible {
    outline: 2px solid #f97316;
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* Light mode overrides */
html.light body {
    background-color: #f5f5f5;
    color: #1a1a1a;
}

html.light .bg-dark-900 { background-color: #f5f5f5; }
html.light .bg-dark-800 { background-color: #ffffff; }
html.light .bg-dark-700 { background-color: #f0f0f0; }
html.light .text-gray-400 { color: #666666; }
html.light .text-gray-500 { color: #888888; }
html.light .text-gray-600 { color: #999999; }
html.light .text-gray-700 { color: #aaaaaa; }
html.light .border-gray-700 { border-color: #e0e0e0; }
html.light .border-gray-800 { border-color: #e8e8e8; }

/* Genre tag pills */
.genre-tag {
    @apply px-3 py-1.5 rounded-full text-xs font-medium bg-dark-800 border border-gray-700 hover:border-primary hover:text-primary transition cursor-pointer;
}

html.light .genre-tag {
    background: #f0f0f0;
    border-color: #ddd;
}

/* Active genre tag */
.genre-tag.active {
    @apply bg-primary text-white border-primary;
}

/* Chapter list item */
.chapter-item {
    @apply flex items-center justify-between p-3 rounded-lg hover:bg-dark-700/50 transition cursor-pointer border border-transparent hover:border-gray-700;
}

.chapter-item.read {
    @apply opacity-60;
}

/* Bookmark button */
.bookmark-btn {
    @apply p-2 rounded-lg transition;
}

.bookmark-btn.active {
    @apply text-orange-500 bg-orange-500/10;
}

.bookmark-btn:not(.active) {
    @apply text-gray-400 hover:text-orange-400 hover:bg-dark-700;
}

/* Reader controls */
.reader-control-btn {
    @apply p-2 rounded-lg bg-dark-800/80 hover:bg-dark-700 text-white transition backdrop-blur-sm;
}

/* Mobile optimizations */
@media (max-width: 640px) {
    .manga-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
    }
    
    .manga-grid .manga-card h3 {
        font-size: 11px;
    }
}

/* Tablet */
@media (min-width: 641px) and (max-width: 1024px) {
    .manga-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}
