/**
 * DETAIL PAGE STYLES
 * Styles pour la page de détail manga/manhua
 */

/* ==================== CONTAINER ==================== */
.detail-page-container {
    padding-top: var(--space-xl);
    padding-bottom: var(--space-3xl);
    position: relative;
}

/* ==================== BACK NAVIGATION ==================== */
.detail-nav-top {
    margin-bottom: var(--space-xl);
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 12px 24px;
    background: linear-gradient(145deg, var(--color-bg-secondary), var(--color-bg-elevated));
    border: 2px solid transparent;
    background-clip: padding-box;
    position: relative;
    border-radius: var(--radius-lg);
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all var(--transition-base);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-back::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    padding: 2px;
    background: linear-gradient(135deg, var(--color-purple-primary), var(--color-pink-primary));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.btn-back:hover {
    background: linear-gradient(145deg, var(--color-bg-elevated), var(--color-bg-card));
    color: var(--color-text-primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.3);
    border-color: rgba(139, 92, 246, 0.5);
}

.btn-back:hover::before {
    opacity: 1;
}

.btn-back .icon {
    width: 20px;
    height: 20px;
    transition: transform var(--transition-base);
}

.btn-back:hover .icon {
    transform: translateX(-3px);
}

/* ==================== HEADER SECTION ==================== */
.detail-header {
    display: flex;
    gap: var(--space-xl);
    margin-bottom: var(--space-2xl);
    position: relative;
    align-items: flex-start;
    /* Ensure top alignment for all 3 columns */
}

.detail-bg-glow {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ==================== COVER IMAGE ==================== */
.detail-cover-wrapper {
    flex-shrink: 0;
    z-index: 1;
}

.detail-cover {
    width: 280px;
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: var(--color-bg-secondary);
    box-shadow:
        8px 8px 20px rgba(0, 0, 0, 0.4),
        -4px -4px 15px rgba(255, 255, 255, 0.03);
}

.detail-image {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    display: block;
}

.mock-cover-detail {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* ==================== INFO SECTION ==================== */
.detail-info {
    flex: 1;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.detail-meta-top {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.badge-status-pill {
    padding: 6px 14px;
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-purple-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-type {
    background: rgba(236, 72, 153, 0.2);
    border-color: rgba(236, 72, 153, 0.4);
    color: var(--color-pink-primary);
}

.detail-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: var(--space-md);
    line-height: 1.2;
}

/* ==================== GENRES ==================== */
.detail-genres {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.genre-tag {
    padding: 6px 14px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    transition: all var(--transition-fast);
}

.genre-tag:hover {
    background: var(--color-bg-card);
    color: var(--color-text-primary);
    border-color: var(--color-purple-primary);
}

/* ==================== STATS ==================== */
.detail-stats {
    display: flex;
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.stat-item .icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

/* ==================== ACTIONS ==================== */
.detail-actions {
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
    flex-wrap: wrap;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn-chat {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
}

.btn-chat .icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

/* ==================== FAVORITE BUTTON ==================== */
.btn-icon {
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-favorite {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
}

.btn-favorite:hover {
    background: var(--color-bg-elevated);
    border-color: var(--color-pink-primary);
    transform: scale(1.1);
}

.btn-favorite .heart-icon {
    width: 24px;
    height: 24px;
    transition: all var(--transition-base);
}

.btn-favorite .heart-outline {
    color: var(--color-text-secondary);
}

.btn-favorite .heart-solid {
    display: none;
    color: var(--color-pink-primary);
}

.btn-favorite.liked .heart-outline {
    display: none;
}

.btn-favorite.liked .heart-solid {
    display: block;
    animation: heartPop 0.4s ease;
}

.btn-favorite.liked {
    background: rgba(236, 72, 153, 0.15);
    border-color: var(--color-pink-primary);
}

@keyframes heartPop {
    0% {
        transform: scale(0.8);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

/* ==================== TABS ==================== */
.detail-tabs-container {
    margin-bottom: var(--space-lg);
    display: flex;
    justify-content: center;
}

.detail-tabs {
    display: inline-flex;
    gap: var(--space-sm);
    background: var(--color-bg-secondary);
    padding: var(--space-xs);
    border-radius: var(--radius-full);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    min-width: 400px;
    justify-content: center;
}

.tab-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 24px;
    background: transparent;
    border: none;
    border-radius: var(--radius-full);
    color: var(--color-text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    flex: 1;
}

.tab-link:hover {
    background: var(--color-bg-elevated);
    color: var(--color-text-primary);
}

.tab-link.active {
    background: var(--gradient-purple-pink);
    color: white;
    box-shadow: var(--shadow-purple);
}

.tab-icon {
    display: flex;
    align-items: center;
}

.tab-icon .icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

/* ==================== TAB CONTENT ==================== */
.detail-content-wrapper {
    min-height: 300px;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollable chapters container */
/* Scrollable chapters container */
.scrollable-chapters {
    max-height: 280px;
    /* Desktop: ~4 rows (12 items) */
    overflow-y: auto;
    padding-right: var(--space-sm);
    margin-top: var(--space-sm);
}

.chapters-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
}

@media (max-width: 768px) {
    .chapters-grid {
        grid-template-columns: 1fr;
    }

    .scrollable-chapters {
        max-height: 600px;
        /* Mobile: ~10 items */
    }
}

.chapter-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.chapter-item:hover {
    background: var(--color-bg-elevated);
    border-color: var(--color-purple-primary);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.chapter-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chapter-number {
    font-weight: 600;
    color: var(--color-text-primary);
    font-size: 0.95rem;
}

.chapter-name {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.chapter-date {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    white-space: nowrap;
    opacity: 0.7;
}

/* Scrollbar Styling */
.scrollable-chapters::-webkit-scrollbar {
    width: 6px;
}

.scrollable-chapters::-webkit-scrollbar-track {
    background: var(--color-bg-secondary);
    border-radius: 3px;
}

.scrollable-chapters::-webkit-scrollbar-thumb {
    background: var(--color-border-hover);
    border-radius: 3px;
}

.scrollable-chapters::-webkit-scrollbar-thumb:hover {
    background: var(--color-purple-primary);
}

/* ==================== INFO TAB ==================== */
.info-content-box {
    background: linear-gradient(145deg, var(--color-bg-secondary), var(--color-bg-elevated));
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    max-width: 900px;
    margin: 0 auto;
    box-shadow: var(--shadow-lg);
}

.description-text {
    color: var(--color-text-secondary);
    line-height: 1.8;
    font-size: 1rem;
}

.description-text p {
    margin-bottom: var(--space-md);
}

.description-text p:last-child {
    margin-bottom: 0;
}

/* ==================== EMPTY STATES ==================== */
/* ==================== EMPTY STATES ==================== */
.empty-state-dark {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-3xl);
    text-align: center;
    background: linear-gradient(145deg, var(--color-bg-secondary), var(--color-bg-elevated));
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    max-width: 800px;
    margin: 0 auto;
    box-shadow: var(--shadow-lg);
}

.empty-icon-large {
    margin-bottom: var(--space-lg);
    opacity: 0.4;
}

.empty-icon-large .icon {
    width: 64px;
    height: 64px;
    stroke: var(--color-text-muted);
    fill: none;
    stroke-width: 1.5;
}

.icon-xxl {
    width: 64px;
    height: 64px;
}

/* ==================== NEUMORPHIC CARD ==================== */
.neumorphic-card {
    background: linear-gradient(145deg, #1a1a1a, #141414);
    box-shadow:
        8px 8px 20px rgba(0, 0, 0, 0.4),
        -4px -4px 15px rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.02);
}

/* ==================== ICON UTILITIES ==================== */
.icon {
    width: 20px;
    height: 20px;
    display: inline-block;
    vertical-align: middle;
}

.icon-sm {
    width: 16px;
    height: 16px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 900px) {
    .detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .detail-cover {
        width: 220px;
    }

    .detail-meta-top {
        justify-content: center;
    }

    .detail-genres {
        justify-content: center;
    }

    .detail-stats {
        justify-content: center;
        flex-wrap: wrap;
    }

    .detail-actions {
        justify-content: center;
    }

    .detail-title {
        font-size: 1.8rem;
    }
}

@media (max-width: 600px) {
    .detail-tabs-container {
        padding: 0 var(--space-md);
    }
    
    .detail-tabs {
        flex-direction: column;
        min-width: 0;
        width: 100%;
        border-radius: var(--radius-lg);
    }

    .tab-link {
        justify-content: center;
        border-radius: var(--radius-md);
    }

    .detail-cover {
        width: 180px;
    }

    .detail-title {
        font-size: 1.5rem;
    }

    .detail-stats {
        gap: var(--space-md);
    }

    .stat-item {
        font-size: 0.8rem;
    }
}

/* ==================== VERTICAL READERS CONTAINER ==================== */
.readers-vertical-container {
    position: relative;
    width: 240px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    margin-left: 0;
    flex-shrink: 0;
}

.readers-vertical-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(236, 72, 153, 0.1));
    border-bottom: 1px solid var(--color-border);
}

.readers-icon {
    font-size: 1.25rem;
}

.readers-count {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-purple-primary);
}

.readers-vertical-scroll {
    max-height: 280px;
    overflow-y: auto;
    padding: var(--space-sm);
    scrollbar-width: thin;
    scrollbar-color: var(--color-border-hover) var(--color-bg-secondary);
}

.readers-vertical-scroll::-webkit-scrollbar {
    width: 6px;
}

.readers-vertical-scroll::-webkit-scrollbar-track {
    background: var(--color-bg-secondary);
}

.readers-vertical-scroll::-webkit-scrollbar-thumb {
    background: var(--color-border-hover);
    border-radius: 3px;
}

.readers-vertical-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--color-purple-primary);
}

.reader-vertical-card {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    margin-bottom: var(--space-xs);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.reader-vertical-card:last-child {
    margin-bottom: 0;
}

.reader-vertical-card:hover {
    background: var(--color-bg-card);
    border-color: var(--color-purple-primary);
    transform: translateX(3px);
}

.reader-card-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--color-border);
    transition: border-color var(--transition-fast);
}

.reader-vertical-card:hover .reader-card-avatar {
    border-color: var(--color-purple-primary);
}

.reader-card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.reader-card-info {
    flex: 1;
    min-width: 0;
}

.reader-card-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.reader-card-level {
    font-size: 0.7rem;
    color: var(--color-purple-primary);
    font-weight: 600;
}

.readers-vertical-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-sm);
    background: var(--color-bg-elevated);
    border-top: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.readers-vertical-footer:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(236, 72, 153, 0.1));
    color: var(--color-purple-primary);
}

/* Responsive adjustments for vertical readers */
@media (max-width: 900px) {
    .readers-vertical-container {
        margin-left: 0;
        margin-top: var(--space-lg);
        width: 100%;
        max-width: 300px;
    }
}

@media (max-width: 600px) {
    .readers-vertical-container {
        width: 100%;
        max-width: none;
    }

    .readers-vertical-scroll {
        max-height: 200px;
    }
}