/* ============================================================
   studiOcircle Design System
   Projekt-spezifische Styles, die Bootstrap nicht abdeckt.
   Bootstrap-Klassen immer bevorzugen!
   ============================================================ */

/* ------------------------------------------------------------
   1. CSS Custom Properties (Design Tokens)
   ------------------------------------------------------------ */
:root {
    /* Farben */
    --sc-primary:          #3498db;
    --sc-secondary:        #2ecc71;
    --sc-danger:           #e74c3c;
    --sc-bg:               #000000;
    --sc-text:             #ffffff;
    --sc-surface:          rgba(13, 27, 42, 0.95);
    --sc-border:           rgba(255, 255, 255, 0.1);

    /* Spacing */
    --sc-spacing-unit:     8px;
    --sc-spacing-xs:       4px;
    --sc-spacing-sm:       8px;
    --sc-spacing-md:       16px;
    --sc-spacing-lg:       24px;
    --sc-spacing-xl:       32px;

    /* Border Radius */
    --sc-radius:           8px;
    --sc-radius-sm:        4px;
    --sc-radius-lg:        12px;
    --sc-radius-pill:      50px;

    /* Transitions */
    --sc-transition:       all 0.3s ease;
    --sc-transition-fast:  all 0.2s ease;

    /* Shadows */
    --sc-shadow-sm:        2px 2px 8px rgba(0, 0, 0, 0.15);
    --sc-shadow-md:        0 4px 15px rgba(0, 0, 0, 0.3);
    --sc-shadow-lg:        0 8px 25px rgba(0, 0, 0, 0.4);

    /* Z-Index Scale */
    --sc-z-overlay:        1040;
    --sc-z-modal:          9999;
    --sc-z-loading:        10000;
}

/* ------------------------------------------------------------
   2. Global Overrides (minimal, nur was Bootstrap nicht bietet)
   ------------------------------------------------------------ */
html, body {
    height: 100%;
    background-color: var(--sc-bg);
    color: var(--sc-text);
}

body {
    padding-top: 2rem;
    display: flex;
    flex-direction: column;
}

/* Main Page Layout */
main.page {
    flex: 1;
    padding-top: 5rem !important; /* Platz für fixierte Navbar */
    margin: 0 1rem;
    background-color: var(--sc-bg);
}

/* Footer pinned to bottom */
.page-footer {
    margin-top: auto;
}

/* Weniger Rand auf mobilen Geräten */
@media (max-width: 576.98px) {
    .container {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }
}

/* ------------------------------------------------------------
   3. Navbar Customizations
   ------------------------------------------------------------ */
.navbar {
    background-color: var(--sc-bg) !important;
}

.navbar-brand {
    color: var(--sc-text) !important;
    margin: 0 !important;
    padding: 0 !important;
}

.navbar-nav .nav-link {
    color: var(--sc-text) !important;
}

.navbar-toggler {
    border: none;
    padding: 0.25rem 0.1rem;
    margin-left: auto;
    display: flex;
    align-items: center;
}

.navbar-toggler:focus {
    box-shadow: none;
}

@media (max-width: 576.98px) {
    .navbar-toggler {
        margin-top: 1rem;
        align-self: flex-start;
    }
}

/* Logo */
.logo-img {
    height: 4.5rem;
    width: auto;
    object-fit: contain;
    filter: invert(1);
    margin: 0 !important;
    padding: 0 !important;
}

/* Avatar sizes (reusable via class) */
.avatar-sm {
    width: 30px;
    height: 30px;
    object-fit: cover;
}

.avatar-md {
    width: 40px;
    height: 40px;
    object-fit: cover;
}

.avatar-lg {
    width: 120px;
    height: 120px;
    object-fit: cover;
}

/* ------------------------------------------------------------
   4. Photo Card – Projekt-spezifische Foto-Komponente
   ------------------------------------------------------------ */
.photo-card {
    position: relative;
    overflow: hidden;
    transition: var(--sc-transition-fast);
    cursor: pointer;
    box-shadow: var(--sc-shadow-sm);
    aspect-ratio: 1;
}

.photo-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--sc-shadow-md);
}

.photo-card__img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.photo-card__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* ------------------------------------------------------------
   5. Album Grid
   ------------------------------------------------------------ */
.album-grid {
    display: grid;
    gap: 1rem;
}

.album-card {
    cursor: pointer;
    transition: var(--sc-transition-fast);
}

.album-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--sc-shadow-md) !important;
}

.album-card:hover .album-add-btn {
    background-color: #e9ecef !important;
}

/* Album thumbnail grid (2x2) */
.album-thumb-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem;
}

.album-thumb-grid__item {
    aspect-ratio: 1;
    overflow: hidden;
    box-shadow: var(--sc-shadow-sm);
}

.album-thumb-grid__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ------------------------------------------------------------
   6. Upload Dropzone
   ------------------------------------------------------------ */
.upload-dropzone {
    cursor: pointer;
    transition: var(--sc-transition);
    border: 2px dashed var(--bs-border-color, #dee2e6) !important;
}

.upload-dropzone:hover {
    transform: translateY(-2px);
    box-shadow: var(--sc-shadow-sm);
}

.upload-dropzone.is-active,
.upload-dropzone.drop-zone-active {
    border-color: var(--bs-primary, #0d6efd) !important;
    background-color: rgba(13, 110, 253, 0.1) !important;
    border-width: 3px !important;
}

/* Dashed border utility */
.border-dashed {
    border-style: dashed !important;
}

/* ------------------------------------------------------------
   7. Synology Sync Badge
   ------------------------------------------------------------ */
.synology-sync-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25em 0.65em;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--sc-radius-pill);
    background-color: #17a2b8;
    color: #fff;
}

.synology-sync-badge--synced {
    background-color: var(--bs-success, #198754);
}

.synology-sync-badge--pending {
    background-color: var(--bs-warning, #ffc107);
    color: #212529;
}

.synology-sync-badge--error {
    background-color: var(--bs-danger, #dc3545);
}

/* ------------------------------------------------------------
   8. Gallery / Filter Section – Surface Style
   ------------------------------------------------------------ */
.sc-surface {
    background: var(--sc-surface);
    border-radius: var(--sc-radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--sc-border);
}

/* ------------------------------------------------------------
   9. Photo Preview Overlay
   ------------------------------------------------------------ */
.photo-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-preview-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-preview-close,
.photo-preview-nav {
    background: rgb(233, 233, 233);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2010;
    transition: var(--sc-transition);
}

.photo-preview-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
}

.photo-preview-close:hover,
.photo-preview-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.photo-preview-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
}

.photo-preview-nav:hover {
    transform: translateY(-50%) scale(1.1);
}

.photo-preview-nav-left  { left: 30px; }
.photo-preview-nav-right { right: 30px; }

.photo-preview-image-container {
    position: relative;
    max-width: 90%;
    max-height: 85%;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: pan-y pinch-zoom;
}

#preview-image {
    max-width: 100%;
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
}

.photo-preview-info {
    position: absolute;
    bottom: 30px;
    right: 30px;
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.6);
    padding: 10px 20px;
    border-radius: var(--sc-radius);
    backdrop-filter: blur(10px);
}

#preview-photo-title {
    font-size: 14px;
    font-weight: 500;
}

@media (max-width: 768px) {
    .photo-preview-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }
    .photo-preview-nav {
        width: 50px;
        height: 50px;
    }
    .photo-preview-nav-left  { left: 10px; }
    .photo-preview-nav-right { right: 10px; }
    .photo-preview-image-container {
        max-width: 95%;
        max-height: 75%;
    }
    #preview-image {
        max-height: 70vh;
    }
    .photo-preview-info {
        bottom: 10px;
        right: 10px;
        left: 10px;
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }
    #preview-photo-title { font-size: 12px; }
}

@media (min-width: 1400px) {
    .photo-preview-image-container {
        max-width: 85%;
        max-height: 90%;
    }
    #preview-image { max-height: 85vh; }
}

/* ------------------------------------------------------------
   10. Original Image Overlay
   ------------------------------------------------------------ */
.original-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1050;
    display: flex;
    justify-content: center;
    align-items: center;
}

.overlay-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    background: #343a40;
    border-radius: var(--sc-radius);
    overflow: hidden;
}

.overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #495057;
    border-bottom: 1px solid #6c757d;
}

.zoom-controls {
    display: flex;
    gap: 10px;
}

.overlay-image-container {
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    max-height: 80vh;
    overflow: auto;
}

#originalImage {
    max-width: 100%;
    max-height: 100%;
    transition: transform 0.3s ease;
    cursor: move;
    border-radius: var(--sc-radius-sm);
}

/* ------------------------------------------------------------
   11. Image Display (Detail Page)
   ------------------------------------------------------------ */
.image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    padding: 20px;
    width: 100%;
}

#photoImage {
    border: 2px solid #6c757d;
    transition: border-color 0.2s ease;
    max-width: min(400px, 80vw);
    max-height: min(400px, 60vh);
    width: auto;
    height: auto;
    object-fit: contain;
}

#photoImage:hover {
    border-color: #0d6efd;
}

@media (max-width: 768px) {
    .image-container {
        min-height: 300px;
        padding: 10px;
    }
    #photoImage {
        max-width: min(400px, 90vw);
        max-height: min(400px, 50vh);
    }
}

@media (min-width: 769px) {
    .image-container {
        min-height: 500px;
    }
    #photoImage {
        max-width: min(400px, 70vw);
        max-height: min(400px, 70vh);
    }
}

/* Responsive Zentrierung Detail-Seite */
@media (max-width: 767.98px) {
    .col-md-5.pe-md-4.pe-2 {
        display: flex;
        justify-content: center;
        margin-bottom: 2rem;
    }
}

/* Info Scroll Container */
.info-scroll-container {
    max-height: 80vh;
    overflow-y: auto;
    padding-right: 8px;
    transition: var(--sc-transition);
}

@media (max-width: 768px) {
    .info-scroll-container {
        max-height: none;
        overflow-y: visible;
        padding-right: 0;
    }
}

.info-scroll-container::-webkit-scrollbar {
    width: 6px;
}

.info-scroll-container::-webkit-scrollbar-track {
    background: rgba(108, 117, 125, 0.3);
    border-radius: 3px;
}

.info-scroll-container::-webkit-scrollbar-thumb {
    background: rgba(13, 110, 253, 0.7);
    border-radius: 3px;
}

.info-scroll-container::-webkit-scrollbar-thumb:hover {
    background: rgba(13, 110, 253, 0.9);
}

/* ------------------------------------------------------------
   12. Management View
   ------------------------------------------------------------ */
.editable-field {
    cursor: pointer;
    border-radius: 3px;
    padding: 2px 4px;
    transition: background-color 0.2s;
}

.editable-field:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.editable-field .field-edit {
    min-width: 150px;
    font-size: inherit;
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid #6c757d;
}

.editable-field .field-edit:focus {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.field-display {
    color: white;
}

.saving-indicator {
    opacity: 0.6;
    pointer-events: none;
}

.property-hidden {
    display: none !important;
}

.white-icon {
    filter: brightness(0) invert(1);
}

.bulk-actions-toolbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--sc-surface);
    backdrop-filter: blur(10px);
}

/* Management layout responsive */
@media (min-width: 992px) {
    .photo-management-item  { width: 50% !important; }
    .editing-panel-container { width: 50% !important; }
}

@media (min-width: 1200px) {
    .photo-management-item  { width: 33.333333% !important; }
    .editing-panel-container { width: 33.333333% !important; }
}

@media (max-width: 991.98px) {
    .editing-panel-container {
        width: 100% !important;
        order: -1;
    }
}

.editing-panel {
    position: sticky;
    top: 20px;
    height: fit-content;
}

/* ------------------------------------------------------------
   13. Form Customizations (Dark Theme)
   ------------------------------------------------------------ */
.form-control-dark {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: #6c757d;
    color: white;
}

.form-control-dark:focus {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: var(--sc-primary);
    color: var(--sc-text);
    box-shadow: 0 0 0 0.25rem rgba(52, 152, 219, 0.25);
}

/* ------------------------------------------------------------
   14. Utility Classes (non-Bootstrap)
   ------------------------------------------------------------ */
.text-shadow {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

/* Icon size helpers */
.icon-xs { width: 12px; height: 12px; }
.icon-sm { width: 14px; height: 14px; }
.icon-md { width: 16px; height: 16px; }
.icon-lg { width: 20px; height: 20px; }
.icon-xl { width: 30px; height: 30px; }

/* Filter panel (search_filter_panel.html) */
.filter-content.collapsed {
    display: none !important;
}

.filter-toggle-btn {
    transition: transform 0.3s ease;
}

.filter-toggle-btn.collapsed {
    transform: rotate(180deg);
}

/* Drop zone active state */
.drop-zone-active {
    border: 3px solid #0d6efd !important;
    background-color: rgba(13, 110, 253, 0.1) !important;
}

/* Drag active for album drop */
#album-drop-zone.drag-active {
    outline: 3px dashed #0d6efd;
    outline-offset: -3px;
    background: rgba(13, 110, 253, 0.03);
    border-radius: var(--sc-radius-lg);
}

/* ------------------------------------------------------------
   15. Utility Classes – Inline-Style-Ersatz
   ------------------------------------------------------------ */

/* Aspect-ratio square + cover (photo cards, thumbnails) */
.aspect-square {
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

/* Placeholder container (same ratio, no img) */
.aspect-square-placeholder {
    aspect-ratio: 1 / 1;
}

/* Thumbnails in mobile strips / management list */
.thumb-sm {
    width: 60px;
    height: 60px;
    object-fit: cover;
}

.thumb-md {
    width: 80px;
    height: 80px;
}

.thumb-lg {
    width: 100px;
    height: 100px;
    overflow: hidden;
}

/* Dashed add-more / placeholder button */
.dashed-placeholder {
    aspect-ratio: 1;
    border: 2px dashed var(--bs-border-color, #dee2e6);
}

/* Small badge text (tags, albums, meta info) */
.badge-xs {
    font-size: 0.7rem;
}

.badge-xxs {
    font-size: 0.65rem;
}

.text-xxs {
    font-size: 0.625rem;
}

/* Card with elevated shadow (replaces repeated <style> blocks) */
.card-elevated {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* Navbar hamburger icon sizing */
.navbar-icon {
    width: 2rem;
    height: 2rem;
}

/* Cursor pointer utility (BS5 doesn't have one) */
.cursor-pointer {
    cursor: pointer;
}

/* Page drag overlay (album, galerie) */
.page-drag-overlay {
    display: none;
    background: rgba(13, 110, 253, 0.15);
    z-index: var(--sc-z-overlay);
    pointer-events: none;
}

/* Drag overlay inside a card */
.drag-overlay-inline {
    background: rgba(13, 110, 253, 0.1);
    border: 2px dashed #0d6efd;
    border-radius: 0.375rem;
    z-index: 10;
}

/* Original image max-height in view page */
.original-img-constrained {
    max-height: 80vh;
}

/* Close button inside badge (album remove, tag remove) */
.btn-close-xs {
    font-size: 0.7em;
}

/* Small circle info button */
.info-circle {
    width: 20px;
    height: 20px;
    line-height: 20px;
    font-size: 1em;
    cursor: pointer;
}

/* Chevron transition (for collapsible panels) */
.chevron-animated {
    transition: transform 0.3s ease;
}

.btn-icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
}

.btn-primary .btn-icon { filter: invert(1) brightness(1.2); }  /* Feinabstimmung */
.btn-danger .btn-icon { filter: invert(1) brightness(1.2); }  /* Feinabstimmung */
.btn-success .btn-icon { filter: invert(1) brightness(1.2); }  /* Feinabstimmung */
.btn-secondary .btn-icon { filter: brightness(0) invert(1); }   /* Schwarz für secondary */

input.bg-light::placeholder {
    color: #6c757d;
    opacity: 1;
}