* {
    box-sizing: border-box;
}

html {
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background: #0f1117;
    color: #f1f5f9;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(
            circle at top,
            #1b2030 0,
            #0f1117 45%
        );
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}


.site-header {
    position: sticky;
    top: 0;
    z-index: 100;

    border-bottom: 1px solid #252a38;

    background: rgba(15, 17, 23, 0.9);

    backdrop-filter: blur(16px);
}

.header-inner {
    max-width: 1500px;
    margin: auto;

    min-height: 68px;

    padding: 0 24px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.logo {
    font-size: 20px;
    font-weight: 800;
}

nav {
    display: flex;
    gap: 8px;
}

nav a {
    padding: 9px 13px;

    border-radius: 8px;

    color: #aab2c2;

    transition:
        background 0.15s,
        color 0.15s;
}

nav a:hover {
    background: #1c2130;
    color: #fff;
}


.container {
    width: min(1500px, calc(100% - 32px));

    margin: 0 auto;

    padding: 50px 0 100px;
}

.page-title {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 42px;
}

.page-title h1 {
    margin: 5px 0 0;

    font-size: clamp(30px, 5vw, 48px);
}

.eyebrow {
    text-transform: uppercase;

    font-size: 12px;
    font-weight: 800;

    letter-spacing: 0.14em;

    color: #8b95aa;
}


.login-card {
    width: min(440px, 100%);

    margin: 80px auto;

    padding: 40px;

    border: 1px solid #282e3c;

    border-radius: 18px;

    background: #171a23;

    box-shadow:
        0 25px 70px rgba(0, 0, 0, 0.35);
}

.login-card h1 {
    margin: 10px 0;
}

.login-icon {
    font-size: 38px;
}

.muted {
    color: #8e97aa;
    line-height: 1.6;
}


form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

label {
    margin-top: 8px;

    font-size: 14px;
    font-weight: 700;

    color: #cbd5e1;
}

input[type="text"],
input[type="password"],
input[type="file"] {
    width: 100%;

    padding: 12px 14px;

    border: 1px solid #303747;
    border-radius: 9px;

    outline: none;

    color: #f8fafc;

    background: #10131a;
}

input:focus {
    border-color: #64748b;
}

input[type="file"] {
    padding: 10px;
}

small {
    color: #7f899d;
}


.button {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    min-height: 38px;

    padding: 8px 13px;

    border: 1px solid #303747;
    border-radius: 8px;

    color: #dbe2ec;

    background: #1a1f2a;

    cursor: pointer;

    transition:
        background 0.15s,
        border-color 0.15s,
        transform 0.15s;
}

.button:hover {
    background: #252c3a;
    border-color: #414b5e;
}

.button:active {
    transform: translateY(1px);
}

.button-primary {
    border-color: #596a8a;
    background: #34415b;
}

.button-primary:hover {
    background: #40506e;
}

.button-success {
    border-color: #315d49;
    background: #183a2c;
}

.button-success:hover {
    background: #20503b;
}

.button-warning {
    border-color: #6b5330;
    background: #3d2d18;
}

.button-warning:hover {
    background: #503b20;
}


.alert {
    margin-bottom: 24px;

    padding: 14px 16px;

    border-radius: 10px;

    line-height: 1.5;
}

.alert-error {
    border: 1px solid #6b3434;
    background: #351c1f;
    color: #ffb4b4;
}

.alert-success {
    border: 1px solid #315d49;
    background: #183a2c;
    color: #a8e4c5;
}


.album-section {
    margin-bottom: 60px;
}

.album-header {
    margin-bottom: 18px;

    display: flex;
    justify-content: space-between;
    align-items: end;
}

.album-header h2 {
    margin: 0 0 4px;

    font-size: 25px;
}

.image-count {
    color: #7f899d;

    font-size: 13px;
}



.gallery-grid {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fill,
            minmax(220px, 1fr)
        );

    gap: 16px;
}

.gallery-card {
    overflow: hidden;

    border: 1px solid #272d3a;
    border-radius: 13px;

    background: #171a23;
}

.gallery-card > a {
    display: block;
}

.gallery-card img {
    display: block;

    width: 100%;
    aspect-ratio: 1 / 1;

    object-fit: cover;

    transition:
        transform 0.25s,
        opacity 0.25s;
}

.gallery-card:hover img {
    transform: scale(1.025);
}

.gallery-actions {
    padding: 10px;
}

.gallery-actions .button {
    width: 100%;
}



.backend-grid {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fill,
            minmax(280px, 1fr)
        );

    gap: 18px;
}

.backend-card {
    overflow: hidden;

    border: 1px solid #2a3140;
    border-radius: 13px;

    background: #171a23;
}

.backend-card.is-hidden {
    border-color: #634a2b;
}

.image-wrapper {
    position: relative;
}

.image-wrapper img {
    display: block;

    width: 100%;
    aspect-ratio: 4 / 3;

    object-fit: cover;
}

.status-badge {
    position: absolute;

    top: 10px;
    left: 10px;

    padding: 6px 9px;

    border-radius: 7px;

    background: #3d2d18;

    color: #ffc980;

    font-size: 12px;
    font-weight: 700;
}

.status-badge.visible {
    background: #183a2c;
    color: #a8e4c5;
}

.card-content {
    padding: 14px;
}

.filename {
    display: block;

    overflow: hidden;

    white-space: nowrap;
    text-overflow: ellipsis;
}

.date {
    display: block;

    margin-top: 4px;

    color: #7f899d;

    font-size: 12px;
}

.actions {
    display: flex;

    flex-wrap: wrap;

    gap: 7px;

    margin-top: 14px;
}

.actions form {
    display: contents;
}

.actions .button {
    flex: 1;
    min-width: 110px;
}



.upload-section {
    margin-top: 80px;

    padding: 30px;

    border: 1px solid #2b3240;
    border-radius: 16px;

    background: #151922;
}

.upload-header {
    max-width: 700px;

    margin-bottom: 28px;
}

.upload-header h2 {
    margin: 5px 0 10px;

    font-size: 28px;
}

.upload-header p {
    margin: 0;

    color: #8e97aa;

    line-height: 1.6;
}

.upload-form {
    max-width: 700px;
}

.form-group {
    display: flex;
    flex-direction: column;

    gap: 7px;
}


.upload-info {
    margin-top: 12px;

    padding: 10px;

    border-left: 3px solid #596a8a;

    background: #10131a;

    color: #aab2c2;

    font-size: 12px;

    line-height: 1.5;
}

.upload-info strong {
    color: #dbe2ec;
}

.upload-info span {
    display: block;

    margin-top: 3px;

    color: #747e92;
}



.empty {
    padding: 40px 20px;

    border: 1px dashed #303747;
    border-radius: 12px;

    color: #737d90;

    text-align: center;
}



@media (max-width: 700px) {

    .header-inner {
        min-height: 60px;

        padding: 0 15px;
    }

    nav a {
        padding: 7px 8px;

        font-size: 13px;
    }

    .container {
        width: min(
            100% - 20px,
            1500px
        );

        padding-top: 30px;
    }

    .page-title {
        align-items: flex-start;

        flex-direction: column;
    }

    .login-card {
        margin: 30px auto;

        padding: 28px 22px;
    }

    .gallery-grid {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );

        gap: 9px;
    }

    .backend-grid {
        grid-template-columns: 1fr;
    }

    .upload-section {
        padding: 22px 18px;
    }

}

@media (max-width: 400px) {

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

}


body.lightbox-open {
    overflow: hidden;
}

.lightbox {
    position: fixed;

    inset: 0;

    z-index: 1000;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 30px;

    background: rgba(0, 0, 0, 0.88);

    opacity: 0;
    visibility: hidden;

    transition:
        opacity 0.2s ease,
        visibility 0.2s ease;
}

.lightbox.is-open {
    opacity: 1;
    visibility: visible;
}


.lightbox-content {
    position: relative;

    max-width: 95vw;
    max-height: 92vh;

    display: flex;

    flex-direction: column;

    align-items: center;
    justify-content: center;

    transform: scale(0.96);

    transition:
        transform 0.2s ease;
}

.lightbox.is-open .lightbox-content {
    transform: scale(1);
}


.lightbox-content img {
    display: block;

    max-width: 95vw;
    max-height: 85vh;

    width: auto;
    height: auto;

    object-fit: contain;

    border-radius: 8px;

    box-shadow:
        0 20px 80px rgba(0, 0, 0, 0.6);
}


.lightbox-close {
    position: absolute;

    top: 18px;
    right: 22px;

    z-index: 10;

    width: 48px;
    height: 48px;

    padding: 0;

    border: 0;
    border-radius: 50%;

    color: #fff;

    background: rgba(30, 34, 44, 0.85);

    font-size: 34px;
    line-height: 1;

    cursor: pointer;

    transition:
        background 0.15s,
        transform 0.15s;
}

.lightbox-close:hover {
    background: rgba(65, 72, 88, 0.95);

    transform: scale(1.05);
}


.lightbox-caption {
    max-width: 90vw;

    margin-top: 12px;

    color: #cbd5e1;

    font-size: 13px;

    text-align: center;

    overflow: hidden;

    white-space: nowrap;

    text-overflow: ellipsis;
}



.image-open-button {
    display: block;

    width: 100%;

    padding: 0;

    border: 0;

    background: transparent;

    cursor: pointer;

    overflow: hidden;
}

.image-open-button img {
    display: block;

    width: 100%;

    aspect-ratio: 1 / 1;

    object-fit: cover;

    transition:
        transform 0.25s ease,
        opacity 0.2s ease;
}

.image-open-button:hover img {
    transform: scale(1.035);
}

.image-open-button:focus-visible {
    outline: 2px solid #718096;

    outline-offset: -2px;
}



.album-more {
    display: flex;

    justify-content: center;

    margin-top: 22px;
}

.album-more .button {
    min-width: 180px;
}

.album-more .button span {
    margin-left: 5px;

    color: #9aa5b7;
}



@media (max-width: 700px) {

    .lightbox {
        padding: 12px;
    }

    .lightbox-content img {
        max-width: 100vw;
        max-height: 82vh;

        border-radius: 4px;
    }

    .lightbox-close {
        top: 10px;
        right: 10px;

        width: 44px;
        height: 44px;
    }

    .lightbox-caption {
        max-width: 95vw;
    }

}