/* Custom styles for hba - digitaler katalog reliefierter ofenkacheln */

:root {
    --primary-color: #8B4513;
    --secondary-color: #D2691E;
    --accent-color: #CD853F;
    --text-dark: #333;
    --text-light: #666;
    --border-color: #ddd;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
}

body {
    padding-top: 70px;
    background-color: #f8f9fa;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Navigation */
.navbar-dark {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%) !important;
}

/* Sidebar Filters */
#filterSidebar {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.filter-group {
    margin-bottom: 1.5rem;
}

.filter-group label {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.filter-badge {
    background-color: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    margin-left: 8px;
}

.filter-options {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem;
    background-color: white;
}

.filter-options::-webkit-scrollbar {
    width: 6px;
}

.filter-options::-webkit-scrollbar-thumb {
    background-color: var(--secondary-color);
    border-radius: 3px;
}

/* Gallery Grid */
.tile-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    height: 100%;
    border: none;
    overflow: hidden;
}

.tile-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.tile-card .card-img-top {
    height: 250px;
    object-fit: cover;
    background-color: #f0f0f0;
}

.tile-card .card-body {
    padding: 1rem;
}

.tile-card .card-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tile-card .card-text {
    font-size: 0.85rem;
    color: var(--text-light);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tile-card .tile-meta {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.tile-card .tile-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

/* List View */
.list-view .tile-list-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: box-shadow 0.3s ease;
}

.list-view .tile-list-item:hover {
    box-shadow: var(--shadow);
}

.list-view .tile-thumbnail {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
}

.list-view .tile-info {
    flex: 1;
    margin-left: 1rem;
}

/* Pagination */
.pagination {
    margin-top: 2rem;
}

.pagination .page-link {
    color: var(--primary-color);
    border-color: var(--border-color);
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Compare Basket */
#compareBasket {
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Loading States */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Image Lazy Loading */
img.lazy {
    background: #f0f0f0;
    min-height: 250px;
}

img.lazy.loaded {
    background: transparent;
}

/* Modal Customization */
.modal-body img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.metadata-table {
    font-size: 0.9rem;
}

.metadata-table td:first-child {
    font-weight: 600;
    width: 30%;
    color: var(--text-dark);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    body {
        padding-top: 60px;
    }

    #filterSidebar {
        position: static;
        max-height: none;
        margin-bottom: 1rem;
    }

    .tile-card .card-img-top {
        height: 200px;
    }

    .filter-options {
        max-height: 150px;
    }

    #compareBasket {
        bottom: 70px !important;
        right: 10px !important;
    }
}

/* Print Styles */
@media print {
    .navbar,
    #filterSidebar,
    #compareBasket,
    .tile-actions,
    footer,
    [data-pdf-exclude] {
        display: none !important;
    }

    body {
        padding-top: 0;
        background-color: #f8f9fa !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .tile-card {
        break-inside: avoid;
        box-shadow: none !important;
    }

    .metadata-section,
    .tile-reference-card {
        break-inside: avoid;
    }

    .metadata-section {
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    }
}

/* Utility Classes */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.badge-filter {
    background-color: var(--secondary-color);
    color: white;
    padding: 4px 8px;
    margin: 2px;
    border-radius: 4px;
    font-size: 0.8rem;
    display: inline-block;
}

.no-results {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
}

.no-results i {
    font-size: 3rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

/* Checkbox styling */
.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-check-input:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 0.25rem rgba(139, 69, 19, 0.25);
}

/* Tooltip styling */
.tooltip-inner {
    background-color: var(--primary-color);
}

.tooltip.bs-tooltip-top .tooltip-arrow::before {
    border-top-color: var(--primary-color);
}

/* Card hover effects */
.card {
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Search highlight */
.search-highlight {
    background-color: yellow;
    padding: 2px;
    border-radius: 2px;
}

/* ========================================================================
   Magnifier Lightbox Styles
   ======================================================================== */

.magnifier-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: zoom-out;
}

.magnifier-close {
    position: absolute;
    top: 20px;
    right: 40px;
    font-size: 40px;
    color: white;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: bold;
    z-index: 10001;
    transition: transform 0.2s, opacity 0.2s;
    opacity: 0.8;
}

.magnifier-close:hover {
    transform: scale(1.1);
    opacity: 1;
}

.magnifier-main-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    user-select: none;
    -webkit-user-drag: none;
    cursor: crosshair;
}

.magnifier-tracker {
    position: fixed;
    border: 2px solid #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.5), inset 0 0 10px rgba(255,255,255,0.2);
    pointer-events: none;
    display: none;
    background: rgba(255, 255, 255, 0.1);
    z-index: 10000;
}

.magnifier-box {
    position: fixed;
    width: 250px;
    height: 250px;
    background: #000;
    border: 3px solid #fff;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    display: none;
    pointer-events: none;
    z-index: 10000;
}

.magnifier-canvas {
    width: 100%;
    height: 100%;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Mobile/Tablet: Hide magnifier features */
@media (max-width: 768px) {
    .magnifier-box {
        display: none !important;
    }

    .magnifier-tracker {
        display: none !important;
    }

    .magnifier-main-image {
        cursor: zoom-out;
    }
}

/* ========================================================================
   Image Gallery - Thumbnail Strip & Navigation
   ======================================================================== */

/* Image container for positioning arrows */
.image-container {
    position: relative;
}

/* Thumbnail Strip */
.thumbnail-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 12px 0;
    justify-content: center;
    flex-wrap: wrap;
}

.thumbnail-strip::-webkit-scrollbar {
    height: 6px;
}

.thumbnail-strip::-webkit-scrollbar-thumb {
    background-color: var(--secondary-color);
    border-radius: 3px;
}

.thumbnail-item {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s, transform 0.2s;
}

.thumbnail-item:hover {
    border-color: var(--secondary-color);
    transform: scale(1.05);
}

.thumbnail-item.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(139, 69, 19, 0.3);
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Image Navigation Arrows */
.image-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s, background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-container:hover .image-nav-arrow {
    opacity: 0.7;
}

.image-nav-arrow:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.7);
}

.image-nav-arrow:disabled {
    opacity: 0.3 !important;
    cursor: not-allowed;
}

.image-nav-prev {
    left: 10px;
}

.image-nav-next {
    right: 10px;
}

/* Magnifier Gallery Navigation */
.magnifier-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10001;
    opacity: 0.7;
    transition: opacity 0.2s, background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.magnifier-nav:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.3);
}

.magnifier-nav-prev {
    left: 20px;
}

.magnifier-nav-next {
    right: 20px;
}

.magnifier-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    z-index: 10001;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .image-nav-arrow {
        width: 32px;
        height: 32px;
        opacity: 0.7;
    }

    .thumbnail-item {
        width: 50px;
        height: 50px;
    }

    .magnifier-nav {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

/* ========================================================================
   Reference Autocomplete
   ======================================================================== */

/* Insert-reference button toolbar below each enabled textarea */
.reference-insert-toolbar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* Autocomplete Dropdown */
.reference-autocomplete-dropdown {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 280px;
    overflow-y: auto;
    z-index: 99999;
}

.autocomplete-placeholder {
    padding: 16px;
    color: var(--text-light);
    text-align: center;
    font-size: 0.9rem;
}

.autocomplete-placeholder small {
    color: #999;
}

.autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.15s;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background-color: #f8f9fa;
}

.autocomplete-item.selected {
    background-color: #e9ecef;
}

.autocomplete-type {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    flex-shrink: 0;
}

.autocomplete-type.literatur {
    background-color: #e3f2fd;
    color: #1565c0;
}

.autocomplete-type.tile {
    background-color: #fff3e0;
    color: #e65100;
}

.autocomplete-display {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
}

/* Reference Links in Display Mode */
.reference-link {
    text-decoration: none;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
    font-size: 0.95em;
}

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

.reference-lit {
    background-color: #e3f2fd;
    color: #1565c0;
}

.reference-lit:hover {
    background-color: #bbdefb;
    color: #0d47a1;
}

.reference-tile {
    background-color: #fff3e0;
    color: #e65100;
}

.reference-tile:hover {
    background-color: #ffe0b2;
    color: #bf360c;
}

.reference-unknown {
    background-color: #ffebee;
    color: #c62828;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.95em;
}

/* Mobile adjustments for autocomplete */
@media (max-width: 768px) {
    .reference-autocomplete-dropdown {
        max-height: 200px;
    }

    .autocomplete-item {
        padding: 8px 12px;
    }
}

/* ========================================================================
   Literature List Styles
   ======================================================================== */

.literature-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.literature-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: #f8f9fa;
    border-left: 3px solid #1565c0;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.literature-item:hover {
    background: #e9ecef;
}

.literature-citation {
    flex: 1;
    line-height: 1.6;
}

.literature-citation strong {
    color: var(--text-dark);
}

.literature-citation em {
    color: var(--text-dark);
}

.literature-remove-btn {
    flex-shrink: 0;
    opacity: 0.7;
}

.literature-remove-btn:hover {
    opacity: 1;
}

.literature-search-results {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 1rem;
}

.literature-search-results .list-group-item {
    cursor: pointer;
}
