/* ReadFun - Main Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #ec4899;
    --accent: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e1e2e;
    --darker: #181825;
    --darkest: #11111b;
    --light: #cdd6f4;
    --muted: #6c7086;
    --surface: #313244;
    --surface-light: #45475a;
    --gradient-1: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
    --gradient-2: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    --shadow: 0 4px 20px rgba(0,0,0,0.3);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Prompt', sans-serif;
    background: var(--darker);
    color: var(--light);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--secondary);
}

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

/* Header/Navbar */
.navbar {
    background: var(--darkest);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--surface);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-search {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.nav-search input {
    width: 100%;
    padding: 12px 20px 12px 45px;
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: 25px;
    color: var(--light);
    font-size: 0.95rem;
    transition: var(--transition);
}

.nav-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.nav-search i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 25px;
    list-style: none;
}

.nav-links a {
    color: var(--light);
    font-weight: 500;
    padding: 8px 0;
    position: relative;
}

.nav-links a:hover {
    color: var(--primary-light);
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--gradient-1);
    border-radius: 2px;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-user .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--gradient-1);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--surface);
    color: var(--light);
    border: 1px solid var(--surface-light);
}

.btn-secondary:hover {
    background: var(--surface-light);
}

.btn-outline {
    background: transparent;
    color: var(--primary-light);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.1rem;
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

/* Manga Card */
.manga-card {
    position: relative;
}

.manga-card .cover {
    aspect-ratio: 3/4;
    overflow: hidden;
}

.manga-card .cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.manga-card:hover .cover img {
    transform: scale(1.05);
}

.manga-card .badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 10px;
    background: var(--primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
}

.manga-card .badge.new {
    background: var(--success);
}

.manga-card .badge.hot {
    background: var(--danger);
}

.manga-card .info {
    padding: 15px;
}

.manga-card .title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--light);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
}

.manga-card .meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--muted);
}

.manga-card .meta i {
    margin-right: 4px;
}

.manga-card .chapter {
    font-size: 0.85rem;
    color: var(--primary-light);
    margin-top: 8px;
}

/* Manga Grid */
.manga-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title i {
    color: var(--primary);
}

.view-all {
    color: var(--muted);
    font-size: 0.9rem;
}

.view-all:hover {
    color: var(--primary-light);
}

/* Hero Section */
.hero {
    background: var(--gradient-2);
    padding: 60px 0;
    margin-bottom: 40px;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.hero p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 25px;
}

/* Translator Card */
.translator-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.translator-card:hover {
    background: var(--surface-light);
}

.translator-card .avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.translator-card .name {
    font-weight: 600;
    color: var(--light);
}

.translator-card .followers {
    font-size: 0.85rem;
    color: var(--muted);
}

.translator-card .rank {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-1);
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.85rem;
    margin-right: 10px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--light);
}

.form-control {
    width: 100%;
    padding: 14px 18px;
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: var(--radius-sm);
    color: var(--light);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236c7086' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    padding-right: 45px;
}

/* Auth Box */
.auth-container {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-box {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 40px;
}

.auth-box h2 {
    text-align: center;
    margin-bottom: 10px;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-box .subtitle {
    text-align: center;
    color: var(--muted);
    margin-bottom: 30px;
}

.auth-box .divider {
    text-align: center;
    color: var(--muted);
    margin: 25px 0;
    position: relative;
}

.auth-box .divider::before,
.auth-box .divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--surface-light);
}

.auth-box .divider::before { left: 0; }
.auth-box .divider::after { right: 0; }

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid var(--success);
    color: var(--success);
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--danger);
    color: var(--danger);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid var(--warning);
    color: var(--warning);
}

/* Tags/Genres */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    display: inline-block;
    padding: 5px 12px;
    background: var(--surface-light);
    color: var(--light);
    border-radius: 20px;
    font-size: 0.8rem;
    transition: var(--transition);
}

.tag:hover {
    background: var(--primary);
    color: white;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
}

.pagination a,
.pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--surface);
    color: var(--light);
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: var(--transition);
}

.pagination a:hover,
.pagination span.active {
    background: var(--primary);
    color: white;
}

/* Footer */
.footer {
    background: var(--darkest);
    padding: 50px 0 30px;
    margin-top: 60px;
    border-top: 1px solid var(--surface);
}

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

.footer-col h4 {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: var(--light);
}

.footer-col a {
    display: block;
    color: var(--muted);
    margin-bottom: 10px;
}

.footer-col a:hover {
    color: var(--primary-light);
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid var(--surface);
    color: var(--muted);
}

/* Manga Detail Page */
.manga-detail {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.manga-detail .cover-wrapper {
    position: sticky;
    top: 100px;
}

.manga-detail .cover {
    width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.manga-detail .info h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.manga-detail .alt-title {
    color: var(--muted);
    margin-bottom: 20px;
}

.manga-detail .stats {
    display: flex;
    gap: 25px;
    margin-bottom: 20px;
}

.manga-detail .stat {
    text-align: center;
}

.manga-detail .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-light);
}

.manga-detail .stat-label {
    font-size: 0.85rem;
    color: var(--muted);
}

.manga-detail .actions {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
}

.manga-detail .description {
    color: var(--light);
    margin-bottom: 25px;
    line-height: 1.8;
}

/* Chapter List */
.chapter-list {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
}

.chapter-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--surface-light);
    transition: var(--transition);
}

.chapter-item:hover {
    background: var(--surface-light);
}

.chapter-item:last-child {
    border-bottom: none;
}

.chapter-item .chapter-title {
    font-weight: 500;
    color: var(--light);
}

.chapter-item .chapter-meta {
    font-size: 0.85rem;
    color: var(--muted);
}

/* Reader */
.reader {
    background: var(--darkest);
    min-height: 100vh;
}

.reader-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--dark);
    position: sticky;
    top: 0;
    z-index: 100;
}

.reader-images {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.reader-images img {
    width: 100%;
    display: block;
    margin-bottom: 5px;
}

/* Dashboard */
.dashboard {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: calc(100vh - 80px);
}

.sidebar {
    background: var(--darkest);
    padding: 30px 20px;
    border-right: 1px solid var(--surface);
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: var(--light);
    border-radius: var(--radius-sm);
    margin-bottom: 5px;
    transition: var(--transition);
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: var(--surface);
    color: var(--primary-light);
}

.sidebar-menu i {
    width: 20px;
}

.dashboard-content {
    padding: 30px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--surface);
    padding: 25px;
    border-radius: var(--radius);
}

.stat-card .icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-1);
    border-radius: 12px;
    font-size: 1.3rem;
    margin-bottom: 15px;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--light);
}

.stat-card .label {
    color: var(--muted);
}

/* Table */
.table-wrapper {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 15px;
    text-align: left;
}

th {
    background: var(--surface-light);
    font-weight: 600;
    color: var(--light);
}

td {
    border-bottom: 1px solid var(--surface-light);
}

tr:hover td {
    background: rgba(99, 102, 241, 0.05);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--surface-light);
}

.modal-header h3 {
    font-size: 1.2rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--surface-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 5px;
    background: var(--surface);
    padding: 5px;
    border-radius: var(--radius-sm);
    margin-bottom: 25px;
}

.tab {
    padding: 12px 25px;
    background: transparent;
    border: none;
    color: var(--muted);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.tab:hover {
    color: var(--light);
}

.tab.active {
    background: var(--primary);
    color: white;
}

/* Rating Stars */
.stars {
    display: flex;
    gap: 3px;
}

.stars i {
    color: var(--warning);
}

.stars i.empty {
    color: var(--surface-light);
}

/* Loading Spinner */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--surface-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 1024px) {
    .manga-detail {
        grid-template-columns: 1fr;
    }
    
    .manga-detail .cover-wrapper {
        position: static;
        max-width: 280px;
        margin: 0 auto;
    }
    
    .dashboard {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .navbar .container {
        flex-wrap: wrap;
    }
    
    .nav-search {
        order: 3;
        max-width: 100%;
        width: 100%;
        margin-top: 15px;
    }
    
    .nav-links {
        display: none;
    }
    
    .hero h1 {
        font-size: 1.8rem;
    }
    
    .manga-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--muted); }
.text-primary { color: var(--primary-light); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }
.mb-4 { margin-bottom: 40px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }

.d-flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 10px; }
.gap-2 { gap: 20px; }

.w-100 { width: 100%; }

.hidden { display: none; }
