/* ===== Dropbox Asset Picker ===== */

/* Backdrop */
.dbx-picker-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.dbx-picker-backdrop.dbx-visible {
    opacity: 1;
}

/* Modal shell */
.dbx-picker {
    width: clamp(900px, 85vw, 1400px);
    height: clamp(500px, 80vh, 85vh);
    background: #111827;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(0,0,0,0.5);
    overflow: hidden;
    transform: scale(0.96);
    transition: transform 0.2s ease;
    outline: none;
}
.dbx-picker-backdrop.dbx-visible .dbx-picker {
    transform: scale(1);
}

/* ---- Header ---- */
.dbx-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: #111827;
    border-bottom: 1px solid #374151;
    flex-shrink: 0;
}
.dbx-header-title {
    font-size: 16px;
    font-weight: 600;
    color: #E5E7EB;
    margin: 0;
}
.dbx-header-close {
    background: none;
    border: none;
    color: #9CA3AF;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
.dbx-header-close:hover {
    color: #E5E7EB;
    background: rgba(255,255,255,0.06);
}

/* ---- Body (3-column) ---- */
.dbx-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ---- Sidebar ---- */
.dbx-sidebar {
    width: 240px;
    min-width: 200px;
    background: #0F172A;
    border-right: 1px solid #374151;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}
.dbx-sidebar-section {
    padding: 12px 0 4px;
}
.dbx-sidebar-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6B7280;
    padding: 0 16px 6px;
}
.dbx-sidebar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    font-size: 13px;
    color: #9CA3AF;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    border-left: 3px solid transparent;
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dbx-sidebar-item:hover {
    background: rgba(31,41,55,0.6);
    color: #D1D5DB;
}
.dbx-sidebar-item.dbx-active {
    background: #1F2937;
    color: #E5E7EB;
    border-left-color: #3B82F6;
}
.dbx-sidebar-item i {
    width: 16px;
    text-align: center;
    font-size: 12px;
    flex-shrink: 0;
}
.dbx-sidebar-toggle {
    width: 16px;
    text-align: center;
    font-size: 10px;
    flex-shrink: 0;
    cursor: pointer;
    color: #6B7280;
    transition: transform 0.15s;
}
.dbx-sidebar-toggle.dbx-expanded {
    transform: rotate(90deg);
}
.dbx-sidebar-children {
    padding-left: 16px;
    display: none;
}
.dbx-sidebar-children.dbx-open {
    display: block;
}

/* ---- Main Area ---- */
.dbx-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

/* Toolbar row */
.dbx-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid #374151;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.dbx-search-wrap {
    position: relative;
    flex: 1;
    min-width: 180px;
    max-width: 500px;
}
.dbx-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #6B7280;
    font-size: 13px;
    pointer-events: none;
}
.dbx-search {
    width: 100%;
    background: #1F2937;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #E5E7EB;
    font-size: 13px;
    padding: 7px 32px 7px 32px;
    outline: none;
    transition: border-color 0.15s;
}
.dbx-search::placeholder { color: #6B7280; }
.dbx-search:focus { border-color: #3B82F6; }
.dbx-search-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9CA3AF;
    cursor: pointer;
    font-size: 12px;
    padding: 4px;
    display: none;
}
.dbx-search-clear.dbx-show { display: block; }

/* Filter button */
.dbx-filter-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #1F2937;
    border: 1px solid #374151;
    border-radius: 8px;
    color: #9CA3AF;
    font-size: 13px;
    padding: 7px 12px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
}
.dbx-filter-btn:hover { background: #263244; color: #E5E7EB; }
.dbx-filter-btn.dbx-has-filters { color: #3B82F6; border-color: #3B82F6; }

/* View toggle */
.dbx-view-toggle {
    display: flex;
    background: #1F2937;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #374151;
}
.dbx-view-btn {
    background: none;
    border: none;
    color: #6B7280;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.12s, color 0.12s;
}
.dbx-view-btn:hover { color: #E5E7EB; }
.dbx-view-btn.dbx-active { background: #3B82F6; color: #fff; }

/* Sort dropdown */
.dbx-sort-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #9CA3AF;
    white-space: nowrap;
}
.dbx-sort-select {
    background: #1F2937;
    border: 1px solid #374151;
    border-radius: 8px;
    color: #E5E7EB;
    font-size: 13px;
    padding: 6px 8px;
    outline: none;
    cursor: pointer;
}
.dbx-sort-dir {
    background: none;
    border: none;
    color: #9CA3AF;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    transition: color 0.12s;
}
.dbx-sort-dir:hover { color: #E5E7EB; }

/* Breadcrumb */
.dbx-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    font-size: 13px;
    color: #9CA3AF;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.dbx-breadcrumb-seg {
    cursor: pointer;
    transition: color 0.12s;
}
.dbx-breadcrumb-seg:hover { color: #E5E7EB; }
.dbx-breadcrumb-seg.dbx-current {
    color: #E5E7EB;
    font-weight: 500;
    cursor: default;
}
.dbx-breadcrumb-sep {
    color: #4B5563;
    font-size: 10px;
}

/* Filter chips */
.dbx-filter-chips {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px 8px;
    flex-wrap: wrap;
}
.dbx-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #1F2937;
    border: 1px solid #374151;
    border-radius: 999px;
    color: #D1D5DB;
    font-size: 12px;
    padding: 3px 10px;
}
.dbx-chip-remove {
    background: none;
    border: none;
    color: #9CA3AF;
    cursor: pointer;
    font-size: 10px;
    padding: 0 2px;
}
.dbx-chip-remove:hover { color: #E5E7EB; }
.dbx-clear-filters {
    background: none;
    border: none;
    color: #3B82F6;
    font-size: 12px;
    cursor: pointer;
    padding: 3px 6px;
}
.dbx-clear-filters:hover { text-decoration: underline; }

/* Content area */
.dbx-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    min-height: 0;
}

/* Grid view */
.dbx-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px;
}

/* Card */
.dbx-card {
    background: #1F2937;
    border-radius: 10px;
    border: 2px solid transparent;
    cursor: pointer;
    overflow: hidden;
    transition: background 0.15s, border-color 0.15s;
    display: flex;
    flex-direction: column;
    position: relative;
}
.dbx-card:hover { background: #263244; }
.dbx-card.dbx-selected { border-color: #3B82F6; }
.dbx-card-thumb {
    width: 100%;
    aspect-ratio: 16/10;
    background: #111827;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.dbx-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.dbx-card-thumb .dbx-icon-placeholder {
    font-size: 32px;
    color: #374151;
}
.dbx-card-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0,0,0,0.7);
    color: #E5E7EB;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
}
.dbx-card-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid #4B5563;
    background: rgba(17,24,39,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: transparent;
    transition: all 0.12s;
}
.dbx-card.dbx-selected .dbx-card-checkbox {
    background: #3B82F6;
    border-color: #3B82F6;
    color: #fff;
}
.dbx-card-info {
    padding: 8px 10px;
}
.dbx-card-name {
    font-size: 13px;
    color: #E5E7EB;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}
.dbx-card-meta {
    font-size: 11px;
    color: #6B7280;
    margin-top: 2px;
    display: flex;
    gap: 8px;
}

/* List view */
.dbx-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.dbx-list-header {
    display: grid;
    grid-template-columns: 2fr 0.8fr 0.8fr 1fr 1fr;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6B7280;
    border-bottom: 1px solid #374151;
}
.dbx-list-row {
    display: grid;
    grid-template-columns: 2fr 0.8fr 0.8fr 1fr 1fr;
    padding: 8px 12px;
    align-items: center;
    font-size: 13px;
    color: #D1D5DB;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s;
    border: 2px solid transparent;
}
.dbx-list-row:hover { background: #1F2937; }
.dbx-list-row.dbx-selected {
    background: #1F2937;
    border-color: #3B82F6;
}
.dbx-list-row-name {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}
.dbx-list-row-name i {
    font-size: 16px;
    color: #6B7280;
    flex-shrink: 0;
}
.dbx-list-row-name span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dbx-list-thumb {
    width: 24px;
    height: 24px;
    background: #111827;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.dbx-list-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.dbx-list-thumb i {
    font-size: 12px !important;
}

/* ---- Preview Panel ---- */
.dbx-preview {
    width: 320px;
    min-width: 280px;
    background: #0F172A;
    border-left: 1px solid #374151;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}
.dbx-preview-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6B7280;
    font-size: 13px;
    text-align: center;
    padding: 20px;
}
.dbx-preview-thumb {
    width: 100%;
    aspect-ratio: 16/10;
    background: #111827;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.dbx-preview-thumb img,
.dbx-preview-thumb video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.dbx-preview-details {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.dbx-preview-name {
    font-size: 15px;
    font-weight: 600;
    color: #E5E7EB;
    word-break: break-word;
    margin-bottom: 8px;
}
.dbx-preview-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
}
.dbx-preview-row-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #9CA3AF;
}
.dbx-preview-row-label i {
    width: 16px;
    text-align: center;
    font-size: 12px;
}
.dbx-preview-row-value {
    color: #E5E7EB;
    text-align: right;
}
.dbx-preview-action {
    margin-top: 12px;
    background: #1F2937;
    border: 1px solid #374151;
    border-radius: 8px;
    color: #E5E7EB;
    font-size: 13px;
    padding: 8px;
    cursor: pointer;
    text-align: center;
    transition: background 0.12s;
    width: 100%;
}
.dbx-preview-action:hover { background: #263244; }
.dbx-preview-font-sample {
    padding: 16px;
    background: #111827;
    color: #E5E7EB;
    font-size: 18px;
    line-height: 1.5;
    text-align: center;
}

/* ---- Footer ---- */
.dbx-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: #111827;
    border-top: 1px solid #374151;
    flex-shrink: 0;
}
.dbx-footer-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #9CA3AF;
}
.dbx-footer-info i { font-size: 20px; color: #6B7280; }
.dbx-footer-info-text strong { color: #E5E7EB; font-weight: 500; }
.dbx-footer-actions {
    display: flex;
    gap: 10px;
}
.dbx-btn-cancel {
    background: #1F2937;
    border: 1px solid #374151;
    border-radius: 8px;
    color: #E5E7EB;
    font-size: 13px;
    padding: 8px 20px;
    cursor: pointer;
    transition: background 0.12s;
}
.dbx-btn-cancel:hover { background: #263244; }
.dbx-btn-select {
    background: #3B82F6;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 24px;
    cursor: pointer;
    transition: background 0.12s;
}
.dbx-btn-select:hover { background: #2563EB; }
.dbx-btn-select:disabled {
    background: #374151;
    color: #6B7280;
    cursor: not-allowed;
}

/* ---- States ---- */
.dbx-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 40px;
    color: #6B7280;
    font-size: 14px;
    text-align: center;
}
.dbx-empty-state i { font-size: 36px; margin-bottom: 8px; }
.dbx-empty-state small { font-size: 12px; }

.dbx-error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px;
    color: #EF4444;
    text-align: center;
}
.dbx-error-retry {
    background: #1F2937;
    border: 1px solid #374151;
    border-radius: 8px;
    color: #E5E7EB;
    font-size: 13px;
    padding: 8px 16px;
    cursor: pointer;
}
.dbx-error-retry:hover { background: #263244; }

/* Skeleton loader */
.dbx-skeleton {
    background: linear-gradient(90deg, #1F2937 25%, #263244 50%, #1F2937 75%);
    background-size: 200% 100%;
    animation: dbx-shimmer 1.5s ease-in-out infinite;
    border-radius: 10px;
}
.dbx-skeleton-card {
    height: 180px;
}
@keyframes dbx-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Invalid file message */
.dbx-invalid-msg {
    background: rgba(239,68,68,0.12);
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: 8px;
    color: #FCA5A5;
    font-size: 12px;
    padding: 8px 12px;
    margin-top: 8px;
}

/* Importing overlay */
.dbx-importing {
    position: absolute;
    inset: 0;
    background: rgba(17,24,39,0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 10;
    border-radius: 12px;
    color: #E5E7EB;
    font-size: 14px;
}

/* Filter dropdown */
.dbx-filter-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: #1F2937;
    border: 1px solid #374151;
    border-radius: 8px;
    padding: 8px;
    z-index: 20;
    min-width: 220px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    display: none;
}
.dbx-filter-dropdown.dbx-open { display: block; }
.dbx-filter-dropdown label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    font-size: 13px;
    color: #D1D5DB;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.1s;
}
.dbx-filter-dropdown label:hover { background: #263244; }
.dbx-filter-dropdown input[type="checkbox"] {
    accent-color: #3B82F6;
}

/* ---- Responsive ---- */
@media (max-width: 1100px) {
    .dbx-preview { display: none; }
}
@media (max-width: 800px) {
    .dbx-sidebar { display: none; }
    .dbx-picker { width: 95vw; }
}

/* Scrollbar styling */
.dbx-sidebar::-webkit-scrollbar,
.dbx-content::-webkit-scrollbar,
.dbx-preview::-webkit-scrollbar {
    width: 6px;
}
.dbx-sidebar::-webkit-scrollbar-track,
.dbx-content::-webkit-scrollbar-track,
.dbx-preview::-webkit-scrollbar-track {
    background: transparent;
}
.dbx-sidebar::-webkit-scrollbar-thumb,
.dbx-content::-webkit-scrollbar-thumb,
.dbx-preview::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 3px;
}
