/* Navy detail page */
:root {
    --sidebarWidth: 280px;
    --contentSpace: 32px;
    --brand-50: #eff6ff;
    --brand-100: #dbeafe;
    --brand-600: #2563eb;
    --brand-700: #1d4ed8;
    --brand-800: #1e40af;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --font-family: inherit;
    --text-md-height: 1.6;
}

.detail-main {
    display: flex;
    justify-content: center;
    gap: var(--contentSpace);
    min-height: 60vh;
    padding-top: 20px;
    padding-bottom: 40px;
}

.detail-main .bodyL {
    width: calc(100% - var(--sidebarWidth) - var(--contentSpace));
}

.detail-main .bodyR {
    width: var(--sidebarWidth);
    flex-shrink: 0;
}

.detail-info-block {
    width: 100%;
    margin-top: 0;
}

.detail-alert-wrap {
    margin-top: 12px;
}

.alert {
    position: relative;
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--brand-800);
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--brand-100);
}

.alert::after {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    width: 30%;
    height: 100%;
    background: linear-gradient(to left, #ebefff 0%, transparent 100%);
    pointer-events: none;
    border-radius: 8px;
}

.alert span {
    white-space: nowrap;
    overflow: hidden;
    overflow-x: auto;
}

.alert span::-webkit-scrollbar {
    display: none;
}

.info-cover {
    position: relative;
    width: 100%;
    margin-bottom: 12px;
}

.info-cover img {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    display: block;
}

.heart-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: var(--brand-50) !important;
    height: 40px;
    width: 40px;
    border-radius: 100%;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.heart-btn .heart-filled {
    display: none;
}

.heart-btn.followed .heart-outline,
.heart-btn.active .heart-outline {
    display: none;
}

.heart-btn.followed .heart-filled,
.heart-btn.active .heart-filled {
    display: block;
}

.info-title h2 {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--gray-800);
    text-transform: capitalize;
    margin: 0 0 4px;
}

.other-name {
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: 12px;
}

.other-name p {
    margin: 0;
}

.description-wrapper {
    position: relative;
    margin-bottom: 8px;
}

.description-wrapper::after {
    content: "";
    position: absolute;
    bottom: 25px;
    left: 0;
    width: 100%;
    height: 50px;
    background: linear-gradient(to top, #ffffff 0%, transparent 100%);
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.description-wrapper.expanded::after {
    opacity: 0;
}

.description {
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: 1.6 !important;
    color: var(--gray-700);
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.description p,
.description span {
    font-size: 14px !important;
    line-height: 1.6 !important;
    color: var(--gray-700);
}

.description.expanded {
    display: block;
    -webkit-line-clamp: unset;
}

.toggle-btn {
    background: none;
    border: none;
    color: var(--brand-600);
    cursor: pointer;
    padding: 4px 0;
    font-size: 12px;
    font-weight: 500;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tags a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #f3f4f6;
    color: #374151;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.tags a:hover {
    background: var(--brand-100);
    color: var(--brand-800);
}

.tags a.tag-brand {
    color: var(--brand-800);
    background: var(--brand-100);
}

.tags.margin-bottom-15px {
    margin-bottom: 15px;
}

.detail-seo-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.detail-seo-tag {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: var(--gray-500);
    font-size: 12px;
    line-height: 1.4;
    text-decoration: none;
    transition: all 0.2s ease;
}

.detail-seo-tag:hover {
    color: var(--brand-600);
    background: var(--brand-50);
    border-color: var(--brand-100);
}

/* Popup */
.popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.popup-overlay.active {
    display: flex;
    animation: detailFadeIn 0.2s ease;
}

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

.popup-content {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    animation: detailSlideUp 0.3s ease;
}

@keyframes detailSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f3f4f6;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #374151;
    z-index: 10;
}

.popup-close:hover {
    background: #e5e7eb;
}

.popup-body {
    padding: 32px 24px 24px;
    overflow-y: auto;
    max-height: 85vh;
}

.popup-section {
    margin-bottom: 28px;
}

.popup-section:last-child {
    margin-bottom: 0;
}

.pop-description p {
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-700);
    text-align: justify;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--gray-600);
}

.info-value {
    font-size: 12px;
    color: var(--gray-800);
    font-weight: 500;
    text-align: right;
}

.info-value a {
    color: var(--brand-800);
    text-decoration: none;
}

/* Section headers on detail */
.detail-main .section-header,
.detail-main .comments-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
}

.detail-main .section-header .title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.detail-main .section-header .bar {
    width: 4px;
    height: 18px;
    background: var(--brand-600);
    border-radius: 2px;
    flex-shrink: 0;
}

.detail-main .section-header h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-800);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding-left: 0;
}

.detail-main .section-header h2::before {
    display: none;
}

.detail-main .section-header .more,
.detail-main .section-header .btn-sort {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    color: var(--gray-600);
    text-decoration: none;
    cursor: pointer;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-family: inherit;
    flex-shrink: 0;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.detail-main .section-header .more .sort-arrows {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    line-height: 0;
}

.detail-main .section-header .more svg,
.detail-main .section-header .btn-sort svg {
    width: 8px;
    height: 16px;
    flex-shrink: 0;
    display: block;
}

.detail-main .section-header .more:hover,
.detail-main .section-header .btn-sort:hover {
    color: var(--brand-600);
    background: var(--brand-50);
    border-color: #bfdbfe;
}

.detail-main .section-header .more:active,
.detail-main .section-header .btn-sort:active {
    transform: scale(0.98);
}

/* Episodes */
.episode-wrapper {
    width: 100%;
}

.episode-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
    overflow-y: auto;
    max-height: 500px;
    mask: linear-gradient(to top, transparent 0%, rgba(0, 0, 0, 0.3) 10%, black 20%);
}

.episode-list::-webkit-scrollbar {
    display: none;
}

.episode-item {
    position: relative;
    width: 100%;
    height: 70px;
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 12px;
}

.episode-cover {
    width: 70px;
    height: 70px;
    overflow: hidden;
    border-radius: 8px;
    flex-shrink: 0;
}

.episode-cover img {
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

.episode-cover a {
    display: block;
    width: 100%;
    height: 100%;
}

.episode-title {
    flex: 1;
    min-width: 0;
}

.episode-title a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.episode-title h3 {
    font-size: 16px;
    font-weight: 500;
    color: var(--gray-700);
    margin: 0 0 2px;
}

.chapter-date {
    font-size: 13px;
    font-weight: 400;
    color: var(--gray-500);
}

.episode-badge {
    position: absolute;
    right: 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--brand-700);
    background: var(--brand-100);
    padding: 2px 12px;
    border-radius: 8px;
}

.detail-bodyL section {
    margin-bottom: 28px;
}

.detail-bodyL section:last-child {
    margin-bottom: 0;
}

.comic-grid.bottom {
    grid-template-columns: repeat(6, 1fr);
}

.detail-main .comic-cover img {
    object-fit: unset;
}

@media (max-width: 1200px) {
    .comic-grid.bottom {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 767px) {
    .detail-main {
        display: block;
    }

    .detail-main .bodyL,
    .detail-main .bodyR {
        width: 100%;
    }

    .detail-info-block {
        margin-top: 0;
    }

    .info-title h2 {
        font-size: 20px;
    }

    .detail-alert-wrap {
        margin-bottom: 16px;
    }

    .episode-title h3 {
        font-size: 14px;
    }

    .comic-grid.bottom {
        grid-template-columns: repeat(3, 1fr);
    }

    .popup-content {
        max-height: 90vh;
        border-radius: 16px 16px 0 0;
        align-self: flex-end;
    }

    .popup-overlay {
        align-items: flex-end;
        padding: 0;
    }
}
