/**
 * Creative Publisher - Frontend Styles
 */

/* ========================================
   Field Common
======================================== */
.ncp-field {
    margin-bottom: 24px;
}

.ncp-field-label {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px 0;
}

.ncp-field-content {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.ncp-field-content p {
    margin: 0 0 1em 0;
}

.ncp-field-content p:last-child {
    margin-bottom: 0;
}

/* ========================================
   Text Templates
======================================== */

/* Simple */
.ncp-simple .ncp-field-label {
    padding-bottom: 8px;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 16px;
}

/* Quote */
.ncp-quote {
    border-left: 4px solid var(--accent-primary);
    background: rgba(var(--bg-secondary-rgb, 128, 128, 128), 0.1);
    padding: 20px 24px;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    margin: 0;
}

.ncp-quote .ncp-field-label {
    color: var(--accent-primary);
}

/* Card */
.ncp-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

/* Speech Bubble */
.ncp-bubble {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.ncp-bubble-avatar {
    flex-shrink: 0;
    text-align: center;
}

.ncp-bubble-avatar img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--card-border);
}

.ncp-bubble-avatar .ncp-bubble-name {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.ncp-bubble-body {
    position: relative;
    flex: 1;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    padding: 16px 20px;
}

.ncp-bubble-body::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 20px;
    border-width: 10px;
    border-style: solid;
    border-color: transparent var(--card-border) transparent transparent;
}

.ncp-bubble-body::after {
    content: '';
    position: absolute;
    left: -8px;
    top: 20px;
    border-width: 10px;
    border-style: solid;
    border-color: transparent var(--card-bg) transparent transparent;
}

/* Highlight */
.ncp-highlight {
    background: rgba(var(--accent-primary-rgb, 0, 240, 255), 0.15);
    border: 2px solid var(--accent-primary);
    border-radius: var(--border-radius);
    padding: 20px 24px;
}

.ncp-highlight .ncp-field-label {
    color: var(--accent-primary);
}

/* Code */
.ncp-code {
    background: #1e1e1e;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.ncp-code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2d2d2d;
    padding: 12px 16px;
}

.ncp-code-header .ncp-field-label {
    color: #d4d4d4;
    margin: 0;
    font-size: 0.9rem;
}

.ncp-code .ncp-field-content {
    padding: 20px;
    margin: 0;
    overflow-x: auto;
}

.ncp-code .ncp-field-content code {
    font-family: 'Courier New', Consolas, Monaco, monospace;
    font-size: 0.9rem;
    color: #d4d4d4;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Timeline */
.ncp-timeline {
    position: relative;
    padding-left: 30px;
    border-left: 2px solid var(--accent-primary);
    margin-left: 6px;
}

.ncp-timeline-dot {
    position: absolute;
    left: -7px;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-primary);
}

.ncp-timeline + .ncp-timeline {
    margin-top: -12px;
    padding-top: 12px;
}

/* Accordion */
.ncp-accordion {
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.ncp-accordion summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--card-bg);
    list-style: none;
    transition: background-color 0.2s ease;
}

.ncp-accordion summary::-webkit-details-marker {
    display: none;
}

.ncp-accordion summary:hover {
    background: rgba(var(--bg-secondary-rgb, 128, 128, 128), 0.05);
}

.ncp-accordion-icon {
    display: inline-block;
    transition: transform 0.3s ease;
    font-size: 0.8em;
}

.ncp-accordion[open] .ncp-accordion-icon {
    transform: rotate(90deg);
}

.ncp-accordion .ncp-field-content {
    padding: 0 16px 16px;
}

.ncp-accordion-inner {
    overflow: hidden;
}

/* ========================================
   Gallery Common
======================================== */
.ncp-gallery {
    margin-bottom: 24px;
}

.ncp-gallery img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Gallery Grid */
.ncp-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.ncp-gallery-grid .ncp-gallery-item {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ncp-gallery-grid .ncp-gallery-item:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow);
}

.ncp-gallery-grid .ncp-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Gallery Slider */
.ncp-gallery-slider {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius);
}

.ncp-slider-track {
    display: flex;
    transition: transform 0.3s ease;
}

.ncp-slider-slide {
    flex: 0 0 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ncp-slider-slide img {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
}

.ncp-slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    z-index: 10;
}

.ncp-slider-nav:hover {
    background: rgba(0, 0, 0, 0.7);
}

.ncp-slider-prev {
    left: 10px;
}

.ncp-slider-next {
    right: 10px;
}

.ncp-slider-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.ncp-slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--card-border);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background-color 0.2s ease;
}

.ncp-slider-dot.active {
    background: var(--accent-primary);
}

/* Gallery 3D Carousel */
.ncp-gallery-3d {
    position: relative;
    perspective: 1000px;
    height: 400px;
    overflow: visible;
}

.ncp-3d-container {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

.ncp-3d-slide {
    position: absolute;
    width: 60%;
    left: 20%;
    top: 50%;
    transform: translateY(-50%);
    transition: all 0.5s ease;
    cursor: pointer;
    opacity: 0.5;
}

.ncp-3d-slide img {
    width: 100%;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.ncp-3d-slide.active {
    z-index: 10;
    opacity: 1;
    transform: translateY(-50%) scale(1);
}

.ncp-3d-slide.prev {
    z-index: 5;
    transform: translateY(-50%) translateX(-30%) rotateY(45deg) scale(0.6);
}

.ncp-3d-slide.next {
    z-index: 5;
    transform: translateY(-50%) translateX(30%) rotateY(-45deg) scale(0.6);
}

.ncp-3d-slide.hidden {
    opacity: 0;
    pointer-events: none;
}

.ncp-3d-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: var(--accent-primary);
    color: var(--bg-primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: transform 0.2s ease;
}

.ncp-3d-nav:hover {
    transform: translateY(-50%) scale(1.1);
}

.ncp-3d-prev {
    left: 10px;
}

.ncp-3d-next {
    right: 10px;
}

/* Gallery Fade */
.ncp-gallery-fade {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius);
}

.ncp-fade-container {
    position: relative;
    aspect-ratio: 16/9;
}

.ncp-fade-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.ncp-fade-slide.active {
    opacity: 1;
}

.ncp-fade-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ncp-fade-controls {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 10;
}

.ncp-fade-nav,
.ncp-fade-pause {
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease, background-color 0.2s ease;
}

.ncp-gallery-fade:hover .ncp-fade-nav,
.ncp-gallery-fade:hover .ncp-fade-pause {
    opacity: 1;
}

.ncp-fade-nav:hover,
.ncp-fade-pause:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* Gallery Tile (Masonry) */
.ncp-gallery-tile {
    column-count: 3;
    column-gap: 16px;
}

.ncp-gallery-tile .ncp-gallery-item {
    break-inside: avoid;
    margin-bottom: 16px;
    border-radius: var(--border-radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.ncp-gallery-tile .ncp-gallery-item:hover {
    transform: scale(1.02);
}

.ncp-gallery-tile .ncp-gallery-item img {
    width: 100%;
    display: block;
}

/* ========================================
   Manga Viewer
======================================== */
.ncp-manga-viewer {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.ncp-manga-page {
    width: 100%;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ncp-manga-page img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

.ncp-manga-page.loading {
    background: var(--bg-secondary);
}

.ncp-manga-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 400px;
    background: var(--bg-secondary);
}

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

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

.ncp-manga-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 80px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
    transition: opacity 0.3s ease, background-color 0.2s ease;
    z-index: 10;
}

.ncp-manga-nav:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.6);
}

.ncp-manga-prev {
    left: 0;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.ncp-manga-next {
    right: 0;
    border-radius: var(--border-radius) 0 0 var(--border-radius);
}

.ncp-manga-counter {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    z-index: 10;
}

/* ========================================
   Lightbox (Modal)
======================================== */
.ncp-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ncp-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.ncp-lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.ncp-lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

.ncp-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.ncp-lightbox-close:hover {
    opacity: 1;
}

.ncp-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.ncp-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.3);
}

.ncp-lightbox-prev {
    left: -70px;
}

.ncp-lightbox-next {
    right: -70px;
}

/* ========================================
   Copy Button
======================================== */
.ncp-copy-btn {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid #555;
    color: #d4d4d4;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.ncp-copy-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #000;
}

.ncp-copy-btn.copied {
    background: #46b450;
    border-color: #46b450;
    color: #fff;
}

/* ========================================
   Breadcrumb
======================================== */
.ncp-breadcrumb {
    margin-bottom: 24px;
    font-size: 0.9rem;
}

.ncp-breadcrumb ol {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
}

.ncp-breadcrumb li {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
}

.ncp-breadcrumb li:not(:last-child)::after {
    content: '>';
    margin: 0 10px;
    color: var(--text-secondary);
    opacity: 0.5;
}

.ncp-breadcrumb a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.ncp-breadcrumb a:hover {
    opacity: 0.8;
}

.ncp-breadcrumb li[aria-current="page"] {
    color: var(--text-primary);
    font-weight: 600;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================
   Single Page
======================================== */
.single-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

.single-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-primary);
    margin: 0 0 16px 0;
    line-height: 1.3;
}

.single-meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 24px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.single-meta time {
    display: flex;
    align-items: center;
    gap: 4px;
}

.single-thumbnail {
    margin-bottom: 32px;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.single-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
}

.single-content {
    font-family: var(--font-body);
    color: var(--text-primary);
    line-height: 1.8;
    margin-bottom: 40px;
}

.single-content p {
    margin: 0 0 1.5em 0;
}

.single-content p:last-child {
    margin-bottom: 0;
}

.single-content a {
    color: var(--accent-primary);
}

.single-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
}

/* Single Navigation */
.single-nav {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    border-top: 1px solid var(--card-border);
    padding-top: 24px;
    margin-top: 40px;
}

.single-nav .nav-prev,
.single-nav .nav-next {
    flex: 1;
    max-width: 45%;
}

.single-nav .nav-next {
    text-align: right;
}

.single-nav a {
    color: var(--accent-primary);
    text-decoration: none;
    display: block;
    padding: 12px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.single-nav a:hover {
    background: var(--accent-primary);
    color: var(--bg-primary);
    border-color: var(--accent-primary);
}

/* Video Player */
.single-video-player {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    margin-bottom: 32px;
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
}

.single-video-player iframe,
.single-video-player video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Manga Info */
.single-manga-cover {
    margin-bottom: 24px;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.single-manga-cover img {
    width: 100%;
    height: auto;
    display: block;
}

.single-manga-info {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.manga-episode,
.manga-series,
.manga-status {
    background: var(--accent-primary);
    color: var(--bg-primary);
    padding: 6px 14px;
    border-radius: var(--border-radius);
    font-size: 0.85rem;
    font-weight: bold;
}

.manga-series {
    background: var(--accent-secondary);
}

/* Series Navigation */
.ncp-series-navigation {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--card-border);
}

.ncp-series-prev,
.ncp-series-list,
.ncp-series-next {
    flex: 1;
    padding: 16px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    text-decoration: none;
    transition: all 0.2s ease;
}

.ncp-series-prev:hover,
.ncp-series-list:hover,
.ncp-series-next:hover {
    border-color: var(--accent-primary);
}

.ncp-series-list {
    text-align: center;
}

.ncp-series-next {
    text-align: right;
}

.ncp-nav-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.ncp-nav-title {
    display: block;
    color: var(--accent-primary);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ncp-nav-disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* ========================================
   Responsive
======================================== */
@media (max-width: 1024px) {
    .ncp-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ncp-gallery-tile {
        column-count: 2;
    }

    .ncp-gallery-3d {
        height: 300px;
    }
}

@media (max-width: 768px) {
    .ncp-bubble {
        flex-direction: column;
        align-items: flex-start;
    }

    .ncp-bubble-body::before,
    .ncp-bubble-body::after {
        display: none;
    }

    .ncp-gallery-grid {
        grid-template-columns: 1fr;
    }

    .ncp-gallery-tile {
        column-count: 1;
    }

    .ncp-gallery-3d {
        height: 250px;
    }

    .ncp-3d-slide {
        width: 80%;
        left: 10%;
    }

    .ncp-lightbox-prev {
        left: 10px;
    }

    .ncp-lightbox-next {
        right: 10px;
    }

    .ncp-manga-nav {
        width: 40px;
        height: 60px;
        font-size: 18px;
    }

    /* Single page responsive */
    .single-container {
        padding: 20px 16px;
    }

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

    .single-nav {
        flex-direction: column;
    }

    .single-nav .nav-prev,
    .single-nav .nav-next {
        max-width: 100%;
        text-align: left;
    }

    .ncp-series-navigation {
        flex-direction: column;
    }

    .ncp-series-prev,
    .ncp-series-list,
    .ncp-series-next {
        text-align: left;
    }

    /* Breadcrumb responsive */
    .ncp-breadcrumb li[aria-current="page"] {
        max-width: 150px;
    }
}

@media (max-width: 480px) {
    .ncp-field {
        margin-bottom: 16px;
    }

    .ncp-card,
    .ncp-quote,
    .ncp-highlight {
        padding: 16px;
    }

    .ncp-slider-nav,
    .ncp-3d-nav {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .ncp-fade-controls {
        bottom: 10px;
    }
}
