/* ── Reset & Base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:          #0b0d13;
    --surface:     #12151e;
    --surface-2:   #181c28;
    --surface-3:   #1e2336;
    --border:      #252b40;
    --border-2:    #2e3650;
    --primary:     #3b7ff5;
    --primary-h:   #2c6fe0;
    --primary-glow:rgba(59,127,245,.25);
    --text:        #e4eaf6;
    --text-muted:  #7a85a3;
    --text-dim:    #4a5470;
    --danger:      #ef4444;
    --danger-h:    #dc2626;
    --success:     #22c55e;
    --warning:     #f59e0b;
    --radius:      10px;
    --radius-sm:   6px;
    --radius-lg:   14px;
    --shadow:      0 4px 24px rgba(0,0,0,.45);
    --shadow-sm:   0 2px 8px rgba(0,0,0,.3);
    --transition:  .18s ease;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-h); text-decoration: underline; }

/* ── Container ───────────────────────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 1340px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
    white-space: nowrap;
    text-decoration: none;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 12px var(--primary-glow);
}
.btn-primary:hover {
    background: var(--primary-h);
    color: #fff;
    box-shadow: 0 4px 20px var(--primary-glow);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-2);
}
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover { background: var(--danger-h); color: #fff; }

.btn-sm { padding: 6px 14px; font-size: .8rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    margin-bottom: 20px;
}
.alert-error   { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; }
.alert-success { background: rgba(34,197,94,.12);  border: 1px solid rgba(34,197,94,.3);  color: #86efac;  }

/* ── Auth Pages ──────────────────────────────────────────────────────────── */
.auth-page {
    background: var(--bg);
    background-image:
        radial-gradient(ellipse 60% 40% at 50% -10%, rgba(59,127,245,.12) 0%, transparent 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-wrap {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    box-shadow: var(--shadow);
}

.auth-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}
.auth-logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.01em;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
    letter-spacing: -.02em;
}
.auth-subtitle {
    color: var(--text-muted);
    font-size: .9rem;
    margin-bottom: 28px;
}

.auth-form { display: flex; flex-direction: column; gap: 18px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}
.field input, .select {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 10px 14px;
    font-size: .9rem;
    width: 100%;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    font-family: inherit;
}
.field input:focus, .select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.field input::placeholder { color: var(--text-dim); }
.field small { color: var(--text-dim); font-size: .78rem; }

.auth-switch {
    text-align: center;
    color: var(--text-muted);
    font-size: .875rem;
    margin-top: 24px;
}

/* ── Navbar ──────────────────────────────────────────────────────────────── */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.navbar-inner {
    max-width: 1340px;
    margin: 0 auto;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: -.01em;
}
.nav-brand:hover { color: var(--text); text-decoration: none; }
.nav-right { display: flex; align-items: center; gap: 10px; }
.nav-user {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: .875rem;
    padding: 6px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: border-color var(--transition), color var(--transition);
}
a.nav-user:hover { border-color: var(--border-2); color: var(--text); text-decoration: none; }

/* ── Stats Bar ───────────────────────────────────────────────────────────── */
.stats-bar {
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    padding: 12px 0;
}
.stats-inner {
    display: flex;
    gap: 32px;
}
.stat { display: flex; flex-direction: column; }
.stat-value { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.stat-label { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }

/* ── Gallery Grid ────────────────────────────────────────────────────────── */
main.container { padding-top: 32px; padding-bottom: 60px; }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

/* ── Image Card ──────────────────────────────────────────────────────────── */
.image-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.image-card:hover {
    border-color: var(--border-2);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.image-thumb {
    position: relative;
    aspect-ratio: 4/3;
    background: var(--surface-2);
    overflow: hidden;
}
.image-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s ease;
}
.image-card:hover .image-thumb img { transform: scale(1.04); }

.thumb-error::after {
    content: '⚠ Bild nicht verfügbar';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    color: var(--text-dim);
    background: var(--surface-2);
}

.image-overlay {
    position: absolute;
    inset: 0;
    background: rgba(11,13,19,.7);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    transition: opacity var(--transition);
}
.image-card:hover .image-overlay { opacity: 1; }

.overlay-btn {
    width: 38px; height: 38px;
    border-radius: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), border-color var(--transition), transform .1s;
    text-decoration: none;
}
.overlay-btn:hover { background: var(--surface-3); border-color: var(--primary); transform: scale(1.08); text-decoration: none; color: var(--text); }
.overlay-btn.danger:hover { background: rgba(239,68,68,.2); border-color: var(--danger); }

.image-info {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.image-name {
    font-size: .83rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.image-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: .72rem;
    color: var(--text-muted);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 7px;
}
.meta-warn { color: var(--warning); border-color: rgba(245,158,11,.3); background: rgba(245,158,11,.08); }

/* ── Empty State ─────────────────────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 80px 24px;
    text-align: center;
}
.empty-state svg { color: var(--text-dim); }
.empty-state h2 { font-size: 1.25rem; color: var(--text); }
.empty-state p { color: var(--text-muted); }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.7);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn .15s ease;
}
.modal-backdrop.open { display: flex; }

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }

.modal {
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    box-shadow: 0 20px 60px rgba(0,0,0,.6);
    animation: slideUp .18s ease;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
}
.modal-sm { max-width: 360px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}
.modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: color var(--transition), background var(--transition);
    display: flex;
}
.modal-close:hover { color: var(--text); background: var(--surface-2); }

.modal-body { padding: 20px 24px 24px; }

.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ── Dropzone ────────────────────────────────────────────────────────────── */
.dropzone {
    position: relative;
    border: 2px dashed var(--border-2);
    border-radius: var(--radius);
    transition: border-color var(--transition), background var(--transition);
    margin-bottom: 16px;
    cursor: pointer;
}
.dropzone:hover, .dropzone.drag-over {
    border-color: var(--primary);
    background: rgba(59,127,245,.05);
}
.dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}
.dropzone-inner {
    padding: 36px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    pointer-events: none;
}
.dropzone-inner svg { color: var(--text-dim); }
.dropzone-inner p { color: var(--text-muted); font-size: .9rem; }
.dropzone-inner p small { color: var(--text-dim); }
.drop-hint { font-size: .78rem; color: var(--text-dim); }

/* ── Upload Options ──────────────────────────────────────────────────────── */
.upload-options {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.upload-options label {
    font-size: .83rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}
.select {
    flex: 1;
    min-width: 160px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a85a3' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}
.select option { background: var(--surface-2); }

/* ── Upload Progress ─────────────────────────────────────────────────────── */
.upload-progress-list { display: flex; flex-direction: column; gap: 8px; }
.upload-item {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}
.upload-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: .83rem;
}
.upload-item-name { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }
.upload-item-status { color: var(--text-muted); font-size: .78rem; white-space: nowrap; }

.progress-bar-wrap {
    height: 4px;
    background: var(--surface-3);
    border-radius: 99px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 99px;
    transition: width .15s ease;
}
.progress-bar.done { background: var(--success); }
.progress-bar.error { background: var(--danger); }

/* ── Upload Results ──────────────────────────────────────────────────────── */
.upload-results { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.result-item {
    background: var(--surface-2);
    border: 1px solid rgba(34,197,94,.25);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.result-url {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: .78rem;
    color: var(--primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.copy-result-btn {
    background: none;
    border: 1px solid var(--border-2);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px 10px;
    font-size: .78rem;
    font-weight: 600;
    transition: all var(--transition);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}
.copy-result-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.copy-result-btn.copied { background: var(--success); color: #fff; border-color: var(--success); }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
    background: var(--surface-3);
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    font-size: .875rem;
    color: var(--text);
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .2s, transform .2s;
    pointer-events: none;
    max-width: 320px;
}
.toast.show {
    opacity: 1;
    transform: translateY(0);
}
.toast.success { border-color: rgba(34,197,94,.4); color: #86efac; }
.toast.error   { border-color: rgba(239,68,68,.4);  color: #fca5a5; }

/* ── Legal Pages ─────────────────────────────────────────────────────────── */
.legal-page {
    max-width: 760px;
    padding-top: 40px;
    padding-bottom: 60px;
}
.legal-page h1 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -.03em;
    margin-bottom: 6px;
}
.legal-sub {
    color: var(--text-muted);
    font-size: .875rem;
    margin-bottom: 36px;
}
.legal-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
}
.legal-section h2 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text);
}
.legal-section h3 {
    font-size: .9rem;
    font-weight: 600;
    color: var(--text);
    margin: 16px 0 6px;
}
.legal-section p { color: var(--text-muted); font-size: .875rem; line-height: 1.7; margin-bottom: 8px; }
.legal-section code {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: .82rem;
    font-family: monospace;
}
.back-link {
    display: inline-block;
    color: var(--text-muted);
    font-size: .875rem;
    margin-bottom: 24px;
    transition: color var(--transition);
}
.back-link:hover { color: var(--text); text-decoration: none; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 20px 0;
    margin-top: auto;
}
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.footer-copy { color: var(--text-dim); font-size: .8rem; }
.footer-nav { display: flex; gap: 20px; }
.footer-nav a { color: var(--text-muted); font-size: .8rem; }
.footer-nav a:hover { color: var(--text); }

/* ── Auth footer ─────────────────────────────────────────────────────────── */
.auth-footer {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}
.auth-footer a { color: var(--text-dim); font-size: .78rem; }
.auth-footer a:hover { color: var(--text-muted); }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
    .auth-card { padding: 28px 20px; }
    .navbar-inner { padding: 0 16px; }
    .nav-user { display: none; }
    .stats-inner { gap: 20px; }
}
@media (max-width: 420px) {
    .gallery-grid { grid-template-columns: 1fr 1fr; }
}
