/* Media Tagging System Styles */

/* Tag Input */
.tag-input-wrapper {
    position: relative;
    margin-bottom: 1rem;
}

.tag-input-container {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.tag-input {
    flex: 1;
    padding: 0.6rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.tag-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--bg-primary-overlay-20);
}

/* Tag Suggestions */
.tag-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 60px;
    margin-top: 0.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.tag-suggestion {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.tag-suggestion:hover {
    background: var(--bg-primary-overlay-20);
}

.tag-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tag-name {
    flex: 1;
    color: var(--text-primary);
}

.tag-usage {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Tag Chips */
.media-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.5rem 0;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.6rem;
    border-radius: 12px;
    font-size: 0.85rem;
    color: #fff;
    font-weight: 500;
    cursor: default;
    transition: all 0.2s;
}

.tag-chip-name {
    color: #fff;
}

.tag-chip-remove {
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0 0.2rem;
    margin-left: 0.2rem;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.tag-chip-remove:hover {
    background: rgba(0, 0, 0, 0.2);
}

.no-tags-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-style: italic;
}

/* Tag Management Modal */
.tag-management-modal .modal-content {
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
}

.tag-management-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.tag-management-section:last-child {
    border-bottom: none;
}

.tag-management-section h3 {
    color: var(--color-primary);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

/* Tag Create Form */
.tag-create-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.tag-name-input {
    flex: 1;
    padding: 0.6rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
}

.tag-color-input {
    width: 50px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
}

.tag-color-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.tag-color-input::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

/* Tag Search */
.tag-search-box {
    margin-bottom: 1rem;
}

.tag-search-input {
    width: 100%;
    padding: 0.6rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
}

/* Tag List */
.all-tags-list {
    max-height: 300px;
    overflow-y: auto;
}

.tag-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s;
}

.tag-item:hover {
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px var(--bg-primary-overlay-20);
}

.tag-item-color {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    position: relative;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.tag-color-picker {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.tag-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.tag-item-name {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 1rem;
}

.tag-item-usage {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.tag-item-actions {
    display: flex;
    gap: 0.5rem;
}

/* Tag Statistics */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.most-used-tags h4 {
    color: var(--text-primary);
    margin-bottom: 0.8rem;
    font-size: 1rem;
}

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

/* Tag Filter Panel */
.tag-filter-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.tag-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--border-color);
}

.tag-filter-header h3 {
    color: var(--color-primary);
    margin: 0;
    font-size: 1.1rem;
}

.filter-mode-toggle {
    display: flex;
    gap: 0.3rem;
    background: var(--bg-primary);
    border-radius: 6px;
    padding: 0.2rem;
}

.filter-mode-btn {
    padding: 0.4rem 0.8rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.filter-mode-btn.active {
    background: var(--color-primary);
    color: #fff;
}

.filter-mode-btn:hover:not(.active) {
    background: var(--bg-secondary);
}

/* Tag Filter List */
.tag-filter-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.tag-filter-item {
    display: flex;
    align-items: center;
    padding: 0.6rem;
    margin-bottom: 0.3rem;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.tag-filter-item:hover {
    background: var(--bg-primary-overlay-20);
}

.tag-filter-item.active {
    background: var(--bg-primary-overlay-20);
    border-left: 3px solid var(--color-primary);
}

.tag-filter-checkbox {
    margin-right: 0.8rem;
    cursor: pointer;
}

.tag-filter-item label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    cursor: pointer;
}

.tag-count {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-left: auto;
}

.tag-filter-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 0.8rem;
    border-top: 1px solid var(--border-color);
}

.no-tags {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
    font-style: italic;
}

.no-results {
    text-align: center;
    color: var(--text-secondary);
    padding: 1rem;
    font-style: italic;
}

/* Bulk Selection */
.bulk-mode-active .gallery-item {
    cursor: pointer;
    position: relative;
}

.bulk-mode-active .gallery-item::before {
    content: '';
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    z-index: 10;
}

.bulk-mode-active .gallery-item.selected::before {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.bulk-mode-active .gallery-item.selected::after {
    content: '✓';
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: bold;
    z-index: 11;
}

/* Bulk Actions Bar */
.bulk-actions-bar {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border: 2px solid var(--color-primary);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.bulk-actions-bar .selection-count {
    color: var(--color-primary);
    font-weight: bold;
    font-size: 1.1rem;
}

.bulk-actions-bar .actions {
    display: flex;
    gap: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .tag-create-form {
        flex-direction: column;
    }

    .tag-color-input {
        width: 100%;
    }

    .tag-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .tag-item-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .stat-grid {
        grid-template-columns: 1fr;
    }

    .bulk-actions-bar {
        flex-direction: column;
        padding: 0.8rem;
        width: calc(100% - 2rem);
        left: 1rem;
        transform: translateX(0);
    }

    .bulk-actions-bar .actions {
        width: 100%;
        flex-direction: column;
    }

    .bulk-actions-bar .actions .btn {
        width: 100%;
    }
}

/* Scrollbar Styling */
.tag-suggestions::-webkit-scrollbar,
.all-tags-list::-webkit-scrollbar,
.tag-filter-list::-webkit-scrollbar {
    width: 8px;
}

.tag-suggestions::-webkit-scrollbar-track,
.all-tags-list::-webkit-scrollbar-track,
.tag-filter-list::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 4px;
}

.tag-suggestions::-webkit-scrollbar-thumb,
.all-tags-list::-webkit-scrollbar-thumb,
.tag-filter-list::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 4px;
}

.tag-suggestions::-webkit-scrollbar-thumb:hover,
.all-tags-list::-webkit-scrollbar-thumb:hover,
.tag-filter-list::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-light);
}

/* Campaign Tagging Interface */
.campaign-tagging-interface {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1rem 0;
}

.tagging-instructions {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-primary-overlay-20);
    border-left: 4px solid var(--color-primary);
    border-radius: 8px;
}

.tagging-instructions h3 {
    color: var(--color-primary);
    margin: 0 0 0.8rem 0;
    font-size: 1.2rem;
}

.instructions-content ul {
    margin: 0;
    padding-left: 1.5rem;
}

.instructions-content li {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.tagging-progress {
    margin-bottom: 1.5rem;
}

.progress-bar {
    width: 100%;
    height: 24px;
    background: var(--bg-primary);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border-color);
}

.progress-fill {
    height: 100%;
    background: var(--color-primary);
    transition: width 0.3s ease, background-color 0.3s ease;
    border-radius: 12px;
}

.progress-text {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.tagging-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tagging-media-item {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0.8rem;
    transition: all 0.3s;
}

.tagging-media-item:hover {
    border-color: var(--color-primary);
    box-shadow: 0 4px 12px var(--bg-primary-overlay-20);
}

.tagging-media-item.tagged-complete {
    border-color: var(--color-success);
    background: var(--bg-success-overlay-10);
}

.tagging-media-item.tagged-complete::after {
    content: '✓';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--color-success);
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.media-preview {
    width: 100%;
    height: 150px;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.8rem;
    background: var(--bg-secondary);
}

.media-preview img,
.media-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-tags-section {
    min-height: 30px;
    margin-bottom: 0.8rem;
}

.tag-item-btn {
    width: 100%;
}

.tagging-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.suggested-tags {
    padding: 1rem;
    background: var(--bg-primary-overlay-20);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.suggested-tags strong {
    color: var(--color-primary);
    display: block;
    margin-bottom: 0.5rem;
}

/* Additional gallery item styles */
.gallery-item-tags {
    margin-top: 0.5rem;
}

.gallery-item .add-tag-btn {
    margin-top: 0.5rem;
    width: 100%;
}

/* Success overlays */
.bg-success-overlay-10 {
    background: rgba(76, 175, 80, 0.1);
}

/* Responsive for campaign tagging */
@media (max-width: 768px) {
    .tagging-media-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.8rem;
    }

    .media-preview {
        height: 120px;
    }

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

    .tagging-actions .btn {
        width: 100%;
    }
}

