/* ============================================
   Manga Atlas - Modern Homepage Styles
   ============================================ */

:root {
    /* Color Palette - Dark Theme */
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-card-hover: #1f3460;

    /* Accent Colors */
    --accent-primary: #e94560;
    --accent-secondary: #0f3460;
    --accent-gradient: linear-gradient(135deg, #e94560 0%, #0f3460 100%);
    --accent-glow: rgba(233, 69, 96, 0.3);

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6b6b80;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px var(--accent-glow);

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 30px;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================
   Hero Section
   ============================================ */

.hero {
    position: relative;
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(233, 69, 96, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(15, 52, 96, 0.2) 0%, transparent 50%),
        linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    z-index: 0;
}

.hero-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 800px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.logo-icon {
    font-size: 48px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.logo h1 {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, #e94560 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
}

.tagline {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 35px;
}

/* Hero Search */
.hero-search {
    margin-bottom: 40px;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 600px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    padding: 5px;
    transition: var(--transition-normal);
    backdrop-filter: blur(10px);
}

.search-wrapper:focus-within {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.search-icon {
    width: 20px;
    height: 20px;
    margin-left: 20px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.hero-search .search-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 15px;
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
}

.hero-search .search-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.search-btn:hover {
    background: #d63651;
    transform: scale(1.02);
}

/* Stats */
.stats {
    display: flex;
    justify-content: center;
    gap: 50px;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ============================================
   Container & Sections
   ============================================ */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.section {
    padding: 50px 0;
}

.section-header {
    margin-bottom: 30px;
}

.section-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
}

/* ============================================
   Hot Manga Grid
   ============================================ */

.hot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.hot-card {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-normal);
}

.hot-card:hover {
    transform: translateY(-8px);
}

.hot-image-wrapper {
    position: relative;
    aspect-ratio: 3/4;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.hot-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-normal);
}

.hot-card:hover .hot-image {
    transform: scale(1.08);
}

.hot-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 10px 10px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
}

.hot-chapters {
    font-size: 0.75rem;
    color: var(--accent-primary);
    font-weight: 600;
}

.hot-info {
    padding: 12px 5px;
}

.hot-title {
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

/* ============================================
   Manga Grid
   ============================================ */

.manga-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 25px;
    margin: 30px 0;
}

.manga-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-sm);
}

.manga-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    background: var(--bg-card-hover);
}

.manga-image-wrapper {
    position: relative;
    aspect-ratio: 3/4;
    overflow: hidden;
}

.manga-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-normal);
}

.manga-card:hover .manga-cover {
    transform: scale(1.05);
}

.manga-cover-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}

.manga-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: var(--accent-primary);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(5px);
}

.manga-info {
    padding: 15px;
}

.manga-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 8px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.manga-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.manga-update {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ============================================
   Pagination
   ============================================ */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 20px 0;
}

.page-link {
    padding: 10px 18px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition-fast);
}

.page-link:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.page-input-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-input {
    width: 60px;
    padding: 10px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-primary);
    outline: none;
}

.page-input:focus {
    border-color: var(--accent-primary);
}

.page-total {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.page-go-btn {
    padding: 10px 18px;
    background: var(--accent-primary);
    border: none;
    border-radius: var(--radius-lg);
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.page-go-btn:hover {
    background: #d63651;
}

/* ============================================
   Footer
   ============================================ */

.footer {
    background: var(--bg-secondary);
    padding: 50px 20px;
    margin-top: 50px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-brand {
    margin-bottom: 25px;
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: 700;
}

.footer-brand p {
    color: var(--text-muted);
    margin-top: 8px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition-fast);
}

.footer-links a:hover {
    color: var(--accent-primary);
}

.footer-copyright {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    .hero {
        min-height: 45vh;
        padding: 40px 15px;
    }

    .logo-icon {
        font-size: 36px;
    }

    .tagline {
        font-size: 1rem;
    }

    .stats {
        gap: 30px;
    }

    .stat-number {
        font-size: 1.4rem;
    }

    .hot-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
    }

    .manga-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .section-header h2 {
        font-size: 1.4rem;
    }

    .search-wrapper {
        flex-direction: column;
        border-radius: var(--radius-md);
        padding: 10px;
    }

    .search-icon {
        display: none;
    }

    .hero-search .search-input {
        width: 100%;
        text-align: center;
    }

    .search-btn {
        width: 100%;
        margin-top: 10px;
    }
}

@media (max-width: 480px) {
    .hot-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .manga-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .pagination {
        gap: 5px;
    }

    .page-link {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}

/* ============================================
   Mobile-Specific Styles (Touch Optimized)
   ============================================ */

body.is-mobile {
    /* Prevent text sel: none;
    user-select: none;

    /* Prevent pull-to-refresh */
    overscroll-behavior-y: contain;
}

/* Hide Popular Manga section on mobile */
body.is-mobile .hot-section {
    display: none;
}

@media (max-width: 768px) {
    .hot-section {
        display: none;
    }
}

body.is-mobile .manga-card,
body.is-mobile .hot-card {
    /* Larger touch targets */
    min-height: 48px;

    /* Remove hover effects on mobile */
    transform: none !important;
}

body.is-mobile .manga-card:active,
body.is-mobile .hot-card:active {
    /* Touch feedback */
    background: var(--bg-card-hover);
    transform: scale(0.98) !important;
}

body.is-mobile .search-btn {
    /* Larger touch target */
    min-height: 48px;
    font-size: 1.1rem;
}

body.is-mobile .page-link {
    /* Larger touch targets for pagination */
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.is-mobile .chapter-item {
    /* Larger chapter buttons */
    min-height: 48px;
    font-size: 1rem;
}

/* Floating action button style for mobile navigation */
body.is-mobile .scroll-top {
    width: 56px;
    height: 56px;
    font-size: 1.5rem;
}

/* Improve tap target for manga info */
body.is-mobile .manga-info {
    padding: 18px 15px;
}

/* Safe area for notched phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    body.is-mobile .footer {
        padding-bottom: calc(50px + env(safe-area-inset-bottom));
    }

    body.is-mobile .bottom-nav {
        padding-bottom: calc(25px + env(safe-area-inset-bottom));
    }
}