
:root {
    color-scheme: dark;
    --background: #0b1020;
    --surface: #151d31;
    --surface-light: #1c2941;
    --border: #293751;
    --text: #edf2ff;
    --muted: #98a7c2;
    --primary: #6387ff;
    --primary-hover: #4c70e8;
    --success: #42c994;
    --danger: #ff7777;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

a {
    color: #91aaff;
    text-decoration: none;
}

a:hover {
    color: white;
}

h1, h2, h3, p {
    margin-top: 0;
}

h1 {
    font-size: 30px;
    margin-bottom: 8px;
}

h2 {
    font-size: 20px;
    margin-bottom: 14px;
}

.muted {
    color: var(--muted);
}

.topbar {
    min-height: 68px;
    padding: 12px 5%;
    background: #10182a;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    font-size: 19px;
    font-weight: 800;
    color: white;
}

.topbar nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-label {
    color: var(--muted);
}

.container {
    width: min(1120px, 92%);
    margin: 38px auto;
}

.welcome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

.upload-card,
.detail-card,
.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
}

.upload-card form {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 18px;
}

input:not([type="checkbox"]):not([type="file"]) {
    width: 100%;
    min-width: 0;
    padding: 12px 14px;
    color: var(--text);
    background: #0c1425;
    border: 1px solid var(--border);
    border-radius: 9px;
    outline: none;
}

input:focus {
    border-color: var(--primary);
}

input[type="file"] {
    max-width: 100%;
    color: var(--muted);
}

label {
    display: block;
    margin: 14px 0 7px;
    font-size: 14px;
    font-weight: 650;
}

button {
    border: 0;
    border-radius: 9px;
    padding: 12px 17px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s ease;
}

button.primary {
    color: white;
    background: var(--primary);
}

button.primary:hover {
    background: var(--primary-hover);
}

button.secondary {
    color: var(--text);
    background: var(--surface-light);
    border: 1px solid var(--border);
}

button.small {
    padding: 8px 12px;
}

button.full {
    width: 100%;
    margin-top: 20px;
}

.inline-form {
    display: inline;
    margin: 0;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 34px 0 16px;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 18px;
}

.image-card {
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 13px;
    color: var(--text);
    transition: transform .15s ease, border-color .15s ease;
}

.image-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
}

.image-preview {
    height: 170px;
    background: #080e1b;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.remote-placeholder {
    color: var(--muted);
}

.image-info {
    padding: 13px;
    display: grid;
    gap: 5px;
    overflow-wrap: anywhere;
}

.status {
    display: inline-block;
    color: var(--muted);
    font-size: 12px;
    text-transform: capitalize;
}

.success-text {
    color: var(--success);
}

.pending-text {
    color: #e9bc70;
}

.empty-state {
    padding: 55px 20px;
    text-align: center;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: 14px;
}

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
}

.login-card {
    width: min(420px, 100%);
    padding: 36px;
    text-align: center;
}

.login-card form {
    text-align: left;
    margin-top: 26px;
}

.brand-mark {
    width: 58px;
    height: 58px;
    margin: 0 auto 20px;
    display: grid;
    place-items: center;
    border-radius: 17px;
    background: var(--primary);
    color: white;
    font-size: 22px;
    font-weight: 900;
}

.login-footer {
    color: var(--muted);
    font-size: 12px;
    margin: 26px 0 0;
}

.alert {
    border-radius: 10px;
    padding: 13px 15px;
    margin: 16px 0;
    overflow-wrap: anywhere;
}

.alert.error {
    background: #4a202b;
    color: #ffd6dd;
    border: 1px solid #8c394b;
}

.alert.success {
    background: #173c32;
    color: #c4ffe9;
    border: 1px solid #286b55;
}

.back-link {
    display: inline-block;
    margin-bottom: 22px;
}

.detail-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    overflow-wrap: anywhere;
}

.large-preview {
    max-height: 560px;
    margin: 22px 0;
    padding: 12px;
    background: #080e1b;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.large-preview img {
    max-width: 100%;
    max-height: 530px;
    object-fit: contain;
}

.link-section {
    margin-top: 25px;
}

.copy-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.copy-row input {
    flex: 1;
}

.backup-list {
    display: grid;
}

.backup-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 17px 0;
    border-bottom: 1px solid var(--border);
}

.backup-row:last-child {
    border-bottom: 0;
}

.backup-links {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.error-text {
    color: var(--danger);
    font-size: 12px;
    margin-top: 5px;
    overflow-wrap: anywhere;
}

.admin-form {
    max-width: 520px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 18px 0;
}

.user-table {
    width: 100%;
    overflow-x: auto;
}

.user-table-row {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr 1fr;
    gap: 12px;
    padding: 13px 8px;
    border-bottom: 1px solid var(--border);
    min-width: 600px;
}

.user-table-header {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

@media (max-width: 650px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar nav {
        width: 100%;
        flex-wrap: wrap;
        gap: 12px;
    }

    .container {
        margin-top: 25px;
    }

    .upload-card,
    .detail-card {
        padding: 17px;
    }

    .copy-row {
        align-items: stretch;
        flex-direction: column;
    }

    .backup-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .user-table-row {
        min-width: 560px;
    }
}

/* Multi-image uploader */
.uploader-card {
    overflow: hidden;
}

.uploader-heading,
.queue-heading,
.results-heading,
.upload-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.uploader-heading h2 {
    margin-bottom: 7px;
}

.upload-limit-note {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.dropzone {
    margin-top: 22px;
    padding: 38px 20px;
    text-align: center;
    border: 2px dashed var(--border);
    border-radius: 14px;
    background: rgba(255,255,255,.015);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

.dropzone:hover,
.dropzone.drag-active {
    border-color: var(--primary);
    background: rgba(80,120,255,.07);
}

.dropzone-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 13px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: var(--surface-light);
    color: var(--primary);
    font-size: 30px;
    font-weight: 700;
}

.dropzone h3 {
    margin: 0 0 7px;
}

.dropzone p {
    margin: 0 0 17px;
}

.dropzone-formats {
    display: block;
    margin-top: 15px;
    color: var(--muted);
    font-size: 12px;
}

.queue-heading {
    margin: 24px 0 13px;
}

.queue-heading .muted {
    margin-left: 8px;
    font-size: 12px;
}

.upload-queue {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

.queue-item {
    position: relative;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    padding: 12px;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 11px;
}

.queue-preview {
    width: 58px;
    height: 58px;
    overflow: hidden;
    border-radius: 8px;
    background: #0c1425;
}

.queue-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.queue-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.queue-info strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

.queue-info .muted,
.queue-status {
    font-size: 11px;
    overflow-wrap: anywhere;
}

.queue-item-actions button {
    padding: 6px 8px;
    font-size: 11px;
}

.progress-track {
    grid-column: 1 / -1;
    height: 5px;
    overflow: hidden;
    border-radius: 10px;
    background: #0c1425;
}

.progress-bar {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: var(--primary);
    transition: width .15s ease;
}

.upload-actions {
    justify-content: flex-start;
    margin-top: 18px;
}

.upload-actions .muted {
    font-size: 13px;
}

.results-heading {
    margin: 30px 0 14px;
}

.results-heading h3 {
    margin: 0;
}

.upload-results {
    display: grid;
    gap: 15px;
}

.result-card {
    min-width: 0;
    padding: 15px;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.result-card-top {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 14px;
}

.result-preview {
    width: 68px;
    height: 68px;
    flex: 0 0 68px;
    object-fit: cover;
    border-radius: 9px;
    background: #0c1425;
}

.result-details {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.result-details strong {
    overflow-wrap: anywhere;
}

.result-details .muted,
.result-details .status {
    font-size: 12px;
}

.result-formats {
    display: grid;
    gap: 8px;
}

.format-row {
    display: grid;
    grid-template-columns: 75px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
}

.format-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

.format-row input {
    min-width: 0;
    width: 100%;
    padding: 9px 10px !important;
    font-size: 12px;
    font-family: monospace;
}

.format-row button {
    padding: 8px 11px;
    font-size: 11px;
}

.result-page-link {
    display: inline-block;
    margin-top: 12px;
    color: var(--primary);
    font-size: 13px;
    font-weight: 650;
}

@media (max-width: 600px) {
    .uploader-heading,
    .queue-heading,
    .results-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .upload-limit-note {
        white-space: normal;
    }

    .dropzone {
        padding: 28px 13px;
    }

    .format-row {
        grid-template-columns: 1fr auto;
        gap: 6px;
    }

    .format-label {
        grid-column: 1 / -1;
    }

    .format-row input {
        font-size: 11px;
    }

    .upload-actions {
        align-items: flex-start;
        flex-direction: column;
    }
}
