:root {
    color-scheme: dark;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #111;
    color: #eee;
}

a {
    color: #d2b648;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.header-logo {
    display: block;
    margin: 20px auto 10px;
    max-width: 260px;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.3));
}

.brand-heading {
    margin: 20px 0 30px;
    text-align: center;
    font-family: 'Orbitron', Roboto, sans-serif;
    color: #f5f5f5;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.2), 0 0 10px rgba(210, 182, 72, 0.4);
    font-size: 2em;
}

.navbar {
    text-align: center;
    margin: 10px auto 0;
}

.navbar a,
.navbar span {
    color: #d2b648;
    text-decoration: none;
    margin: 0 8px;
}

.navbar a:hover {
    text-decoration: underline;
}

/* Thumbnail grid */
.thumb-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    width: 75%;
    max-width: 900px;
    margin: 10px auto;
}

.thumb-grid img,
.thumb-row img {
    flex: 0 0 calc(20% - 8px);
    width: calc(20% - 8px);
    max-width: 160px;
    aspect-ratio: 2 / 3;
    height: auto;
    border-radius: 4px;
    border: 1px solid #444;
    object-fit: cover;
    object-position: center;
}

.thumb-row {
    display: flex;
    gap: 8px;
    width: 100%;
    justify-content: center;
}

.thumb-row.top-row img {
    align-self: flex-end;
}

.thumb-row.bottom-row img {
    align-self: flex-start;
}

.thumb-img.thumb-placeholder {
    background: linear-gradient(135deg, #1d212c, #0f1117);
    color: #9fb3c8;
    object-fit: contain;
}

/* Buttons */
.big-btn {
    display: inline-block;
    padding: 14px 28px;
    margin: 20px 12px;
    font-size: 1.1em;
    font-weight: 600;
    text-decoration: none;
    color: #fff;
    background: #444;
    border: 1px solid #666;
    border-radius: 6px;
    transition: background .15s ease;
}

.big-btn:hover {
    background: #666;
}

.btn {
    display: inline-block;
    padding: 8px 14px;
    font-weight: 600;
    color: #fff;
    background: #444;
    border: 1px solid #666;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}

.btn:hover {
    background: #666;
    border-color: #888;
}

.btn.secondary {
    background: #2f5b89;
    border-color: #3c76b3;
}

.btn.secondary:hover {
    background: #3c76b3;
}

.btn.danger {
    background: #7d2b2b;
    border-color: #a34141;
}

.btn.danger:hover {
    background: #a34141;
}

.btn.glow {
    padding: 10px 22px;
    margin: 8px;
    font-size: 1rem;
    background: #d2b648;
    color: #000;
    border: none;
}

.btn.glow:hover {
    background: #e0c96a;
}

button {
    padding: 10px 20px;
    background: #444;
    color: #fff;
    border: 1px solid #666;
    border-radius: 4px;
    cursor: pointer;
    margin: 0 10px;
}

button:hover {
    background: #666;
}

/* Forms on landing page */
.upload-form {
    width: 80%;
    max-width: 900px;
    margin: 30px auto;
    border: 1px solid #444;
    padding: 20px;
    border-radius: 6px;
    background: #1a1a1a;
}

.upload-form fieldset {
    border: 1px solid #555;
    border-radius: 4px;
    margin-bottom: 25px;
    padding: 15px;
}

.upload-form label {
    display: block;
    width: 90%;
    margin: .8rem auto .4rem;
}

.required-field {
    border-left: 3px solid #d2b648;
    padding-left: 10px;
    border-radius: 4px;
    background: linear-gradient(90deg, rgba(210, 182, 72, 0.08), rgba(210, 182, 72, 0.02));
}

.upload-form input[type=text],
.upload-form textarea,
.upload-form select,
.upload-form input[type=date] {
    width: 90%;
    margin: 0 auto;
    display: block;
    padding: 8px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #222;
    color: #eee;
}

.upload-form input[type=file] {
    margin: 10px auto;
    display: block;
    color: #eee;
}

.preview {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 1rem 0;
}

.preview figure {
    width: 180px;
    height: 180px;
    margin: 0;
    border: 1px dashed #555;
    border-radius: 4px;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.preview figure figcaption {
    position: absolute;
    top: -1.4em;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: .8em;
    color: #aaa;
}

.preview figure.image-preview {
    width: 220px;
    height: 220px;
}

.preview img:not([src]) {
    display: none;
}

.preview img {
    max-width: 100%;
    max-height: 100%;
    border: none;
    border-radius: 0;
    object-fit: contain;
}

.image-preview-stage {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #0d0d0d;
    border-radius: 4px;
}

#wmOverlayPreview {
    position: absolute;
    opacity: 0.85;
    pointer-events: none;
    max-width: 80%;
    transition: transform 0.2s ease, top 0.2s ease, left 0.2s ease, right 0.2s ease, bottom 0.2s ease, width 0.2s ease;
}

#wmOverlayPreview.hidden {
    display: none;
}

.collapsible {
    border: 1px solid #444;
    border-radius: 6px;
    background: #151515;
    margin-top: 16px;
    overflow: hidden;
}

.collapsible summary {
    list-style: none;
    cursor: pointer;
    padding: 12px 14px;
    color: #ddd;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.collapsible summary:hover,
.collapsible summary:focus-visible {
    background: #1e1e1e;
    outline: none;
}

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

.collapsible summary::after {
    content: '\25bc';
    font-size: 0.8em;
    color: #aaa;
    transition: transform 0.2s ease;
}

.collapsible[open] summary::after {
    transform: rotate(-180deg);
}

.collapsible .collapsible-body {
    padding: 0 14px 14px;
    border-top: 1px solid #2a2a2a;
}

.advanced-watermark .advanced-body,
.optional-fields .collapsible-body {
    padding: 0 14px 14px;
}

.advanced-watermark .hint,
.optional-fields .hint {
    margin: 12px 0 12px;
    color: #aaa;
    font-size: .9em;
}

.advanced-watermark .inline-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.advanced-watermark label {
    flex: 1 1 200px;
}

.size-readout {
    display: inline-block;
    margin-left: 8px;
    color: #ccc;
    font-size: .9em;
}

.optional-fields {
    margin-top: 24px;
}

.notice,
.fine-print {
    font-size: .85em;
    text-align: center;
    color: #aaa;
    margin-top: 25px;
}

.small-note {
    font-size: .9em;
}

.accent-link {
    color: #d2b648;
    text-decoration: none;
}

.accent-link:hover {
    text-decoration: underline;
}

/* Utility helpers */
.text-center {
    text-align: center;
}

.mt-10 {
    margin-top: 10px;
}

.mt-18 {
    margin-top: 18px;
}

.mt-20 {
    margin-top: 20px;
}

.grid-span-full {
    grid-column: 1 / -1;
}

.flex-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.inline-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Auth pages */
.auth-form {
    max-width: 420px;
    margin: 4em auto;
    padding: 2em;
    background: #222;
    border-radius: 8px;
    border: 1px solid #444;
}

.auth-form input,
.auth-form button {
    width: 100%;
    padding: .6em;
    margin: .4em 0;
    background: #333;
    border: 1px solid #444;
    color: #eee;
}

.auth-form .error {
    color: #e74c3c;
}

/* Processing page */
.processing-page {
    background-color: #000;
    color: #ccc;
    text-align: center;
    margin: 20px;
}

.processing-page h1 {
    color: #d2b648;
}

.processing-page #steps {
    width: 80%;
    margin: 20px auto;
    text-align: left;
    max-height: 70vh;
    overflow-y: auto;
    padding: 10px;
    background-color: #222;
    border-radius: 8px;
}

.processing-page .step {
    margin: 10px 0;
    padding: 10px;
    background-color: #333;
    border-radius: 4px;
    font-family: monospace;
}

.processing-page .step.success {
    color: #2ecc71;
}

.processing-page .step.error {
    color: #e74c3c;
}

.processing-page .step.info {
    color: #3498db;
}

.processing-page .step.download {
    color: #f1c40f;
    font-size: 1.8em;
    font-weight: bold;
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 1.2rem;
}

/* Dashboard-style pages */
.page-container {
    width: 90%;
    max-width: 1100px;
    margin: 0 auto 40px;
}

.card {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 18px;
    margin: 18px 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.card h2 {
    margin-top: 0;
    color: #f0e9cf;
    font-size: 1.2em;
}

label,
form label {
    display: block;
    color: #ddd;
    margin-bottom: 10px;
}

input[type=file] {
    color: #eee;
    margin-top: 6px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th,
td {
    padding: .75rem;
    border-bottom: 1px solid #333;
    text-align: left;
    vertical-align: top;
    color: #eee;
}

th {
    color: #d2b648;
    letter-spacing: .03em;
}

tr:hover {
    background: #151515;
}

img.thumb {
    max-height: 70px;
    border-radius: 4px;
    border: 1px solid #444;
    background: #000;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid #555;
    background: #222;
    color: #9fd28d;
    font-size: .85em;
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.alerts {
    margin: 10px 0 4px;
}

.alert {
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    border: 1px solid;
    background: #0f0f0f;
}

.alert.success {
    border-color: #2c7a4b;
    color: #9fe4b7;
}

.alert.error {
    border-color: #a34141;
    color: #ffc2c2;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.muted {
    color: #aaa;
    font-size: .9em;
}

.textarea-full,
input[type=text],
textarea {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #444;
    background: #222;
    color: #eee;
    font-size: 1em;
}

textarea {
    min-height: 140px;
    resize: vertical;
}

.licence-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.licence-panel {
    border: 1px solid #333;
    border-radius: 10px;
    background: linear-gradient(135deg, #1a1a1a, #131313);
    overflow: hidden;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.licence-panel.open {
    border-color: #d2b648;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.licence-toggle {
    width: 100%;
    background: none;
    border: none;
    color: inherit;
    text-align: left;
    padding: 14px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
}

.licence-toggle:focus-visible {
    outline: 2px solid #d2b648;
    outline-offset: 2px;
}

.licence-summary {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px;
    width: 100%;
}

.licence-title {
    font-size: 1.05em;
    font-weight: 600;
    color: #f0e9cf;
}

.licence-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.licence-snippet {
    color: #bbb;
    font-size: .92em;
    margin-top: 4px;
    grid-column: 1 / -1;
}

.chevron {
    transition: transform .2s ease;
    color: #d2b648;
}

.licence-panel.open .chevron {
    transform: rotate(180deg);
}

.licence-body {
    padding: 0 16px 16px;
    border-top: 1px solid #222;
}

.licence-body .lic-text {
    margin: 14px 0;
}

.licence-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.status-message {
    display: none;
    margin-bottom: 8px;
}

/* Public artwork lookup layout */
.artwork-page {
    max-width: 960px;
    margin: 0 auto 80px;
    padding: 10px 16px 40px;
}

.artwork-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    background: linear-gradient(145deg, rgba(32, 32, 40, 0.8), rgba(20, 20, 24, 0.95));
    border: 1px solid #2d2d36;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.artwork-card.not-found {
    display: block;
    text-align: center;
}

.artwork-visual {
    display: flex;
    align-items: center;
    justify-content: center;
}

.artwork-thumb {
    width: 100%;
    max-width: 420px;
    border-radius: 8px;
    border: 1px solid #3a3a45;
    background: #0d0f14;
    object-fit: cover;
    aspect-ratio: 2 / 3;
}

.artwork-thumb.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9fb3c8;
    font-weight: 600;
    background: linear-gradient(135deg, #1d212c, #0f1117);
}

.artwork-meta h2 {
    margin: 0 0 6px;
    font-size: 1.8rem;
}

.artwork-subtitle {
    margin: 0 0 14px;
    color: #cfcfcf;
    font-weight: 500;
}

.artwork-field {
    margin: 10px 0;
}

.artwork-field dt {
    font-weight: 700;
    color: #d2b648;
    margin-bottom: 4px;
}

.artwork-field dd {
    margin: 0;
    color: #e7e7e7;
    line-height: 1.5;
}

.artwork-meta dl {
    margin: 0 0 16px;
}

.artwork-note {
    margin: 12px 0 0;
    color: #9fb3c8;
}

@media (max-width: 768px) {
    .artwork-card {
        grid-template-columns: 1fr;
    }

    .artwork-thumb {
        max-width: 100%;
    }
}
