@import url(../../default.css);

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'VCR OSD Mono', monospace;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.page-header {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 150px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background-color: var(--panel);
    overflow: hidden;
    padding: 10px;
    box-sizing: border-box;
    overflow: clip;
    font-size: 2.5em;
    margin: 20px 0 20px 0;
}

.back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    padding: 8px 16px;
    background-color: var(--panel2);
    border: 2px solid var(--accent);
    color: var(--accent);
    text-decoration: none;
    font-family: 'VCR OSD Mono', monospace;
    font-size: 0.4em;
    letter-spacing: 1.2px;
    transition: all 0.3s ease;
    text-shadow: 0 0 6px rgba(255, 59, 88, 0.35);
}

.back-btn:hover {
    background-color: var(--accent);
    color: var(--bg);
    text-shadow: none;
    box-shadow: 0 0 20px rgba(255, 59, 88, 0.5);
}

.page-title {
    color: var(--accent);
    text-align: center;
    margin: 0 0 24px;
    letter-spacing: 1px;
}

.page-description {
    color: var(--text);
    text-align: center;
    margin: 0 0 32px;
    font-size: 18px;
    letter-spacing: 0.5px;
}

.titlebar {
    position: absolute;
    top: -50px;
    left: 20px;
    z-index: 10;
    padding: 4px 10px;
    font-weight: bold;
    letter-spacing: 1.5px;
    font-size: 1.2em;
    color: var(--accent);
    text-shadow: 0 0 6px rgba(217, 74, 92, 0.35);
}

.btnimg {
    position: absolute;
    top: -30px;
    right: 0;
    z-index: 10;
}

.favicon {
    position: absolute;
    top: -30px;
    left: 0;
    z-index: 10;
}

.content-box {
    border: 1px solid var(--border);
    border-radius: 15px;
    background-color: var(--panel);
    width: 95%;
    height: 750px;
    padding: 20px;
    box-sizing: border-box;
    gap: 10px;
    align-self: center;
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    grid-template-rows: 1fr;
    overflow: hidden;
}

.grid-box {
    position: relative;
    border: 5px solid transparent;
    border-top: 35px solid transparent;
    border-image: url(../../images/border2.png) 5 stretch;
    background-color: var(--panel2);
    padding: 0px;
    margin: 10px;
    max-height: 700px;
    box-sizing: border-box;
    align-items: center;
    justify-items: center;
    width: 100%;
    min-width: 0;
    box-shadow: 0 0 15px rgba(255, 59, 88, 0.3);
    display: flex;
    flex-direction: column;
    overflow: visible;
}

/* ─── Gallery list (left panel) ─── */
.gallery-list-scroll {
    overflow-y: auto;
    flex: 1;
    padding: 4px;
    box-sizing: border-box;
    min-height: 0;
    width: 100%;
}

.gallery-list-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-family: 'VCR OSD Mono', monospace;
    font-size: 0.9em;
    padding: 10px 8px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, color 0.15s;
}

.gallery-list-item:hover {
    background: rgba(255, 59, 88, 0.1);
    color: var(--accent);
}

.gallery-list-item.active {
    background: rgba(255, 59, 88, 0.2);
    color: var(--accent);
}

.gallery-list-name {
    font-weight: bold;
    font-size: 1em;
}

.gallery-list-desc {
    font-size: 0.75em;
    opacity: 0.7;
    line-height: 1.3;
}

.gallery-list-count {
    font-size: 0.7em;
    color: var(--accent);
    opacity: 0.8;
}

/* ─── Image grid (center panel) ─── */
.image-grid-scroll {
    overflow-y: auto;
    flex: 1;
    padding: 10px;
    box-sizing: border-box;
    min-height: 0;
    width: 100%;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
}

.image-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
    background: var(--panel);
}

.image-item:hover {
    border-color: var(--accent);
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(255, 59, 88, 0.4);
    z-index: 5;
}

.image-item.selected {
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(255, 59, 88, 0.5);
}

.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-name-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.7) 70%, transparent 100%);
    color: var(--text);
    padding: 8px 6px 6px;
    font-size: 0.65em;
    line-height: 1.2;
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.image-item:hover .image-name-overlay {
    opacity: 1;
    transform: translateY(0);
}

.loading-text {
    text-align: center;
    padding: 40px;
    color: var(--muted);
    font-size: 0.9em;
}

/* ─── Image info (right panel) ─── */
.image-info-scroll {
    overflow-y: auto;
    flex: 1;
    padding: 10px;
    box-sizing: border-box;
    min-height: 0;
    width: 100%;
}

.info-empty {
    font-size: 0.8em;
    color: var(--text);
    opacity: 0.5;
    padding: 10px;
    text-align: center;
}

.info-preview {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border: 1px solid var(--border);
    margin-bottom: 12px;
}

.info-section {
    margin-bottom: 16px;
}

.info-label {
    font-size: 0.7em;
    color: var(--accent);
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.info-value {
    font-size: 0.75em;
    color: var(--text);
    line-height: 1.5;
    opacity: 0.85;
}

.info-button {
    width: 100%;
    background: rgba(255, 59, 88, 0.1);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-family: 'VCR OSD Mono', monospace;
    font-size: 0.8em;
    padding: 8px;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 8px;
}

.info-button:hover {
    background: rgba(255, 59, 88, 0.2);
}

/* ─── Lightbox ─── */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border: 3px solid var(--accent);
}

.lightbox-caption {
    color: var(--text);
    margin-top: 15px;
    font-size: 1em;
    text-align: center;
    font-family: 'VCR OSD Mono', monospace;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 40px;
    color: var(--accent);
    cursor: pointer;
    background: var(--panel);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--accent);
    transition: all 0.3s;
    user-select: none;
}

.lightbox-close:hover {
    background: var(--accent);
    color: var(--text);
    transform: rotate(90deg);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 40px;
    color: var(--accent);
    cursor: pointer;
    background: var(--panel);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--accent);
    transition: all 0.3s;
    user-select: none;
}

.lightbox-nav:hover {
    background: var(--accent);
    color: var(--text);
}

.lightbox-nav.prev {
    left: 20px;
}

.lightbox-nav.next {
    right: 20px;
}

/* ─── Responsive ─── */
@media (max-width: 1100px) {
    .content-box {
        width: 98%;
    }
}

@media (max-width: 900px) {
    .page-header {
        font-size: 2em;
        height: auto;
        padding: 20px;
    }

    .content-box {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        height: auto;
        min-height: 600px;
        width: 100%;
        margin: 0;
        padding: 10px;
    }

    .grid-box {
        margin: 5px;
        max-height: none;
    }

    .gallery-list-box {
        max-height: 200px;
    }

    .image-grid-box {
        min-height: 400px;
    }

    .image-info-box {
        max-height: 300px;
    }

    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

@media (max-width: 520px) {
    .page-header {
        font-size: 1.5em;
        padding: 16px 12px;
        margin: 20px 0 12px 0;
    }

    .page-description {
        font-size: 14px;
    }

    .content-box {
        width: 100%;
        border-radius: 0;
        border-left: none;
        border-right: none;
        padding: 10px 5px;
    }

    .grid-box {
        margin: 5px 0;
    }

    .titlebar {
        font-size: 1em;
        left: 10px;
    }

    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 6px;
    }

    .lightbox-nav, .lightbox-close {
        width: 40px;
        height: 40px;
        font-size: 30px;
    }
}
