/* Degu-Traum Foto Uploader - Modernes Stylesheet */

/* ------------------- */
/* 1. CSS Variablen & Globale Styles */
/* ------------------- */
:root {
    /* Neue Degu-inspirierte Farben */
    --primary-color: #8B5CF6; /* Violett, ansprechend und fröhlich */
    --primary-color-hover: #7C3AED;
    --success-color: #10B981; /* Grün für Erfolg */
    --error-color: #EF4444;   /* Rot für Fehler */

    --bg-primary: #F3F4F6;    /* Sehr helles Grau/Beige als Hintergrund */
    --bg-surface: #FFFFFF;    /* Reinweiß für Karten */
    --text-primary: #1F2937;  /* Dunkelgrau/Schwarz */
    --text-secondary: #6B7280;/* Mittleres Grau für sekundäre Texte */
    --text-light: #9CA3AF;;    /* Helles Grau */
    --border-color: #E5E7EB;  /* Dezente Trennlinien */
    
    /* Leichtere, weichere Akzente */
    --primary-light-bg: #F5F3FF; /* Für Hover/Active States */
    --secondary-bg: #EAEAEA;     /* Für graue Inputs */
    --view-header-bg: #F9FAFB; /* Sehr helles Grau für den View-Sidebar Header */

    --font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --border-radius: 0.75rem;
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.modal-open {
    overflow: hidden;
}

main {
    flex-grow: 1;
    padding: 2rem 0;
}

.container {
    width: 95%;
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
}

h1,
.h1 {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

h2,
.h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

h3,
.h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

p {
    line-height: 1.6;
    margin-top: 0;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-color-hover);
    text-decoration: underline;
}

hr {
    border: 0;
    height: 1px;
    background-color: var(--border-color);
    margin: 2rem 0;
}

/* ------------------- */
/* 2. Komponenten */
/* ------------------- */

/* ----- Navbar ----- */
.navbar {
    background-color: var(--bg-surface);
    box-shadow: var(--shadow-sm);
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--text-primary);
}

.nav-brand:hover {
    color: var(--text-primary);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links a {
    font-weight: 500;
    color: var(--text-secondary);
}

.nav-links a:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.nav-links .admin-link {
    font-weight: 600;
    color: var(--primary-color);
}

.nav-links .btn {
    font-size: 0.9rem;
    padding: 0.5rem 1.25rem;
}

/* ----- Footer ----- */
.footer {
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    color: var(--text-secondary);
    margin-top: auto;
}

.footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer p {
    margin: 0;
    font-size: 0.9rem;
}

.footer nav {
    display: flex;
    gap: 1.5rem;
}

.footer nav a {
    color: var(--text-secondary);
}

/* ----- Buttons ----- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background-color: var(--primary-color-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.btn:disabled {
    background-color: #d1d5db;
    color: #6b7280;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background-color: var(--bg-primary);
    border-color: #d1d5db;
    transform: translateY(-2px);
}

.btn-link {
    background: none;
    border: none;
    padding: 0;
    color: var(--primary-color);
    text-decoration: underline;
    cursor: pointer;
}

/* ----- Spinner ----- */
.spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    width: 1rem;
    height: 1rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ----- Karten ----- */
.card {
    background-color: var(--bg-surface);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    padding: 2.5rem;
    border: 1px solid var(--border-color);
}

/* ----- Formulare ----- */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-input,
.form-select,
textarea.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    background-color: var(--secondary-bg); /* Helles Grau als Hintergrund für Input */
    border-radius: 0.5rem;
    box-sizing: border-box;
    font-size: 1rem;
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus,
textarea.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15); /* Angepasste Schattenfarbe */
    background-color: var(--bg-surface);
}

/* ----- Drop Area ----- */
#drop-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    background-color: var(--secondary-bg); /* Hintergrundfarbe wie Input, um Kontrast zu vermeiden */
    transition: all 0.3s ease;
}

#drop-area p {
    margin: 0.5rem 0;
}

#drop-area.drag-active {
    border-color: var(--primary-color);
    background-color: var(--primary-light-bg); /* Helle Akzentfarbe bei Drag */
    transform: scale(1.02);
}

/* ----- Alerts ----- */
.alert {
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 0.75rem;
    border-width: 1px;
    border-style: solid;
    font-size: 0.95rem;
}

.alert-success {
    background-color: #F0FFF4; /* Sehr helles Grün */
    border-color: var(--success-color);
    color: #065F46;
}

.alert-error {
    background-color: #FEF2F2; /* Sehr helles Rot */
    border-color: var(--error-color);
    color: #991B1B;
}

/* ----- Cookie Banner ----- */
.cookie-banner {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    max-width: 500px;
    background-color: var(--bg-surface);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transform: translateY(200%);
    transition: transform 0.5s ease-in-out;
}

.cookie-banner.show {
    transform: translateY(0);
}

.cookie-banner-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
}

.cookie-banner-text p {
    margin-bottom: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.cookie-banner-text a {
    color: var(--primary-color);
    text-decoration: underline;
}

.cookie-title {
    font-weight: 600;
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

/* ------------------- */
/* 3. Seiten-spezifische & komplexe Komponenten */
/* ------------------- */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 200px);
    /* Adjust based on header/footer height */
}

.auth-card {
    width: 100%;
    max-width: 450px;
}

/* ----- Index: Upload-Schritte (Neu) ----- */
#upload-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    padding: 0 1rem;
}

.step-line {
    position: absolute;
    top: 50%;
    left: 1rem;
    right: 1rem;
    height: 3px;
    background-color: var(--border-color);
    transform: translateY(-50%);
    z-index: 1;
}

.step-item {
    position: relative;
    z-index: 2;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    color: var(--text-secondary);
    background-color: var(--secondary-bg);
    border: 3px solid var(--border-color);
    transition: all 0.3s;
}

.step-item.active {
    color: white;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-light-bg);
}

.step-item.completed {
    color: white;
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.step-label {
    position: absolute;
    top: 150%;
    font-size: 0.8rem;
    font-weight: 500;
    width: 100px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-secondary);
}

.step-item.active .step-label {
    color: var(--primary-color);
    font-weight: 700;
}

/* ----- Index: Bild-Vorschau ----- */
.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.preview-item {
    position: relative;
    aspect-ratio: 1 / 1;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.preview-remove-btn {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    background-color: var(--error-color);
    color: white;
    border-radius: 9999px;
    width: 1.75rem;
    height: 1.75rem;
    border: 2px solid var(--bg-surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s;
    line-height: 1;
    font-size: 1.25rem;
    padding-bottom: 2px;
}

.preview-item:hover .preview-remove-btn {
    opacity: 1;
    transform: scale(1.1);
}

/* ----- Modal Styles ----- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(31, 41, 55, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}

.modal-content {
    background-color: var(--bg-surface);
    padding: 2rem;
    border-radius: var(--border-radius);
    max-width: 550px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95) translateY(10px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    margin: 0;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 0;
    line-height: 1;
}

.modal-close-btn:hover {
    color: var(--text-primary);
}

.modal-footer {
    padding-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* ----- Profil Seite ----- */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .profile-grid {
        grid-template-columns: 320px 1fr;
    }
}

.profile-avatar {
    width: 8rem;
    height: 8rem;
    border-radius: 9999px;
    object-fit: cover;
    border: 4px solid var(--bg-surface);
    margin: -6rem auto 1rem;
    box-shadow: var(--shadow-lg);
    display: block;
}

.profile-card {
    margin-top: 4rem;
    text-align: center;
}

.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.image-gallery-item {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.image-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.image-gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 0.75rem;
    gap: 0.5rem;
}

.image-gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

.gallery-action-btn {
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
    border: none;
    border-radius: 50%;
    width: 2.25rem;
    height: 2.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.gallery-action-btn:hover {
    background: white;
    transform: scale(1.1);
}

/* ----- View Seite (Fullscreen Image Viewer) ----- */
.view-page {
    /* Dunkler Hintergrund für immersive Ansicht */
    background-color: #111827; 
}

.view-page main {
    padding: 0;
}

/* Verbesserte Navigationspfeile (heller und größer) */
.view-nav-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.4); /* Hellerer Hintergrund */
    color: white;
    border: none;
    border-radius: 50%;
    width: 3.5rem;
    height: 3.5rem;
    cursor: pointer;
    z-index: 10;
    font-size: 2rem;
    font-weight: 300;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    transition: background-color 0.2s, transform 0.2s;
    box-shadow: var(--shadow-md);
}

.view-nav-btn:hover {
    background-color: rgba(255, 255, 255, 0.6); /* Hellerer Hover-Effekt */
    transform: translateY(-50%) scale(1.05);
}

.view-nav-btn.close {
    top: 1rem;
    right: 1rem;
    transform: none;
    width: 3rem;
    height: 3rem;
    font-size: 2rem;
    background-color: rgba(255, 255, 255, 0.4); /* Hellerer Close-Button */
}

.view-nav-btn.close:hover {
    transform: none;
}

.view-nav-btn.prev {
    left: 1.5rem;
}

.view-nav-btn.next {
    right: 1.5rem;
}

/* Anpassung der Container, um Überlappung zu verhindern */
.view-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    position: relative;
}

@media (min-width: 1024px) {
    .view-container {
        flex-direction: row;
    }
}

.view-image-wrapper {
    flex: 3;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Reduzierter Padding, um die Nav-Buttons freizuhalten */
    padding: 4rem 6rem; 
    position: relative;
    overflow: hidden; /* Sicherstellen, dass nichts überläuft */
}

@media (max-width: 1023px) {
    .view-image-wrapper {
        flex: none;
        height: 60vh;
        width: 100%;
        padding: 4rem 1rem 1rem; /* Platz für Close-Button oben */
    }
}

.view-image-wrapper img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.view-sidebar {
    flex: 1;
    min-width: 320px;
    max-width: 400px;
    background-color: var(--bg-surface);
    padding: 0; /* Entfernen des Paddings hier, um es in Header/Body zu verlagern */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    color: var(--text-primary);
}

.view-sidebar-header {
    background-color: var(--view-header-bg); /* Hellerer, abgesetzter Hintergrund für Kontrast */
    padding: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.view-sidebar-body {
    padding: 2rem;
    flex-grow: 1;
}

.view-sidebar-footer {
    padding: 2rem;
    border-top: 1px solid var(--border-color);
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1.5rem 0;
}

.tag {
    background-color: var(--primary-light-bg); /* Heller Hintergrund */
    color: var(--primary-color);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
}

/* ----- Admin Layout ----- */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 260px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

/* Admin-Navigation mit Icons */
.admin-sidebar nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
}

.admin-sidebar nav a svg {
    width: 1.25rem;
    height: 1.25rem;
    stroke-width: 2.25;
}

.admin-sidebar nav a.active,
.admin-sidebar nav a:hover {
    background-color: var(--primary-light-bg);
    color: var(--primary-color-hover);
}

.admin-main {
    flex: 1;
    padding: 2rem;
    background-color: var(--bg-primary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.stats-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
}

.stats-card h3 {
    color: var(--text-secondary);
    font-size: 1rem;
}

.stats-card p {
    font-size: 2.25rem;
    font-weight: bold;
    margin: 0;
}

.table-wrapper {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.admin-table th {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-table tbody tr:hover {
    background-color: #f8fafc;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.pagination a,
.pagination span {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    text-decoration: none;
    border-radius: 0.5rem;
}

.pagination a:hover {
    background: #f1f5f9;
}

.pagination span.current,
.pagination a.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}
