/* Prevent horizontal overflow from Bootstrap row negative margins */
html, body {
    overflow-x: hidden;
    width: 100%;
}

/* Search Controls */
.search-container {
    position: relative;
}

#selectedTags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.selected-tag {
    display: inline-flex;
    align-items: center;
    background-color: #e9ecef;
    border-radius: 1rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

.selected-tag .remove-tag {
    margin-left: 0.5rem;
    cursor: pointer;
    opacity: 0.7;
}

.selected-tag .remove-tag:hover {
    opacity: 1;
}

/* Tag Suggestions */
.tag-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background: white;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 0.25rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-height: 200px;
    overflow-y: auto;
}

.tag-suggestion {
    padding: 0.5rem 1rem;
    cursor: pointer;
}

.tag-suggestion:hover {
    background-color: #f8f9fa;
}

.tag-suggestion.highlighted {
    background-color: #e9ecef;
}

/* Grid View */
.grid-item {
    position: relative;
    break-inside: avoid;
    margin-bottom: 1.5rem;
}

.grid-item-content {
    background: white;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.grid-item-content:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.grid-item-image {
    position: relative;
    padding-top: 100%;
    background-color: #f8f9fa;
}

.grid-item-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;  //cover
    background-color: #f8f9fa;
}

.grid-item-details {
    padding: 1rem;
}

.grid-item-tags {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.grid-item-tag {
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    background-color: #f8f9fa;
    border-radius: 1rem;
    color: #6c757d;
}

/* List View */
.table img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 0.25rem;
    background-color: #f8f9fa;
}

.item-name {
    font-weight: 500;
    color: #212529;
    text-decoration: none;
}

.item-name:hover {
    color: #0d6efd;
}

.status-badge {
    font-size: 0.75rem;
    padding: 0.25em 0.5em;
}

/* Recent Searches Popover */
.recent-searches-container {
    min-width: 300px;
    max-height: 400px;
    overflow-y: auto;
}

.search-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
}

.search-item-name {
    margin-right: 1rem;
}

.search-item-actions {
    white-space: nowrap;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    #gridView .row {
        margin-right: -0.5rem;
        margin-left: -0.5rem;
    }

    #gridView .col-6 {
        padding-right: 0.5rem;
        padding-left: 0.5rem;
    }

    .grid-item-details {
        padding: 0.75rem;
    }

    .grid-item-title {
        font-size: 0.875rem;
    }

    .table td, .table th {
        padding: 0.5rem;
    }

    .table .d-none {
        display: none !important;
    }
}

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

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

/* Action Buttons */
.action-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.action-btn + .action-btn {
    margin-left: 0.25rem;
}

.action-btn i {
    font-size: 1rem;
    vertical-align: -2px;
}

.action-btn-group {
    display: inline-flex;
    gap: 0.25rem;
}

/* View Toggle Buttons */
.view-toggle .btn {
    padding: 0.375rem 0.75rem;
}

.view-toggle .btn.active {
    background-color: #e9ecef;
    border-color: #dee2e6;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050;
}

/* Share URL Input */
#shareUrl {
    font-size: 0.875rem;
    background-color: #f8f9fa;
}

/* Sports Item Specific Styles */
.sports-details {
    font-size: 0.875rem;
    color: #6c757d;
}

.sports-icon {
    color: #0d6efd;
    margin-right: 0.5rem;
}

/* Worth/Price Display */
.worth-display {
    font-weight: 500;
    color: #198754;
}

.cost-display {
    color: #6c757d;
    font-size: 0.875rem;
}

/* Item Status Indicators */
.item-status {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    color: #6c757d;
}

.status-icon {
    margin-right: 0.25rem;
}

.in-box {
    color: #198754;
}

.private-item {
    color: #dc3545;
}

/* Pagination Controls */
.pagination-container {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
}

.page-link {
    padding: 0.375rem 0.75rem;
}

.page-link:focus {
    box-shadow: none;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }

    .table td, .table th {
        padding: 0.5rem;
    }

    .container-fluid {
        width: 100%;
        padding: 0;
    }
}

/* Add to collection.css */
.navbar {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1030;
}

.content-wrapper {
    margin-top: 60px; /* Adjust based on your header height */
    padding-top: 1rem;
}

/* Grid view item styling */
.grid-item-title {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.grid-item-title a {
    color: inherit;
    text-decoration: none;
}

.grid-item-title a:hover {
    color: inherit;
    text-decoration: none;
}

.view-container .pagination {
    margin-top: 1rem;
    justify-content: center;
}

/* New Styles */

.edit-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(13, 110, 253, 0.8);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.grid-item-image {
    position: relative;
}

.grid-item-image:hover .edit-overlay {
    opacity: 1;
}

.pagination-container {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 1rem !important;
}

.items-per-page {
    width: auto !important;
}

.items-per-page-wrapper {
    position: relative;
    display: inline-block;
}

@media (max-width: 768px) {
    .pagination-container {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }

    .items-per-page {
        width: 100%;
        max-width: 200px;
    }
}



.mobile-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}

.mobile-fab:hover {
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .mobile-fab {
        bottom: 16px;
        right: 16px;
    }
}


.image-viewer-container {
    position: relative;
    height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000;
}

.image-viewer-container .main-image {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.3);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s;
}

.nav-button:hover {
    background: rgba(255, 255, 255, 0.5);
}

.prev-button {
    left: 20px;
}

.next-button {
    right: 20px;
}

.thumbnail-container {
    margin-top: 20px;
    padding: 0 20px;
}

.thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    max-width: 1200px;
    margin: 0 auto;
}

.thumbnail-grid img {
    width: 100%;
    height: 150px;
    object-fit: contain;
    cursor: pointer;
    background-color: #f8f9fa;
    border: 2px solid transparent;
}

.thumbnail-grid img.active {
    border-color: #0d6efd;
}

.view-all-button {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}


/* Grid selection overlay */
.grid-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.1);
    display: none;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 10px;
    z-index: 1;
}

.grid-item-container {
    position: relative;
}

.grid-item-container:hover .grid-item-overlay {
    display: flex;
}

.grid-item-mass-selected .grid-item-overlay {
    display: flex;
    background: rgba(13, 110, 253, 0.1);
}

/* Mass update modal styles */
#massUpdateTagSuggestions {
    position: absolute;
    z-index: 1000;
    background: white;
    border: 1px solid #ddd;
    border-radius: 0.25rem;
    max-height: 200px;
    overflow-y: auto;
    width: calc(100% - 45px);
}

.mass-update-tag-suggestion {
    padding: 0.5rem;
    cursor: pointer;
}

.mass-update-tag-suggestion:hover {
    background-color: #f8f9fa;
}

.mass-update-selected-tags {
    min-height: 40px;
}

.mass-update-tag-badge {
    display: inline-flex;
    align-items: center;
    background: #e9ecef;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    margin: 0.25rem;
}

.mass-update-tag-badge .remove-tag {
    cursor: pointer;
    margin-left: 0.5rem;
}

/* Force modal components to proper z-index layers */
.modal-backdrop {
    z-index: 1040 !important;
}

.modal {
    z-index: 1055 !important;
}

.modal-dialog {
    z-index: 1056 !important;
}

.modal-content {
    z-index: 1057 !important;
    background: white !important;
    pointer-events: auto !important;
}

.sort-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
}

.sort-menu {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 1rem;
    border-radius: 1rem 1rem 0 0;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
    z-index: 1041;
}

.sort-menu.show {
    transform: translateY(0);
}

.sort-menu-item {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    text-align: left;
    border: none;
    background: none;
    color: #212529;
}

.sort-menu-item:hover {
    background-color: #f8f9fa;
}

.sort-menu-item.active {
    color: #0d6efd;
    background-color: #f8f9fa;
}

/* Hide mass update button by default on mobile */
@media (max-width: 768px) {
    #massUpdateBtn {
        display: none;
    }

    /* Show when items are selected */
    #massUpdateBtn.show-mobile {
        display: inline-flex;
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 1030;
        width: 56px;
        height: 56px;
        border-radius: 28px;
        justify-content: center;
        align-items: center;
        background-color: #0d6efd;
        color: white;
        border: none;
        box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    }

    /* Hide sort dropdown on mobile */
    #sortOrder {
        display: none;
    }

    /* Show sort button on mobile */
    #mobileSortBtn {
        display: inline-flex;
    }
}

@media (min-width: 769px) {
    #mobileSortBtn {
        display: none;
    }
}

/* Phone list rows (owner 2026-10-12): picture, the name across the row, one line with date, worth and the buttons,
   then the tags; no table head; the + of the tab bar replaces the floating button */
@media (max-width: 768px) {
    .mobile-item-cell { padding: 0 !important; border: none !important; }
    .mobile-item-container { padding: 10px 4px; border-bottom: 1px solid #dee2e6; }
    .mobile-item-header { display: flex; align-items: flex-start; gap: 10px; }
    .mobile-item-check { flex: 0 0 auto; margin-top: 24px; }
    .mobile-item-thumbnail { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; cursor: pointer; flex-shrink: 0; background: #f1f3f5; }
    .mobile-item-info { flex: 1; min-width: 0; }
    .mobile-item-name { display: block; font-weight: 600; line-height: 1.25; color: #212529; text-decoration: none; }
    .mobile-item-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; font-size: .85rem; color: #6c757d; }
    .mobile-item-worth { font-weight: 600; color: #212529; }
    .mobile-item-actions { margin-left: auto; display: inline-flex; gap: 4px; }
    .mobile-item-actions .btn { padding: .15rem .45rem; }
    .mobile-item-tags-full { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
    #listView thead { display: none; }
    #listView .table { margin-bottom: 0; }
    .mobile-fab { display: none !important; }
}

/* Ensure desktop styles aren't affected */
@media (min-width: 769px) {
    .mobile-item-cell {
        display: none;
    }
}


/* Remove all table sort indicators */
.table th::after,
.table td::after,
.table th::before,
.table td::before {
    display: none !important;
    content: none !important;
}

/* Specifically target any sort arrows (not [class*="sort"]: that hid the sortable column headers) */
.table .sort-indicator,
.table [class*="arrow"] {
    display: none !important;
}

/* Sortable column headers: the sorted column is blue with a small chevron; others show it faintly on hover */
th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: color 0.15s ease;
}

th.sortable:hover {
    color: #0d6efd;
}

th.sortable .sort-icon {
    font-size: 0.7rem;
    margin-left: 0.3rem;
    opacity: 0;
    transition: opacity 0.15s ease;
}

th.sortable:hover .sort-icon {
    opacity: 0.45;
}

th.sortable.sorted {
    color: #0d6efd;
}

th.sortable.sorted .sort-icon {
    opacity: 1;
}
