/**
 * Profile Editor Styles
 * v8.6.0 - Phase 2 of Bulk Upload System
 * Full-app grid interface for Media Profiles, Story Profiles, Sandbox Profiles
 */

/* ============================================================================
   VIEW CONTAINER
   ============================================================================ */

#profile-editor-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #f9fafb;
}

#profile-editor-view.hidden {
    display: none;
}

#profile-editor-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* ============================================================================
   LOADING STATE
   ============================================================================ */

.profile-editor-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: #6b7280;
}

.profile-editor-loading .loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ============================================================================
   HEADER
   ============================================================================ */

.profile-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.profile-editor-title {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-back {
    padding: 8px 12px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    transition: background 0.2s;
}

.btn-back:hover {
    background: #e5e7eb;
}

.profile-name-input {
    font-size: 1.25rem;
    font-weight: 600;
    padding: 8px 12px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    min-width: 300px;
    transition: border-color 0.2s, background 0.2s;
}

.profile-name-input:hover {
    border-color: #d1d5db;
    background: #f9fafb;
}

.profile-name-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
}

.profile-editor-actions {
    display: flex;
    gap: 12px;
}

.profile-editor-actions .btn-secondary {
    padding: 10px 20px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    transition: background 0.2s;
}

.profile-editor-actions .btn-secondary:hover {
    background: #f3f4f6;
}

/* Danger outline button - v8.9.1 */
.profile-editor-actions .btn-danger-outline {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

.profile-editor-actions .btn-danger-outline:hover {
    background: #fee2e2;
    border-color: #f87171;
}

.profile-editor-actions .btn-primary {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: white;
    font-weight: 500;
    transition: opacity 0.2s, transform 0.1s;
}

.profile-editor-actions .btn-primary:hover {
    opacity: 0.9;
}

.profile-editor-actions .btn-primary:active {
    transform: scale(0.98);
}

/* ============================================================================
   TOOLBAR
   ============================================================================ */

.profile-editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Search Box */
.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-box input {
    width: 250px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-search {
    padding: 8px 12px;
    background: #10b981;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.btn-search:hover {
    background: #059669;
}

/* Filter Buttons */
.filter-buttons {
    display: flex;
    gap: 4px;
}

.filter-btn {
    padding: 6px 12px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: #e5e7eb;
}

.filter-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

/* Size Toggle */
.size-toggle {
    display: flex;
    background: #f3f4f6;
    border-radius: 6px;
    padding: 2px;
}

.size-toggle button {
    padding: 6px 12px;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.2s;
}

.size-toggle button:hover {
    color: #374151;
}

.size-toggle button.active {
    background: white;
    color: #667eea;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ============================================================================
   SELECTION BAR
   ============================================================================ */

.selection-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: #f3f4f6;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
    transition: background 0.2s;
}

.selection-bar.has-selection {
    background: #eff6ff;
    border-bottom-color: #bfdbfe;
}

.selection-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #374151;
}

.selection-info input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

.selection-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.selection-actions button {
    padding: 6px 12px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: #374151;
    transition: all 0.2s;
}

.selection-actions button:hover {
    background: #f3f4f6;
}

.selection-actions .btn-danger {
    background: #fee2e2;
    border-color: #fecaca;
    color: #dc2626;
}

.selection-actions .btn-danger:hover {
    background: #fecaca;
}

.selection-actions .divider {
    color: #d1d5db;
    margin: 0 4px;
}

/* ============================================================================
   GRID
   ============================================================================ */

.profile-editor-grid {
    display: grid;
    gap: 16px;
    padding: 20px;
    flex: 1;
    align-content: start;
}

/* Size variants */
.profile-editor-grid.size-small {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
}

.profile-editor-grid.size-medium {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
}

.profile-editor-grid.size-large {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

/* Empty State */
.profile-editor-grid .empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.empty-state p {
    margin: 8px 0;
}

/* ============================================================================
   GRID ITEM
   ============================================================================ */

.grid-item {
    position: relative;
    background: white;
    border-radius: 8px;
    border: 2px solid transparent;
    overflow: hidden;
    cursor: grab;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

.grid-item.selected {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.grid-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.grid-item.drag-over {
    border-color: #10b981;
    background: #ecfdf5;
}

/* Checkbox */
.item-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
}

.item-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #667eea;
    background: white;
    border-radius: 4px;
}

/* Thumbnail */
.item-thumbnail {
    aspect-ratio: 1;
    overflow: hidden;
    background: #f3f4f6;
    cursor: pointer;
    position: relative;
}

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

.grid-item:hover .item-thumbnail img {
    transform: scale(1.05);
}

.item-thumbnail .video-placeholder,
.item-thumbnail .doc-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
}

.item-type-icon {
    position: absolute;
    bottom: 4px;
    right: 4px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Info */
.item-info {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.item-name {
    font-size: 12px;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-date {
    font-size: 11px;
    color: #9ca3af;
}

/* Remove Button */
.item-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: rgba(239, 68, 68, 0.9);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 16px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.grid-item:hover .item-remove {
    opacity: 1;
}

.item-remove:hover {
    background: #dc2626;
}

/* ============================================================================
   SIZE-SPECIFIC ADJUSTMENTS
   ============================================================================ */

/* Small size */
.profile-editor-grid.size-small .item-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.profile-editor-grid.size-small .item-info {
    padding: 6px 8px;
}

.profile-editor-grid.size-small .item-name {
    font-size: 11px;
}

.profile-editor-grid.size-small .item-date {
    display: none;
}

.profile-editor-grid.size-small .item-type-icon {
    font-size: 12px;
}

/* Large size */
.profile-editor-grid.size-large .item-info {
    padding: 10px 12px;
}

.profile-editor-grid.size-large .item-name {
    font-size: 13px;
}

.profile-editor-grid.size-large .item-date {
    font-size: 12px;
}

/* ============================================================================
   MOBILE RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    .profile-editor-header {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }

    .profile-editor-title {
        width: 100%;
    }

    .profile-name-input {
        flex: 1;
        min-width: auto;
        font-size: 1.1rem;
    }

    .profile-editor-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .profile-editor-toolbar {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }

    .toolbar-left,
    .toolbar-right {
        width: 100%;
        justify-content: space-between;
    }

    .search-box {
        flex: 1;
    }

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

    .selection-bar {
        flex-direction: column;
        gap: 10px;
        padding: 10px 16px;
    }

    .selection-info,
    .selection-actions {
        width: 100%;
        justify-content: space-between;
    }

    .profile-editor-grid {
        padding: 12px;
        gap: 12px;
    }

    .profile-editor-grid.size-medium {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .profile-editor-grid.size-large {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}
