/* Gallery Application Styles */

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --bg-color: #f5f6fa;
    --card-bg: #ffffff;
    --text-color: #2c3e50;
    --text-muted: #7f8c8d;
    --border-color: #dcdde1;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* Header */
.header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 2rem;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: white;
    cursor: pointer;
    transition: opacity 0.2s;
}

.logo:hover {
    opacity: 0.8;
}

.logo svg {
    width: 32px;
    height: 32px;
}

.controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Filter Controls */
.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.85rem;
    opacity: 0.9;
}

.filter-group input[type="date"],
.filter-group input[type="text"] {
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.9);
}

.search-box {
    position: relative;
}

.search-box input {
    padding-left: 2.5rem;
    width: 250px;
}

.search-box svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    opacity: 0.5;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Main Content - Side by Side Layout */
.main-content {
    display: flex;
    height: calc(100vh - 70px); /* Full height minus header */
    overflow: hidden;
}

/* Left Panel - Gallery */
.gallery-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid var(--border-color);
}

/* Resizable Divider */
.panel-divider {
    width: 6px;
    background: var(--border-color);
    cursor: col-resize;
    flex-shrink: 0;
    transition: background 0.2s;
}

.panel-divider:hover,
.panel-divider.dragging {
    background: var(--secondary-color);
}

/* Right Panel - Map */
.map-panel {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    background-color: var(--card-bg);
}

.map-header {
    padding: 0.5rem 1rem;
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
}

/* Map Container */
.map-container {
    flex: 1;
    background-color: var(--card-bg);
}

#map {
    height: 100%;
    width: 100%;
}

/* Stats Bar */
.stats-bar {
    background-color: var(--card-bg);
    padding: 0.75rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.stats {
    display: flex;
    gap: 2rem;
    font-size: 0.9rem;
}

.stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-value {
    font-weight: 600;
    color: var(--secondary-color);
}

.map-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

/* Gallery Grid */
.gallery-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

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

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--card-bg);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

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

.gallery-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: white;
    padding: 1rem 0.75rem 0.75rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

.gallery-item-title {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-item-date {
    font-size: 0.75rem;
    opacity: 0.8;
}

.gallery-item-location {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--secondary-color);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

/* Video indicator */
.video-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    z-index: 5;
}

.gallery-item:hover .video-indicator {
    color: white;
    transform: translate(-50%, -50%) scale(1.1);
    transition: transform 0.2s, color 0.2s;
}

/* Video loading spinner in lightbox */
.video-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem;
    color: white;
    font-size: 1rem;
}

.video-loading .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Video in lightbox - info panel moves to top */
.lightbox-info.lightbox-info-top {
    top: 0;
    bottom: auto;
    border-radius: 0 0 8px 8px;
    z-index: 10;  /* Above video element */
}

/* Selection Mode */
.gallery-item.selected {
    outline: 3px solid var(--secondary-color);
    outline-offset: -3px;
}

.gallery-item-checkbox {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: bold;
    color: transparent;
    transition: all 0.2s;
}

.gallery-item-checkbox.checked {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
}

.selection-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.selection-count {
    font-weight: 500;
    color: var(--secondary-color);
}

.btn-select {
    background: rgba(52, 152, 219, 0.1);
    color: var(--secondary-color);
    border: 1px solid var(--secondary-color);
}

.btn-select:hover {
    background: rgba(52, 152, 219, 0.2);
}

.btn-delete-selected {
    background: #dc3545;
    color: white;
    border: none;
}

.btn-delete-selected:hover {
    background: #c82333;
}

.btn-publish-selected {
    background: #28a745;
    color: white;
    border: none;
}

.btn-publish-selected:hover {
    background: #218838;
}

/* Selection mode buttons on light background */
.selection-controls .btn-secondary {
    background: #6c757d;
    color: white;
}

.selection-controls .btn-secondary:hover {
    background: #5a6268;
}

/* Loading State */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    position: relative;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
}

.lightbox-close {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    z-index: 2001;
    transition: background 0.2s;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.4);
}

.lightbox-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 1rem;
}

.lightbox-title {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.lightbox-meta {
    font-size: 0.9rem;
    opacity: 0.8;
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.lightbox-notes {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    font-style: italic;
    line-height: 1.5;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 2rem;
    padding: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lightbox-prev {
    left: 1rem;
}

.lightbox-next {
    right: 1rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem 0;
}

.pagination button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.pagination button:hover,
.pagination button.active {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.per-page-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 1rem;
    font-size: 0.9rem;
}

.per-page-wrapper select {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--card-bg);
    font-size: 0.9rem;
    cursor: pointer;
}

/* Map Popup */
.map-popup {
    text-align: center;
}

.map-popup img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.map-popup-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.map-popup-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Lightbox Actions (Share/Edit/Delete buttons) */
.lightbox-actions {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.5rem;
}

.lightbox-actions .btn {
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    border: none;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.6;
    transition: all 0.2s;
}

.lightbox-actions .btn:hover {
    opacity: 1;
    color: white;
    background: rgba(255, 255, 255, 0.15);
}

.btn-share:hover {
    color: #3498db;
}

.btn-edit:hover {
    color: #f1c40f;
}

.btn-delete:hover {
    color: #e74c3c;
}

.edit-form {
    margin-top: 1rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 1rem;
    border-radius: 8px;
}

.edit-row {
    margin-bottom: 0.75rem;
}

.edit-row label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    color: rgba(255, 255, 255, 0.9);
}

.edit-row input[type="text"],
.edit-row textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.9rem;
}

.edit-row input[type="text"]::placeholder,
.edit-row textarea::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.edit-row input[type="text"]:focus,
.edit-row textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.edit-row input[type="checkbox"] {
    margin-right: 0.5rem;
    transform: scale(1.2);
}

.edit-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.edit-actions .btn {
    flex: 1;
}

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

.location-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.location-suggestion {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    line-height: 1.4;
}

.location-suggestion:last-child {
    border-bottom: none;
}

.location-suggestion:hover {
    background: rgba(255, 255, 255, 0.15);
}

.location-suggestion.no-results {
    color: rgba(255, 255, 255, 0.5);
    cursor: default;
}

.location-suggestion.no-results:hover {
    background: transparent;
}

.location-display {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 0.5rem;
}

.btn-clear-location {
    background: rgba(231, 76, 60, 0.3);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.5);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.btn-clear-location:hover {
    background: rgba(231, 76, 60, 0.5);
}

.btn-generate-title {
    background: rgba(52, 152, 219, 0.3);
    color: #3498db;
    border: 1px solid rgba(52, 152, 219, 0.5);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    margin-left: 0.5rem;
}

.btn-generate-title:hover {
    background: rgba(52, 152, 219, 0.5);
}

.btn-generate-title:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Bulk Edit Modal */
.bulk-edit-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.bulk-edit-content {
    background: var(--primary-color);
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    color: white;
}

.bulk-edit-content h3 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
}

.bulk-edit-content .edit-row {
    margin-bottom: 1rem;
}

.bulk-edit-content .edit-row label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.bulk-edit-content .edit-row input[type="text"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
}

.bulk-edit-content .location-display {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

.bulk-hint {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0.25rem;
    font-style: italic;
}

.date-time-inputs {
    display: flex;
    gap: 0.5rem;
}

.date-time-inputs input[type="date"],
.date-time-inputs input[type="time"] {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
}

.date-time-inputs input[type="date"]::-webkit-calendar-picker-indicator,
.date-time-inputs input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

.bulk-edit-content .edit-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.bulk-edit-content .edit-actions .btn {
    flex: 1;
    padding: 0.75rem;
}

.btn-edit-selected {
    background: var(--secondary-color);
    color: white;
    border: none;
}

.btn-edit-selected:hover {
    background: #2980b9;
}

/* Responsive */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
        height: auto;
    }

    .gallery-panel {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: 50vh;
    }

    .map-panel {
        width: 100%;
        min-width: unset;
        height: 50vh;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: stretch;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box input {
        width: 100%;
    }

    .gallery-panel {
        max-height: 40vh;
    }

    .map-panel {
        height: 40vh;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-bar {
        flex-direction: column;
        align-items: flex-start;
        padding: 0.5rem 1rem;
    }

    .stats {
        gap: 1rem;
        font-size: 0.8rem;
    }

    .lightbox-nav {
        padding: 0.5rem;
    }
}
