/* Lightbox Container */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(10, 15, 28, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    overflow: auto;
    padding: 1rem;
}

.lightbox-content {
    position: relative;
    width: 95%;
    max-width: 1200px;
    margin: auto;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
}

/* Close Button */
.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    z-index: 1;
    width: 44px;
    height: 44px;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

/* Image Container */
.lightbox-image-container {
    position: relative;
    width: 100%;
    height: 50vh;
    min-height: 300px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px 12px 0 0;
}

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

/* Controls */
.lightbox-controls {
    padding: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    background: var(--card-bg);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0 0 12px 12px;
}

.lightbox-btn {
    padding: 0.75rem 1.25rem;
    background: linear-gradient(to bottom, #4B9FFF, #3B8AE5);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s ease;
    min-width: 120px;
    min-height: 44px;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    -webkit-tap-highlight-color: transparent;
}

.lightbox-btn i {
    font-size: 1.1rem;
}

.lightbox-btn:hover {
    background: linear-gradient(to bottom, #5BAEFF, #4B9FFF);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(75, 159, 255, 0.3);
}

.lightbox-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.lightbox-btn.secondary {
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.1));
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
}

.lightbox-btn.secondary:hover {
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.15));
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

/* Delete Button */
.lightbox-btn.delete-btn {
    background: linear-gradient(to bottom, #FF4D4D, #E53E3E);
    margin-left: auto;
}

.lightbox-btn.delete-btn:hover {
    background: linear-gradient(to bottom, #FF6B6B, #FF4D4D);
    box-shadow: 0 4px 12px rgba(255, 77, 77, 0.3);
}

/* Metadata Editor */
.metadata-editor {
    background: var(--card-bg);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    max-height: 50vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.metadata-editor-inner {
    padding: 1rem;
}

.metadata-editor h3 {
    margin: 0 0 1rem;
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 600;
    position: sticky;
    top: 0;
    background: var(--card-bg);
    padding: 1rem 0;
    z-index: 1;
}

.predefined-tags {
    margin-bottom: 1.5rem;
}

.tag-group {
    margin-bottom: 1rem;
}

.tag-group h4 {
    color: var(--text-primary);
    font-size: 1rem;
    margin: 0 0 0.75rem;
    font-weight: 500;
}

.tag-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-option {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}

.tag-option:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.tag-option.selected {
    background: rgba(75, 159, 255, 0.15);
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

/* Tags Input */
.tags-input {
    margin-bottom: 1rem;
}

#tag-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.2s ease;
    min-height: 44px;
}

#tag-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    background: rgba(255, 255, 255, 0.15);
}

#tag-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

#tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* Tags */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.2s ease;
    min-height: 44px;
}

.tag.brandbook-tag {
    background: rgba(75, 159, 255, 0.15);
    color: var(--primary-blue);
    border-color: var(--primary-blue);
    font-weight: 500;
}

.tag button {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    opacity: 0.7;
    min-height: 44px;
    min-width: 44px;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.tag button:hover {
    color: #ff4d4d;
    opacity: 1;
}

/* Metadata Actions */
.metadata-actions {
    position: sticky;
    bottom: 0;
    background: var(--card-bg);
    padding: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: flex-end;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.2);
}

/* Untagged Badge */
.untagged-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

/* Radio Group for Tagged/Untagged Filter */
.radio-group.tagged-filter {
    margin-bottom: 1rem;
    display: flex;
    gap: 1rem;
}

.radio-group.tagged-filter label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.radio-group.tagged-filter input[type="radio"] {
    margin: 0;
}

.radio-group.tagged-filter label:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.radio-group.tagged-filter input[type="radio"]:checked + label {
    background: rgba(75, 159, 255, 0.15);
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

/* Hide elements */
.hidden {
    display: none !important;
}

/* Media Queries */
@media (max-width: 768px) {
    .lightbox {
        padding: 0.5rem;
    }

    .lightbox-content {
        width: 100%;
    }

    .lightbox-image-container {
        height: 40vh;
        min-height: 250px;
    }

    .lightbox-controls {
        justify-content: center;
    }

    .lightbox-btn {
        flex: 1;
        min-width: 0;
        padding: 0.75rem 1rem;
    }

    .lightbox-btn.delete-btn {
        margin-left: 0;
        flex: 1;
    }

    .metadata-editor {
        max-height: 60vh;
    }

    .metadata-actions {
        flex-direction: column;
    }

    .metadata-actions .lightbox-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .lightbox-image-container {
        height: 35vh;
        min-height: 200px;
    }

    .metadata-editor-inner {
        padding: 0.75rem;
    }

    .tag-option {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    #tag-input {
        font-size: 0.9rem;
    }
}
