/* =========================================================
   ENCBYT MY FILES - WORKSPACE VIEW OPTIMIZED v2.6
   Path: frontend/pwa/css/files.css
   Security: Strict CSP Compliant | Dark Mode Supported
   Typography: Plus Jakarta Sans (Glossy Finish)
   Fix: Instant search bar styles added.
   ========================================================= */

:root {
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --bg-light: #f8fafc;
    --card-bg: #ffffff;
    --primary-blue: #2563eb;
    --primary-hover: #1d4ed8;
    --success-green: #10b981;
    --item-hover-bg: #f8fafc;
    --item-hover-border: #93c5fd;
}

[data-theme="dark"], body.dark-mode {
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --border-color: #2d3748;
    --bg-light: #0f1115;
    --card-bg: #1c1f26;
    --primary-blue: #8B5CF6;
    --primary-hover: #7C3AED;
    --success-green: #34d399;
    --item-hover-bg: #222630;
    --item-hover-border: #4338ca;
}

[data-theme="dark"] .files-top-toolbar, body.dark-mode .files-top-toolbar {
    background: #0f1115 !important;
    border-bottom: 1px solid #2d3748 !important;
}

/* ============ 1. BREADCRUMBS & TOOLBAR WRAPPER ============ */
.files-top-toolbar {
    /* ✅ Sticky header — stays at top while scrolling */
    position: sticky;
    top: 0;
    z-index: 100;
    background: #ffffff;
    
    /* Original properties */
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    margin-bottom: 16px;
    flex-wrap: nowrap;
}

.toolbar-left-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    overflow: hidden;
}

.toolbar-left-group h2 {
    font-size: 19px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.3px;
    margin: 0;
    white-space: nowrap;
}

.breadcrumb-divider {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 14px;
    user-select: none;
}

.files-breadcrumb-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0 !important;
    white-space: nowrap;
}

.breadcrumb-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.breadcrumb-item.clickable {
    cursor: pointer;
    color: var(--primary-blue);
}

.breadcrumb-item.clickable:hover {
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: var(--text-main);
    font-weight: 600;
    cursor: default;
}

.breadcrumb-separator {
    color: var(--text-muted);
    margin: 0 3px;
    user-select: none;
}

/* ============ 1b. TOOLBAR RIGHT — FILTER, SORT, VIEW, UPLOAD ============ */

.toolbar-center-group {
    flex: 1;
    min-width: 0;
}

.toolbar-right-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: nowrap;
}

/* --- Tool Select Dropdowns (Filter, Sort, View) --- */
.tool-select {
    height: 36px;
    padding: 0 32px 0 12px;
    background-color: var(--card-bg);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: 9px;
    color: var(--text-main);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    white-space: nowrap;
    box-sizing: border-box;
    letter-spacing: -0.1px;
}

.tool-select:hover {
    border-color: var(--primary-blue);
    background-color: var(--bg-light);
}

.tool-select:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

[data-theme="dark"] .tool-select,
body.dark-mode .tool-select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

/* --- Upload Action Button (Blue) --- */
.btn-upload-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 36px;
    padding: 0 16px;
    background: var(--primary-blue);
    color: #ffffff;
    border: 1.5px solid var(--primary-blue);
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    white-space: nowrap;
    box-sizing: border-box;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.18);
    letter-spacing: -0.1px;
}

.btn-upload-action:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
}

.btn-upload-action:active {
    transform: translateY(1px);
}

.btn-upload-action:focus-visible {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35);
}

.btn-upload-action i {
    font-size: 13px;
    line-height: 1;
}

/* --- Icon Tool Button (Plus/New Folder) --- */
.btn-tool-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    background: var(--card-bg);
    color: var(--text-main);
    border: 1.5px solid var(--border-color);
    border-radius: 9px;
    font-size: 13px;
    cursor: pointer;
    outline: none;
    box-sizing: border-box;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.btn-tool-icon:hover {
    background: var(--bg-light);
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

.btn-tool-icon:active {
    transform: translateY(1px);
}

.btn-tool-icon:focus-visible {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

/* --- Add Button (New Folder — Green Accent) --- */
.btn-tool-icon.add-btn {
    background: var(--success-green);
    color: #ffffff;
    border-color: var(--success-green);
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.18);
}

.btn-tool-icon.add-btn:hover {
    background: #059669;
    border-color: #059669;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.28);
}

.btn-tool-icon.add-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.35);
}

/* --- Toolbar Responsive (Mobile) --- */
@media (max-width: 900px) {
    .files-top-toolbar {
        flex-wrap: wrap;
        row-gap: 10px;
    }

    .toolbar-right-group {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 6px;
    }

    .tool-select {
        flex: 1;
        min-width: 0;
    }

    .btn-upload-action {
        flex: 0 0 auto;
    }
}

@media (max-width: 600px) {
    .files-top-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-left-group {
        width: 100%;
    }

    .toolbar-right-group {
        width: 100%;
        justify-content: stretch;
    }

    .tool-select {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
    }

    .btn-upload-action {
        flex: 1 1 100%;
    }

    .btn-tool-icon {
        flex: 0 0 36px;
    }
}

/* ============ 2. VECTOR SVG ICONS ============ */
.cv-file-svg-icon {
    display: block;
    object-fit: contain;
    user-select: none;
    pointer-events: none;
}

.cv-svg-grid {
    width: 28px;
    height: 28px;
}

.cv-svg-list {
    width: 22px;
    height: 22px;
}

.cv-svg-classic {
    width: 38px;
    height: 38px;
}

.cv-svg-empty {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px auto;
    opacity: 0.65;
}

/* ============ 3. GRID VIEW ============ */
#fileListContainer.view-mode-grid,
.view-mode-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important;
    gap: 14px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 4px 0 !important;
}

.view-mode-grid .native-file-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 68px !important;
    padding: 10px 14px !important;
    background: var(--card-bg) !important;
    border: 1.5px solid var(--border-color) !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
    text-align: left !important;
    cursor: pointer !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
    transition: all 0.15s ease !important;
}

.view-mode-grid .native-file-item:hover {
    border-color: var(--item-hover-border) !important;
    background: var(--item-hover-bg) !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08) !important;
    transform: translateY(-1px) !important;
}

.view-mode-grid .grid-card-icon {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: var(--bg-light) !important;
    border-radius: 10px !important;
    flex-shrink: 0 !important;
    margin-right: 12px !important;
}

.view-mode-grid .grid-card-details {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    overflow: hidden !important;
    flex: 1 !important;
    min-width: 0 !important;
}

.view-mode-grid .grid-card-title {
    font-size: 13.5px !important;
    font-weight: 500 !important;
    color: var(--text-main) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.3 !important;
    letter-spacing: -0.1px !important;
}

.view-mode-grid .grid-card-meta {
    font-size: 12px !important;
    font-weight: 500 !important;
    color: var(--text-muted) !important;
    margin-top: 3px !important;
}

/* ============ 4. LIST VIEW ============ */
#fileListContainer.view-mode-list,
.view-mode-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 4px 0 !important;
}

.view-mode-list .native-file-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    height: 48px !important;
    padding: 8px 16px !important;
    background: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
}

.view-mode-list .native-file-item:hover {
    background: var(--item-hover-bg) !important;
    border-color: var(--text-muted) !important;
}

.view-mode-list .list-row-left {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
    overflow: hidden !important;
    flex: 1 !important;
    min-width: 0 !important;
}

.view-mode-list .list-row-icon {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

.view-mode-list .list-row-name {
    font-size: 13.5px !important;
    font-weight: 500 !important;
    color: var(--text-main) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    letter-spacing: -0.1px !important;
}

.view-mode-list .list-row-right {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 24px !important;
    font-size: 12.5px !important;
    font-weight: 500 !important;
    color: var(--text-muted) !important;
    flex-shrink: 0 !important;
}

/* ============ 5. CLASSIC VIEW ============ */
#fileListContainer.view-mode-classic,
.view-mode-classic {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 12px 14px !important;
    width: 100% !important;
    padding: 4px 0 !important;
}

.view-mode-classic .native-file-item {
    width: 104px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    padding: 10px 6px !important;
    border-radius: 10px !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    cursor: pointer !important;
    user-select: none !important;
    transition: all 0.15s ease !important;
}

.view-mode-classic .native-file-item:hover {
    background: var(--bg-light) !important;
    border-color: var(--border-color) !important;
}

.view-mode-classic .native-icon-wrapper {
    width: 48px !important;
    height: 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-bottom: 6px !important;
}

.view-mode-classic .native-file-name {
    font-size: 12.5px !important;
    font-weight: 500 !important;
    color: var(--text-main) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    width: 100% !important;
    letter-spacing: -0.1px !important;
}

.view-mode-classic .native-file-size {
    font-size: 11.5px !important;
    font-weight: 500 !important;
    color: var(--text-muted) !important;
    margin-top: 2px !important;
}

/* ============ 6. LOADING & EMPTY STATES ============ */
.files-state-box,
.files-empty-state {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    min-height: 45vh !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    margin: auto !important;
    text-align: center !important;
}

.files-state-box .state-label {
    font-size: 14px !important;
    font-weight: 500 !important;
    color: var(--text-muted) !important;
}

.files-empty-state .empty-title {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: var(--text-main) !important;
}

.files-empty-state .empty-desc {
    font-size: 13px !important;
    font-weight: 500 !important;
    color: var(--text-muted) !important;
    margin-top: 4px !important;
}

/* ============ 7. INSTANT SEARCH BAR ============ */

.toolbar-search-group {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 360px;
    display: flex;
    justify-content: center;
}

.cv-search-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    height: 36px;
    background: var(--card-bg);
    border: 1.5px solid var(--border-color);
    border-radius: 9px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    box-sizing: border-box;
}

.cv-search-wrapper:focus-within {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.cv-search-icon {
    position: absolute;
    left: 12px;
    font-size: 12px;
    color: var(--text-muted);
    pointer-events: none;
    transition: color 0.15s ease;
}

.cv-search-wrapper:focus-within .cv-search-icon {
    color: var(--primary-blue);
}

.cv-search-input {
    width: 100%;
    height: 100%;
    padding: 0 68px 0 34px;
    background: transparent;
    border: none;
    outline: none;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-main);
    letter-spacing: -0.1px;
    box-sizing: border-box;
}

.cv-search-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
    opacity: 0.75;
}

.cv-search-clear,
.cv-search-loading {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
    padding: 0;
    outline: none;
}

.cv-search-clear.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.cv-search-clear:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.cv-search-loading {
    pointer-events: none;
    color: var(--primary-blue);
}

.cv-search-loading.is-visible {
    opacity: 1;
}

.cv-search-loading i {
    font-size: 11px;
}

.cv-search-wrapper.is-loading .cv-search-clear {
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 900px) {
    .toolbar-search-group {
        order: 3;
        flex: 1 1 100%;
        max-width: 100%;
        margin-top: 4px;
    }
}

@media (max-width: 600px) {
    .toolbar-search-group {
        max-width: 100%;
    }

    .cv-search-input {
        font-size: 13px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   FILES PAGE — main-content padding-top: 0
   Sticky toolbar viewport top pe 0px pe pin ho
   ═══════════════════════════════════════════════════════════════ */
body:has(.files-top-toolbar) .main-content {
    padding-top: 0;
}

/* ============================================================
   BATCH SELECT — Windows 11 Style Checkboxes + Toolbar
   ============================================================ */

/* Checkbox — har file item pe (top-left corner) */
.cv-item-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid #cbd5e1;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease;
    pointer-events: auto;
}

/* Hover pe checkbox visible */
.native-file-item:hover .cv-item-checkbox {
    opacity: 1;
}

/* Selected state */
.native-file-item.cv-selected .cv-item-checkbox {
    opacity: 1;
    background: #3b82f6;
    border-color: #3b82f6;
}

.native-file-item.cv-selected .cv-item-checkbox::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid #ffffff;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg) translate(-1px, -1px);
}

/* Selected item ka background highlight */
.native-file-item.cv-selected {
    background: rgba(59, 130, 246, 0.08) !important;
    border-color: #3b82f6 !important;
}

/* Grid item relative positioning (checkbox ke liye) */
.native-file-item {
    position: relative;
}

/* Checkbox click — item click se alag */
.cv-item-checkbox:active {
    transform: scale(0.9);
}

/* ============================================================
   SELECTION TOOLBAR (top pe show jab 1+ selected)
   ============================================================ */
.cv-selection-toolbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: #ffffff;
    padding: 10px 16px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
    animation: cvSlideDown 0.2s ease;
}

@keyframes cvSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.cv-selection-count {
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cv-selection-count .cv-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.cv-selection-count .cv-close-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

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

.cv-selection-actions button {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.cv-selection-actions button:hover {
    background: rgba(255, 255, 255, 0.28);
    transform: translateY(-1px);
}

.cv-selection-actions button.cv-danger {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
}

.cv-selection-actions button.cv-danger:hover {
    background: rgba(239, 68, 68, 0.45);
}

/* Dark mode support */
[data-theme="dark"] .cv-item-checkbox,
body.dark-mode .cv-item-checkbox {
    background: #1f2937;
    border-color: #4b5563;
}

[data-theme="dark"] .native-file-item.cv-selected,
body.dark-mode .native-file-item.cv-selected {
    background: rgba(59, 130, 246, 0.15) !important;
}

[data-theme="dark"] .cv-selection-toolbar,
body.dark-mode .cv-selection-toolbar {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
}

/* ============================================================
   UPLOAD DROPDOWN MENU
   ============================================================ */
.upload-menu-wrapper {
    position: relative;
    display: inline-block;
}

.upload-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 240px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.06);
    padding: 6px;
    z-index: 1000;
    animation: cvDropdownIn 0.15s ease;
}

@keyframes cvDropdownIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.upload-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s ease;
}

.upload-menu-item:hover {
    background: #f1f5f9;
}

.upload-menu-item > i {
    font-size: 18px;
    color: #3b82f6;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.upload-menu-title {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 2px;
}

.upload-menu-sub {
    font-size: 11px;
    color: #64748b;
}

/* Dark mode */
[data-theme="dark"] .upload-dropdown-menu,
body.dark-mode .upload-dropdown-menu {
    background: #111827;
    border-color: #1f2937;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .upload-menu-item:hover,
body.dark-mode .upload-menu-item:hover {
    background: #1a1f2e;
}

[data-theme="dark"] .upload-menu-title,
body.dark-mode .upload-menu-title {
    color: #f9fafb;
}

[data-theme="dark"] .upload-menu-sub,
body.dark-mode .upload-menu-sub {
    color: #9ca3af;
}

[data-theme="dark"] .upload-menu-item > i,
body.dark-mode .upload-menu-item > i {
    color: #06b6d4;
}





/* ============================================================

/* Ensure scope-shared stage is full width */
.spa-stage.scope-shared {
    width: 100%;
    max-width: 100%;
}

/* Responsive — mobile (match dashboard) */
@media (max-width: 968px) {
    .cv-shared-page {
        padding: 12px;
    }
}


/* ============================================================
   Shared Page (v2) — Layout Match Dashboard
   ============================================================ */

/* Main-content already provides margin-left: 280px + padding: 32px 36px */
/* Shared wrapper just fills available space */

.cv-shared-page {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0;
    margin: 0;
}

.spa-stage.scope-shared {
    width: 100%;
    max-width: 100%;
}

@media (max-width: 968px) {
    .cv-shared-page {
        padding: 12px;
    }
}



/* ═══════════════════════════════════════════════════════════
   Shared Files Page — File Type + Sort + Load More
   ═══════════════════════════════════════════════════════════ */

/* Sort Dropdown */
.toolbar-select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-main);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    min-width: 140px;
    outline: none;
    transition: border-color 0.15s ease;
}

.toolbar-select:hover {
    border-color: var(--accent-primary);
}

.toolbar-select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* File Type Badge */
.file-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.file-type-badge i {
    font-size: 11px;
}

/* Load More */
.shared-load-more-wrap {
    text-align: center;
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.btn-load-more {
    padding: 10px 24px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-main);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s ease;
    font-family: inherit;
}

.btn-load-more:hover {
    background: var(--hover-bg);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Table responsive */
@media (max-width: 1100px) {
    .premium-table th:nth-child(2),
    .premium-table td:nth-child(2) {
        display: none;  /* Hide Type column on small screens */
    }
}

@media (max-width: 900px) {
    .premium-table th:nth-child(3),
    .premium-table td:nth-child(3) {
        display: none;  /* Hide Security column */
    }
}

@media (max-width: 768px) {
    .toolbar-select {
        min-width: 100px;
        font-size: 12px;
        padding: 6px 8px;
    }
}

/* ═══════════════════════════════════════════════════════════
   Shared Files — Clean Table Layout
   ═══════════════════════════════════════════════════════════ */

.table-file-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-file-size {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

/* Remove old file-cell styles (icon gone) */
.table-file-cell {
    display: block;
}
.table-file-icon {
    display: none;
}
.table-file-info {
    display: block;
}
.table-file-meta {
    display: none;
}

/* ═══════════════════════════════════════════════════════════
   Star Badge (Grid Card Top-Right)
   ═══════════════════════════════════════════════════════════ */
.native-file-item {
    position: relative;
}

.grid-card-star-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #f59e0b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.4);
    z-index: 2;
    pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════
   Star Badge — All View Modes (grid, list, classic)
   ═══════════════════════════════════════════════════════════ */

/* Ensure all file items can hold the badge */
.native-file-item {
    position: relative;
}

/* Grid view — top-right badge */
.view-mode-grid .native-file-item .grid-card-star-badge,
.view-mode-classic .native-file-item .grid-card-star-badge,
.view-mode-list .native-file-item .grid-card-star-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #f59e0b;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.4);
    z-index: 10;
    pointer-events: none;
}

/* List view — inline star next to name */
.view-mode-list .native-file-item .grid-card-star-badge {
    position: static;
    width: 18px;
    height: 18px;
    margin-left: 6px;
    font-size: 9px;
    box-shadow: none;
    background: transparent;
    color: #f59e0b;
}

/* Classic view — top-right badge (smaller) */
.view-mode-classic .native-file-item .grid-card-star-badge {
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    font-size: 9px;
}

.list-row-star {
    color: #f59e0b !important;
    margin-left: 6px !important;
    font-size: 11px !important;
    flex-shrink: 0 !important;
    display: inline-block !important;
}

/* ═══════════════════════════════════════════════════════════
   Locked Folder — Dimmed / Disabled Look
═══════════════════════════════════════════════════════════ */
.native-file-item.folder-locked {
    opacity: 0.7;
    filter: grayscale(0.3);
}
.native-file-item.folder-locked:hover {
    opacity: 0.85;
    filter: grayscale(0.1);
}
.native-file-item.folder-locked .grid-card-icon,
.native-file-item.folder-locked .list-row-icon,
.native-file-item.folder-locked .cv-file-svg-icon {
    opacity: 0.75;
}


/* --- Dark Mode Refinements — Files --- */
[data-theme="dark"] .native-file-item,
body.dark-mode .native-file-item {
    background: #111827 !important;
    border-color: #1f2937 !important;
}

[data-theme="dark"] .native-file-item:hover,
body.dark-mode .native-file-item:hover {
    background: #1e293b !important;
}

[data-theme="dark"] .drop-overlay-box,
body.dark-mode .drop-overlay-box {
    background: #111827 !important;
    border-color: #3b82f6 !important;
    color: #f9fafb !important;
}
