/**
 * Manga Cards, Catalog Layouts & Series Presentation
 */

/* -------------------------------------------------------------------------- */
/* 1. MANGA CARDS & GRIDS                                                     */
/* -------------------------------------------------------------------------- */
.ms-manga-cards-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 12px;
}

@media (max-width: 1400px) {
    .ms-manga-cards-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 640px) {
    .ms-manga-cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

.ms-manga-card {
    background: #ffffff;
    border: 1px solid #E8EAF0;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}

.ms-manga-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 24px rgba(108, 92, 231, 0.12);
    border-color: #6C5CE7;
}

.ms-card-thumb-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #E8EAF0;
    overflow: hidden;
}

.ms-card-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

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

/* Rank Badge - Blue pill in mockup */
.ms-rank-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: #2563EB;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    z-index: 2;
}

/* Star Score Badge - Dark overlay with gold star */
.ms-score-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(18, 20, 30, 0.82);
    color: #FBBF24;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 5px;
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    gap: 3px;
    z-index: 2;
}

/* Bookmark Button on Card */
.ms-card-bookmark-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    border-radius: var(--ms-radius-full);
    background: rgba(255, 255, 255, 0.88);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ms-text-muted);
    transition: all 0.15s ease;
    z-index: 2;
}

.ms-card-bookmark-btn:hover,
.ms-card-bookmark-btn.active {
    background: var(--ms-primary);
    color: #ffffff;
}

/* Card Info */
.ms-card-info {
    padding: 8px 10px 10px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.ms-card-title {
    margin: 0 0 5px;
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ms-card-title a {
    color: #20212A;
    text-decoration: none;
}

.ms-card-title a:hover {
    color: #6C5CE7;
}

.ms-card-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: auto;
}

.ms-genre-pill {
    background-color: #F4F5F8;
    color: #5B6171;
    border: 1px solid #E5E7EB;
    font-size: 10.5px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 4px;
    text-decoration: none;
    line-height: 1.25;
}

/* -------------------------------------------------------------------------- */
/* 2. CATALOG ARCHIVE BANNER & FILTER BAR                                     */
/* -------------------------------------------------------------------------- */
.ms-archive-manga-wrap {
    padding-bottom: 60px;
}

.ms-catalog-hero-card {
    background: linear-gradient(135deg, #F9F8FE 0%, #FFFFFF 100%);
    border: 1px solid var(--ms-border);
    border-radius: var(--ms-radius-lg);
    padding: 28px 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.ms-catalog-title {
    font-size: 32px;
    font-weight: 800;
    color: var(--ms-text-dark);
    margin: 0 0 8px;
}

.ms-catalog-subtitle {
    margin: 0 0 18px;
    color: var(--ms-text-muted);
    font-size: 15px;
}

.ms-catalog-searchform {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--ms-border);
    border-radius: var(--ms-radius-full);
    padding: 4px 6px 4px 14px;
    max-width: 440px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.ms-catalog-search-field {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
}

.ms-filter-bar-card {
    background: #ffffff;
    border: 1px solid var(--ms-border);
    border-radius: 12px;
    padding: 14px 20px;
    margin-bottom: 16px;
}

.ms-filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.ms-filter-field {
    flex: 1;
    min-width: 130px;
}

.ms-filter-field-sort {
    min-width: 180px;
}

.ms-filter-select {
    width: 100%;
    background-color: var(--ms-bg-body);
    border: 1px solid var(--ms-border);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ms-text-main);
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s ease;
}

.ms-filter-select:focus {
    border-color: var(--ms-primary);
    background-color: #ffffff;
}

.ms-results-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--ms-text-muted);
}

.ms-reset-filters-link {
    color: var(--ms-danger);
    font-weight: 600;
    text-decoration: none;
}

/* -------------------------------------------------------------------------- */
/* 3. SINGLE MANGA DETAIL TEMPLATE                                            */
/* -------------------------------------------------------------------------- */
.ms-single-manga-wrap {
    padding-bottom: 60px;
}

.ms-manga-detail-card {
    background: #ffffff;
    border: 1px solid var(--ms-border);
    border-radius: var(--ms-radius-lg);
    padding: 36px 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.ms-manga-detail-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
}

.ms-detail-cover-box {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
}

.ms-detail-cover-img {
    width: 100%;
    height: auto;
    display: block;
}

.ms-detail-bookmark-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: var(--ms-radius-full);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ms-text-muted);
}

.ms-detail-bookmark-btn:hover,
.ms-detail-bookmark-btn.active {
    background: var(--ms-primary);
    color: #ffffff;
}

.ms-detail-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 18px;
}

/* Right Detail Header & Metadata */
.ms-detail-header-top {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.ms-detail-title {
    font-size: 32px;
    font-weight: 800;
    color: var(--ms-text-dark);
    margin: 0;
    line-height: 1.2;
}

.ms-detail-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.ms-badge-type {
    background: #E0E7FF;
    color: #4338CA;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--ms-radius-full);
}

.ms-rating-box {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 700;
    color: var(--ms-text-dark);
}

.ms-star-icon {
    color: var(--ms-star);
    font-size: 18px;
}

.ms-rating-votes {
    font-size: 13px;
    font-weight: 400;
    color: var(--ms-text-muted);
}

/* Metadata Specs Grid */
.ms-meta-specs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 24px;
    background: var(--ms-bg-body);
    border: 1px solid var(--ms-border-light);
    border-radius: 12px;
    padding: 18px 24px;
    margin: 20px 0;
}

.ms-meta-row {
    display: flex;
    justify-content: space-between;
    font-size: 13.5px;
    border-bottom: 1px dashed var(--ms-border);
    padding-bottom: 6px;
}

.ms-meta-label {
    color: var(--ms-text-muted);
    font-weight: 500;
}

.ms-meta-val {
    color: var(--ms-text-dark);
    font-weight: 600;
}

.ms-verified-source-link {
    color: var(--ms-primary);
    font-weight: 700;
}

/* Quick Actions Box */
.ms-quick-actions-card {
    border: 1px solid var(--ms-border-light);
    border-radius: 10px;
    padding: 14px 18px;
    background: #ffffff;
}

.ms-quick-title {
    margin: 0 0 10px;
    font-size: 13px;
    color: var(--ms-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ms-quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.ms-quick-btn {
    background: none;
    border: none;
    color: var(--ms-text-main);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
}

.ms-quick-btn:hover {
    color: var(--ms-primary);
}

/* -------------------------------------------------------------------------- */
/* 4. DETAIL TABS                                                             */
/* -------------------------------------------------------------------------- */
.ms-detail-tabs-section {
    margin-top: 36px;
    border-top: 1px solid var(--ms-border);
    padding-top: 24px;
}

.ms-tabs-nav {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--ms-border-light);
    margin-bottom: 24px;
    overflow-x: auto;
}

.ms-tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 18px;
    font-size: 15px;
    font-weight: 600;
    color: var(--ms-text-muted);
    cursor: pointer;
    margin-bottom: -2px;
    transition: all 0.15s ease;
}

.ms-tab-btn:hover {
    color: var(--ms-primary);
}

.ms-tab-btn.active {
    color: var(--ms-primary);
    border-bottom-color: var(--ms-primary);
}

.ms-tab-content, .ms-tab-pane {
    display: none;
}

.ms-tab-content.active, .ms-tab-pane.active {
    display: block;
}

.ms-synopsis-heading {
    margin: 0 0 12px;
    font-size: 18px;
    color: var(--ms-text-dark);
}

.ms-synopsis-text {
    font-size: 15px;
    color: #4A4D5A;
    line-height: 1.7;
}

.ms-legal-notice-box {
    background: #F8F9FE;
    border: 1px solid #E4E7F4;
    border-radius: 10px;
    padding: 14px 18px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 13px;
    color: var(--ms-text-muted);
    margin-top: 24px;
}

.ms-notice-icon {
    font-size: 18px;
    flex-shrink: 0;
}

/* Chapter List */
.ms-chapters-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.ms-verified-chapters-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ms-chapter-row {
    background: var(--ms-bg-body);
    border: 1px solid var(--ms-border-light);
    border-radius: 8px;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ms-chap-num {
    font-weight: 700;
    color: var(--ms-text-dark);
    font-size: 14px;
}

.ms-chap-date {
    font-size: 12px;
    color: var(--ms-text-muted);
}

.ms-chap-read-link {
    color: var(--ms-primary);
    font-size: 13px;
    font-weight: 700;
}

/* Details Table */
.ms-details-table {
    width: 100%;
    border-collapse: collapse;
}

.ms-details-table th, .ms-details-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--ms-border-light);
    font-size: 14px;
    text-align: left;
}

.ms-details-table th {
    width: 220px;
    color: var(--ms-text-muted);
    font-weight: 500;
}

.ms-details-table td {
    color: var(--ms-text-dark);
    font-weight: 600;
}

/* Pagination */
.ms-pagination-wrap {
    margin-top: 36px;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
}

.page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid var(--ms-border);
    color: var(--ms-text-main);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
}

.page-numbers.current,
.page-numbers:hover {
    background: var(--ms-primary);
    color: #ffffff;
    border-color: var(--ms-primary);
}

@media (max-width: 768px) {
    .ms-manga-detail-layout {
        grid-template-columns: 1fr;
    }
    .ms-detail-left {
        max-width: 240px;
        margin: 0 auto;
    }
    .ms-catalog-hero-card {
        flex-direction: column;
        padding: 20px;
    }
    .ms-meta-specs-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   FIGMA MOCKUP REFINEMENTS: CATALOG & SINGLE MANGA
   ========================================================================== */

/* 4-Column Catalog Grid */
.ms-catalog-manga-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

@media (max-width: 1024px) {
    .ms-catalog-manga-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 640px) {
    .ms-catalog-manga-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

.ms-catalog-card {
    background: #ffffff;
    border: 1px solid #E8EAF0;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.ms-catalog-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 24px rgba(108, 92, 231, 0.12);
    border-color: #6C5CE7;
}

.ms-catalog-thumb-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1.35;
    background: #F1F3F7;
    overflow: hidden;
}

.ms-catalog-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.ms-catalog-card:hover .ms-catalog-cover-img {
    transform: scale(1.04);
}

.ms-card-heart-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(4px);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #707584;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    z-index: 2;
    transition: all 0.15s ease;
}

.ms-card-heart-btn:hover {
    background: #6C5CE7;
    color: #ffffff;
}

.ms-catalog-score-pill {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(18, 20, 30, 0.85);
    color: #FBBF24;
    font-size: 11.5px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    backdrop-filter: blur(3px);
    z-index: 2;
}

.ms-catalog-info {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.ms-catalog-card-title {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ms-catalog-card-title a {
    color: #20212A;
    text-decoration: none;
}

.ms-catalog-card-title a:hover {
    color: #6C5CE7;
}

.ms-catalog-card-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
}

.ms-genre-capsule {
    background: #F4F5F8;
    color: #5B6171;
    border: 1px solid #E5E7EB;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 6px;
    text-decoration: none;
}

/* Pagination matching mockup */
.ms-catalog-pagination-wrap {
    display: flex;
    justify-content: center;
    margin: 32px 0 16px;
}

.ms-pagination-nav {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    padding: 6px 12px;
    border-radius: 10px;
    border: 1px solid #E8EAF0;
}

.ms-page-number, .ms-page-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    color: #5B6171;
    transition: all 0.15s;
}

.ms-page-number:hover, .ms-page-arrow:hover:not(.disabled) {
    background: #F4F5F8;
    color: #20212A;
}

.ms-page-number.current {
    background: #6C5CE7;
    color: #ffffff;
}

.ms-page-arrow.disabled {
    opacity: 0.4;
    cursor: default;
}

.ms-page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    color: #8F95A3;
    font-weight: 700;
}

/* Single Manga 3-Column Layout */
.ms-single-top-grid {
    display: grid;
    grid-template-columns: 240px 1fr 230px;
    gap: 32px;
    align-items: start;
    margin-bottom: 28px;
}

@media (max-width: 1024px) {
    .ms-single-top-grid {
        grid-template-columns: 200px 1fr;
    }
    .ms-single-col-actions {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .ms-single-top-grid {
        grid-template-columns: 1fr;
    }
}

.ms-single-col-cover {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ms-detail-cta-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ms-btn-reading {
    background: #EDE9FE;
    color: #6C5CE7;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.ms-btn-reading:hover {
    background: #DDD6FE;
}

.ms-single-col-info {
    display: flex;
    flex-direction: column;
}

.ms-detail-title {
    font-size: 28px;
    font-weight: 800;
    color: #20212A;
    margin: 0 0 10px;
}

.ms-detail-badges-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.ms-badge-ongoing {
    background: #ECFDF5;
    color: #10B981;
    font-size: 11.5px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 6px;
}

.ms-badge-type-pill {
    background: #EDE9FE;
    color: #6C5CE7;
    font-size: 11.5px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 6px;
}

.ms-detail-rating-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 18px;
    font-size: 14.5px;
    font-weight: 700;
}

.ms-star-glyph {
    color: #F59E0B;
    font-size: 16px;
}

.ms-rating-score {
    color: #20212A;
}

.ms-rating-votecount {
    color: #8F95A3;
    font-weight: 400;
    font-size: 13px;
}

.ms-meta-specs-table {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 24px;
    background: #FAF9FE;
    padding: 16px 20px;
    border-radius: 10px;
    border: 1px solid #ECECF4;
}

.ms-spec-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ms-spec-label {
    font-size: 12px;
    font-weight: 500;
    color: #8F95A3;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ms-spec-value {
    font-size: 13.5px;
    font-weight: 700;
    color: #20212A;
}

/* Quick Actions Card with Sketch */
.ms-quick-actions-card {
    background: #FAF9FE;
    border: 1px solid #ECECF4;
    border-radius: 12px;
    padding: 18px;
    position: relative;
    overflow: hidden;
}

.ms-quick-sketch-watermark {
    position: absolute;
    right: -15px;
    top: -10px;
    width: 140px;
    height: 140px;
    opacity: 0.18;
    pointer-events: none;
}

.ms-quick-heading {
    font-size: 14px;
    font-weight: 700;
    color: #20212A;
    margin: 0 0 14px;
    position: relative;
    z-index: 1;
}

.ms-quick-links-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    z-index: 1;
}

.ms-quick-link-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    color: #4A4D59;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    width: 100%;
    text-align: left;
}

.ms-quick-link-row:hover {
    background: #ffffff;
    color: #6C5CE7;
    box-shadow: 0 2px 6px rgba(108, 92, 231, 0.08);
}

/* Tabs Section */
.ms-detail-tabs-wrapper {
    margin-top: 10px;
}

.ms-tabs-header-bar {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid #E8EAF0;
    margin-bottom: 22px;
}

.ms-tab-pill {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    color: #707584;
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}

.ms-tab-pill.active {
    color: #6C5CE7;
    border-bottom-color: #6C5CE7;
    font-weight: 700;
}

.ms-synopsis-title {
    font-size: 18px;
    font-weight: 700;
    color: #20212A;
    margin: 0 0 10px;
}

.ms-synopsis-body {
    color: #4A4D59;
    line-height: 1.7;
    font-size: 14.5px;
}
