/* Character Showcase Frontend Styles - Responsive Edition */

/* ==========================================================================
   Variables & Base Styles
   ========================================================================== */
   :root {
       --chs-main-color: #566270;
       --chs-sub-bg: #e0e3da;
       --chs-sub-text: #6c757d;
       --chs-delete-color: #c46969;
       --chs-white: #ffffff;
       --chs-light-gray: #f8f9fa;
       --chs-border-color: #e0e0e0;
       --chs-border-radius: 8px;
       --chs-box-shadow: 0 2px 8px rgba(0,0,0,0.1);
       --chs-transition: all 0.3s ease;
   }

   /* ==========================================================================
      Main Container
      ========================================================================== */
   .chs-showcase {
       max-width: 1200px;
       margin: 0 auto;
       padding: 20px;
       font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
       color: var(--chs-main-color);
       line-height: 1.6;
   }

   /* ==========================================================================
      Header Section
      ========================================================================== */
   .chs-showcase-header {
       text-align: center;
       margin-bottom: 30px;
       padding: 8px 8px 6px 20px;
       border-bottom: 3px solid var(--chs-main-color);
   }

   .chs-series-title {
       font-size: 1.8rem;
       font-weight: 600;
       color: var(--chs-main-color);
       margin: 0 0 8px 0;
   }

   .chs-showcase-subtitle,
   .chs-showcase-title {
       font-size: 1.4rem;
       font-weight: 500;
       color: var(--chs-main-color);
       margin: 0;
       padding: 0;
       border: none;
   }

/* ==========================================================================
   Chapter Tabs
   ========================================================================== */
.chs-chapter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    justify-content: center;
}

.chs-chapter-tab {
    background: var(--chs-white);
    border: none;
    padding: 12px 24px;
    border-radius: var(--chs-border-radius);
    color: var(--chs-sub-text);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--chs-transition);
    box-shadow: var(--chs-box-shadow);
    white-space: nowrap;
    transition: 0.5s!important;
}

.chs-chapter-tab:hover {
    background: var(--chs-light-gray);
    color: var(--chs-main-color);
}

.chs-chapter-tab.active {
    background: var(--chs-main-color);
    color: var(--chs-white);
}

/* ==========================================================================
   Characters Display
   ========================================================================== */
.chs-characters-display {
    position: relative;
}

.chs-chapter-content {
    display: none;
    animation: chsFadeIn 0.4s ease-in-out;
}

.chs-chapter-content.active {
    display: block;
}

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

/* ==========================================================================
   Characters Grid
   ========================================================================== */
.chs-characters-grid-display {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    justify-items: center;
    padding: 20px 18px;
    gap: 60px;
}

.chs-character-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: var(--chs-transition);
    padding: 15px;
    border-radius: var(--chs-border-radius);
    min-width: 100px;
    transition: 0.3s !important;
}

.chs-character-item:hover {
    background: #e0e3da;
}

.chs-character-avatar-display {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    background: var(--chs-sub-bg);
}

.chs-character-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.chs-character-name-display {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--chs-main-color);
    text-align: center;
    line-height: 1.3;
    word-wrap: break-word;
    max-width: 120px;
}

/* ==========================================================================
   No Content States
   ========================================================================== */
.chs-no-characters-display,
.chs-no-chapters {
    text-align: center;
    padding: 40px 20px;
    background: var(--chs-sub-bg);
    border-radius: var(--chs-border-radius);
    color: var(--chs-sub-text);
}

.chs-no-characters-display p,
.chs-no-chapters p {
    margin: 0;
    font-size: 1rem;
}

/* ==========================================================================
   Character Detail Modal (New Design)
   ========================================================================== */
.chs-character-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
}

.chs-character-modal-overlay.show { opacity: 1; }
.chs-character-modal-overlay.hide { opacity: 0; }

.chs-character-modal-content {
    background: var(--chs-white);
    border-radius: var(--chs-border-radius);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    position: relative;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.chs-character-modal-overlay.show .chs-character-modal-content {
    transform: scale(1);
}

.chs-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 30px;
    line-height: 1;
    font-weight: 300;
    color: var(--chs-sub-text);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--chs-transition);
    z-index: 10;
}

.chs-modal-close:hover {
    background: var(--chs-light-gray);
    color: var(--chs-main-color);
}

.chs-character-modal-body {
    display: flex;
    flex-direction: row;
    padding: 40px;
    gap: 40px;
}

.chs-character-modal-image {
    flex: 0 0 35%;
    max-width: 300px;
}

.chs-character-large-image {
    width: 100%;
    height: auto;
}

.chs-character-modal-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chs-character-modal-name-wrapper {
    display: flex;
    align-items: baseline;
    gap: 15px;
    margin-bottom: 2px;
    flex-wrap: wrap;
}

.chs-character-modal-name {
    font-size: 2.2rem;
    font-weight: 700;
    color: #333;
    margin: 0;
    line-height: 1.2;
}

.chs-character-modal-reading {
    font-size: 1rem;
    color: #555;
    font-weight: 400;
}

.chs-character-details {
    margin: 0;
    padding: 0;
    border: none;
    background: none;
}

.chs-character-detail-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-top: 12px;
    border-bottom: 1px solid #757677;
}

.chs-detail-label {
    background-color: #757677;
    color: #ffffff;
    padding: 4px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    flex-shrink: 0;
    min-width: 80px;
    text-align: center;
}

.chs-detail-value {
    font-size: 1rem;
    color: #333;
}

.chs-character-modal-description-wrapper {
    margin-top: 8px;
    padding: 8px 2px;
}

.chs-description-heading {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--chs-sub-text);
    margin: 0 0 10px 0;
}

.chs-character-modal-description {
    font-size: 1rem;
    color: #333;
    line-height: 1.7;
    white-space: pre-wrap;
    margin: 0;
    background: none;
    padding: 0;
}

/* ==========================================================================
   ドロップキャップのスタイル
   ========================================================================== */
.chs-character-modal-description::first-letter {
    float: left;
    font-size: 3.4em;
    font-family: "Yu Mincho", "游明朝", "Hiragino Mincho ProN", "ヒラギノ明朝 ProN", "MS PMincho", "MS 明朝", serif;
    line-height: 0.7;
    padding-top: 4px;
    font-weight: 600;
    color: var(--chs-main-color);
    margin-top: 5px;
}

/* ==========================================================================
   Spoiler Warning Modal
   ========================================================================== */
.chs-spoiler-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
}

.chs-spoiler-modal-overlay.show {
    opacity: 1;
}

.chs-spoiler-modal-overlay.hide {
    opacity: 0;
}

.chs-spoiler-modal {
    background: var(--chs-white);
    border-radius: var(--chs-border-radius);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    padding: 30px;
    text-align: center;
    max-width: 400px;
    width: 100%;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.chs-spoiler-modal-overlay.show .chs-spoiler-modal {
    transform: scale(1);
}

.chs-spoiler-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    display: block;
}

.chs-spoiler-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--chs-main-color);
    margin: 0 0 15px 0;
}

.chs-spoiler-text {
    font-size: 1rem;
    color: var(--chs-sub-text);
    line-height: 1.6;
    margin: 0 0 25px 0;
}

.chs-spoiler-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.chs-btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--chs-border-radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--chs-transition);
    min-width: 100px;
}

.chs-btn-primary {
    background: var(--chs-main-color);
    color: var(--chs-white);
}

.chs-btn-primary:hover {
    background: #4a5561;
}

.chs-btn-secondary {
    background: var(--chs-sub-bg);
    color: var(--chs-sub-text);
}

.chs-btn-secondary:hover {
    background: #d4d7d0;
    color: var(--chs-main-color);
}

/* ==========================================================================
   RESPONSIVE DESIGN - Mobile First Approach
   ========================================================================== */

/* Extra Small Devices (320px and up) */
@media (max-width: 480px) {
    .chs-showcase {
        padding: 10px;
        margin: 0 5px;
    }

    .chs-showcase-header {
        padding: 6px 6px 4px 15px;
        margin-bottom: 20px;
    }

    .chs-series-title {
        font-size: 1.4rem;
    }

    .chs-showcase-subtitle,
    .chs-showcase-title {
        font-size: 1.1rem;
    }

    /* Chapter Tabs */
    .chs-chapter-tabs {
        gap: 4px;
        margin-bottom: 15px;
    }

    .chs-chapter-tab {
        padding: 8px 12px;
        font-size: 0.8rem;
        min-width: auto;
    }

    /* Characters Grid */
    .chs-characters-grid-display {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 20px;
        padding: 15px 10px;
    }

    .chs-character-item {
        padding: 10px;
        min-width: 80px;
    }

    .chs-character-avatar-display {
        width: 80px;
        height: 80px;
        margin-bottom: 8px;
    }

    .chs-character-name-display {
        font-size: 0.8rem;
        max-width: 80px;
    }

    /* Modal Adjustments */
    .chs-character-modal-overlay {
        padding: 10px;
    }

    .chs-character-modal-content {
        max-height: 95vh;
    }

    .chs-character-modal-body {
        flex-direction: column;
        padding: 20px;
        gap: 10px;
    }

    .chs-character-modal-image {
        flex: none;
        max-width: 100%;
        align-self: center;
    }

    .chs-character-modal-name {
        font-size: 1.6rem;
    }

    .chs-character-modal-name-wrapper {
        gap: 10px;
        flex-direction: column;
        align-items: flex-start;
    }

    .chs-character-detail-item {
        align-items: flex-start;
        gap: 25px;
    }

    .chs-detail-label {
        min-width: auto;
        align-self: flex-start;
    }

    .chs-modal-close {
        top: 10px;
        right: 10px;
        font-size: 24px;
        width: 32px;
        height: 32px;
    }

    /* Spoiler Modal */
    .chs-spoiler-modal {
        padding: 20px;
        margin: 10px;
    }

    .chs-spoiler-actions {
        flex-direction: column;
        gap: 8px;
    }

    .chs-btn {
        min-width: auto;
        width: 100%;
    }

    /* Drop cap adjustment for mobile */
    .chs-character-modal-description::first-letter {
        font-size: 2.5em;
        line-height: 0.8;
    }
}

/* Small Devices (481px to 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .chs-showcase {
        padding: 15px;
    }

    .chs-series-title {
        font-size: 1.6rem;
    }

    .chs-showcase-subtitle,
    .chs-showcase-title {
        font-size: 1.2rem;
    }

    .chs-chapter-tab {
        padding: 10px 18px;
        font-size: 0.9rem;
    }

    .chs-characters-grid-display {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 40px;
        padding: 18px 15px;
    }

    .chs-character-avatar-display {
        width: 100px;
        height: 100px;
    }

    .chs-character-name-display {
        max-width: 100px;
    }

    .chs-character-modal-body {
        padding: 30px;
        gap: 30px;
    }

    .chs-character-modal-name {
        font-size: 1.8rem;
    }
}

/* Medium Devices (769px to 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .chs-showcase {
        padding: 18px;
    }

    .chs-characters-grid-display {
        gap: 50px;
    }

    .chs-character-modal-body {
        padding: 35px;
        gap: 35px;
    }

    .chs-character-modal-image {
        max-width: 250px;
    }

    .chs-character-modal-name {
        font-size: 2rem;
    }
}

/* Large Devices (1025px and up) - Default styles apply */

/* Landscape orientation adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .chs-character-modal-content {
        max-height: 85vh;
    }

    .chs-character-modal-body {
        padding: 20px;
    }

    .chs-character-modal-name {
        font-size: 1.4rem;
    }

    .chs-characters-grid-display {
        gap: 30px;
    }
}

/* Touch device hover adjustments */
@media (hover: none) and (pointer: coarse) {
    .chs-character-item:hover {
        background: transparent;
    }

    .chs-chapter-tab:hover {
        background: var(--chs-white);
        color: var(--chs-sub-text);
    }

    .chs-btn-primary:hover {
        background: var(--chs-main-color);
    }

    .chs-btn-secondary:hover {
        background: var(--chs-sub-bg);
        color: var(--chs-sub-text);
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .chs-character-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }

    .chs-character-large-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
    .chs-character-modal-overlay,
    .chs-spoiler-modal-overlay {
        display: none !important;
    }

    .chs-showcase {
        box-shadow: none;
        max-width: none;
        padding: 0;
    }

    .chs-character-item:hover {
        transform: none;
    }

    .chs-characters-grid-display {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 20px;
    }
}

/* ==========================================================================
   Accessibility Enhancements
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
.chs-character-item:focus,
.chs-chapter-tab:focus {
    outline: 3px solid var(--chs-main-color);
    outline-offset: 2px;
}

.chs-character-item:focus:not(:focus-visible),
.chs-chapter-tab:focus:not(:focus-visible) {
    outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --chs-box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    }

    .chs-character-item {
        border: 1px solid var(--chs-main-color);
    }

    .chs-chapter-tab {
        border: 1px solid var(--chs-sub-text);
    }
}
