/* ============================================
   FreeITSM - Modules Page Styles
   ============================================ */

/* --- Quick Jump Navigation --- */
.quick-jump {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-md) 0;
    position: sticky;
    /* Header is ~95px tall (logo row + 2 wrapped nav rows due to nav-break),
       so quick-jump must clear that — was 70px which let the pills get
       clipped under the header */
    top: 100px;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

/* Make anchor jumps land below both stickies (header + quick-jump) so the
   target section header isn't hidden behind them */
html {
    scroll-padding-top: 165px;
}

.quick-jump .container {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    justify-content: center;
}

/* Forces a row break between pills 7 and 8 so wide screens render as 7 + 10 */
.quick-jump-break {
    flex-basis: 100%;
    height: 0;
    margin: 0;
    padding: 0;
}

/* Mobile: row breaks would fight with the horizontal scroll behaviour, so
   make the break invisible to flex by taking it out of the flow */
@media (max-width: 768px) {
    .quick-jump-break {
        display: none;
    }
}

.quick-jump-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: var(--text-xs);
    font-weight: 600;
    text-decoration: none;
    color: white;
    transition: var(--transition);
    opacity: 0.85;
}

.quick-jump-pill:hover {
    opacity: 1;
    transform: translateY(-1px);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.quick-jump-pill svg {
    width: 14px;
    height: 14px;
}

/* --- Module Section --- */
.module-section {
    padding: var(--space-4xl) 0;
    border-bottom: 1px solid var(--color-border);
}

.module-section:last-of-type {
    border-bottom: none;
}

.module-section:nth-child(even) {
    background: var(--color-bg-alt);
}

/* Two-column top row (info | screenshot) with a full-width features row beneath.
   Uses display: contents on .module-info to dissolve the wrapper so its children
   become direct grid items of .module-layout — that way features can sit in its
   own full-width row instead of being squeezed inside the info column. */
.module-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
        "title    screenshot"
        "tagline  screenshot"
        "desc     screenshot"
        "features features"
        "wiki     wiki";
    column-gap: var(--space-3xl);
    row-gap: 0;
    align-items: start;
}

/* Even sections: screenshot on the left, info on the right */
.module-section:nth-child(even) .module-layout {
    grid-template-areas:
        "screenshot title"
        "screenshot tagline"
        "screenshot desc"
        "features   features"
        "wiki       wiki";
}

.module-info        { display: contents; }
.module-title-row   { grid-area: title; }
.module-tagline     { grid-area: tagline; }
.module-description { grid-area: desc; }
.module-screenshot  { grid-area: screenshot; align-self: center; }
.module-features    { grid-area: features; }

.module-wiki-link {
    grid-area: wiki;
    margin-top: 18px;
    font-size: 0.9rem;
    color: #555;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    padding: 6px 0;
    border-bottom: 1px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}
.module-wiki-link:hover {
    color: var(--color-primary, #0078d4);
    border-bottom-color: currentColor;
}
.module-wiki-link svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.module-title-row {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
}

.module-title-row h2 {
    font-size: var(--text-3xl);
    margin: 0;
}

.module-tagline {
    font-size: var(--text-lg);
    color: var(--color-text-light);
    font-style: italic;
    margin-bottom: var(--space-xl);
}

.module-description {
    margin-bottom: var(--space-xl);
}

.module-description p {
    font-size: var(--text-base);
    line-height: 1.8;
}

.module-features {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm) var(--space-xl);
    margin-top: var(--space-2xl);
    padding-top: var(--space-xl);
    border-top: 1px solid var(--color-border);
}

.module-features li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    padding: 4px 0;
}

.module-features li::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    min-width: 18px;
    border-radius: 50%;
    background: rgba(45, 106, 79, 0.1);
    position: relative;
    top: 1px;
}

/* Colour-coded checkmarks per module */
.module-section[data-module="tickets"] .module-features li::before { background: rgba(0, 120, 212, 0.15); }
.module-section[data-module="assets"] .module-features li::before { background: rgba(16, 124, 16, 0.15); }
.module-section[data-module="knowledge"] .module-features li::before { background: rgba(135, 100, 184, 0.15); }
.module-section[data-module="changes"] .module-features li::before { background: rgba(0, 137, 123, 0.15); }
.module-section[data-module="calendar"] .module-features li::before { background: rgba(239, 108, 0, 0.15); }
.module-section[data-module="checks"] .module-features li::before { background: rgba(0, 172, 193, 0.15); }
.module-section[data-module="reporting"] .module-features li::before { background: rgba(202, 80, 16, 0.15); }
.module-section[data-module="software"] .module-features li::before { background: rgba(92, 107, 192, 0.15); }
.module-section[data-module="forms"] .module-features li::before { background: rgba(0, 137, 123, 0.15); }
.module-section[data-module="wiki"] .module-features li::before { background: rgba(198, 40, 40, 0.15); }
.module-section[data-module="contracts"] .module-features li::before { background: rgba(245, 158, 11, 0.15); }
.module-section[data-module="service-status"] .module-features li::before { background: rgba(16, 185, 129, 0.15); }
.module-section[data-module="watchtower"] .module-features li::before { background: rgba(30, 41, 59, 0.15); }

/* Module screenshot area */
.module-screenshot {
    border-radius: var(--radius-lg);
    aspect-ratio: 16 / 9;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    color: var(--color-text-light);
    font-size: var(--text-sm);
    overflow: hidden;
}

/* Placeholder style when no carousel is present */
.module-screenshot:not(:has(.module-carousel)) {
    background: var(--color-surface);
    border: 2px dashed var(--color-border);
}

.module-screenshot > svg {
    width: 48px;
    height: 48px;
    opacity: 0.3;
}

/* --- Module Carousel --- */
.module-carousel {
    position: relative;
    width: 100%;
    height: 100%;
    background: var(--color-bg-alt);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.module-carousel .carousel-images {
    position: relative;
    width: 100%;
    height: 100%;
}

.module-carousel .carousel-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.module-carousel .carousel-img.active {
    opacity: 1;
    pointer-events: auto;
}

.module-carousel .carousel-prev,
.module-carousel .carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s;
}

.module-carousel .carousel-prev:hover,
.module-carousel .carousel-next:hover {
    background: rgba(0, 0, 0, 0.8);
}

.module-carousel .carousel-prev {
    left: 12px;
}

.module-carousel .carousel-next {
    right: 12px;
}

.module-carousel.has-multiple .carousel-prev,
.module-carousel.has-multiple .carousel-next {
    display: flex;
}

.module-carousel .carousel-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    gap: 8px;
    z-index: 10;
}

.module-carousel.has-multiple .carousel-dots {
    display: flex;
}

.module-carousel .carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: background 0.2s;
}

.module-carousel .carousel-dot:hover {
    background: rgba(255, 255, 255, 0.8);
}

.module-carousel .carousel-dot.active {
    background: white;
}

/* --- Lightbox --- */
.lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
}

.lightbox-overlay.active {
    display: flex;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 85vh;
    position: relative;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 85vh;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
    transition: opacity 0.35s ease, transform 0.35s ease;
    opacity: 1;
    transform: scale(1) translateX(0);
}

.lightbox-content img.slide-out-left {
    opacity: 0;
    transform: scale(0.92) translateX(-60px);
}

.lightbox-content img.slide-out-right {
    opacity: 0;
    transform: scale(0.92) translateX(60px);
}

.lightbox-content img.slide-in-left {
    opacity: 0;
    transform: scale(0.92) translateX(60px);
    transition: none;
}

.lightbox-content img.slide-in-right {
    opacity: 0;
    transform: scale(0.92) translateX(-60px);
    transition: none;
}

.lightbox-close {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

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

.lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

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

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-caption {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.8);
    font-size: var(--text-sm);
    text-align: center;
    padding: 8px 20px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: var(--radius-md);
    white-space: nowrap;
}

.module-screenshot {
    cursor: pointer;
}

/* Tablet / narrow desktop — features drop from 3 columns to 2 so they don't
   get squashed before the full mobile layout kicks in */
@media (max-width: 1024px) {
    .module-features {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .module-layout,
    .module-section:nth-child(even) .module-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "title"
            "tagline"
            "desc"
            "screenshot"
            "features";
    }

    .module-features {
        grid-template-columns: 1fr;
    }

    .quick-jump .container {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .quick-jump .container::-webkit-scrollbar {
        display: none;
    }

    .quick-jump-pill {
        white-space: nowrap;
    }
}
