/* ================================================================
   Universal File Selector - OPS-X Premium Theme
   Cinematic Dark Mode with Gold Accents
   ================================================================ */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600&family=Barlow:wght@300;400&family=Oswald:wght@400;600&display=swap');

/* File Selector Base */
.file-selector {
position: absolute;
width: 500px;
z-index: 10000;
background: rgba(0, 0, 0, 0.95);
border: 1px solid rgba(255, 255, 255, 0.1);
box-shadow: 0 0 60px rgba(255, 215, 0, 0.4);
backdrop-filter: blur(20px);
display: none;
flex-direction: column;
overflow: hidden;
font-family: 'Barlow', sans-serif;
font-size: 14px;
color: #e0e0e0;
}

/* Modal variant */
.file-selector.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 800px;
    max-width: 90vw;
    height: 600px;
    max-height: 90vh;
    z-index: 10001;
}

/* Backdrop for modal */
.file-selector-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: none;
    animation: fadeIn 0.2s ease;
}

.file-selector-backdrop.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Top accent line */
.file-selector::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        #d4af37 50%, 
        transparent 100%);
    opacity: 0.8;
}

/* Gradient overlay */
.file-selector::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(145deg, 
        rgba(255,215,0,0.02) 0%, 
        transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.file-selector.active {
display: flex;
min-width: 700px;
}

.file-selector.type-files {
width: -webkit-fill-available;
max-height: 400px;
overflow: auto;
}

.file-selector.type-files.modal {
width: 800px;
max-height: 600px;
}

.file-selector.type-allfiles {
    width: 700px;
}

/* Header */
.file-selector-header {
    background: rgba(0,0,0,0.6);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

.file-selector-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding: 12px 15px;
}

/* Modal close button */
.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.1);
    color: #999;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 16px;
}

.modal-close:hover {
    border-color: #d4af37;
    color: #d4af37;
    transform: rotate(90deg);
}

.file-selector-search-input {
    flex: 1;
    min-width: 200px;
    padding: 8px 15px;
    background: rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.05);
    color: #e0e0e0;
    font-family: 'Barlow', sans-serif;
    letter-spacing: 1px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.file-selector-search-input::placeholder {
    color: #999;
    font-style: italic;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.file-selector-search-input:focus {
    border-color: rgba(212,175,55,0.3);
    background: rgba(25,25,25,0.8);
    box-shadow: 0 0 10px rgba(255,215,0,0.2);
}

.file-count {
    font-size: 11px;
    color: #d4af37;
    padding: 4px 10px;
    background: rgba(0,0,0,0.3);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: 'Oswald', sans-serif;
}

.file-selector-controls button {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.05);
    color: #999;
    padding: 6px 12px;
    font-size: 11px;
    font-family: 'Barlow', sans-serif;
    font-weight: 300;
    font-style: italic;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* Button hover effect */
.file-selector-controls button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255,215,0,0.2);
    transition: left 0.5s ease;
    z-index: -1;
}

.file-selector-controls button:hover::before {
    left: 0;
}

.file-selector-controls button:hover {
    border-color: #d4af37;
    color: #ffd700;
    transform: translateY(-1px);
}

.file-selector-controls button i {
    font-size: 10px;
    transition: transform 0.3s ease;
}

.file-selector-controls button:hover i {
    transform: rotate(180deg);
}

.cache-status {
    font-size: 10px;
    color: #999;
    padding: 4px 10px;
    background: rgba(0,0,0,0.3);
    font-style: italic;
    font-family: 'Barlow', sans-serif;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Version Filter Checkbox */
.version-filter-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #999;
    cursor: pointer;
    transition: color 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Barlow', sans-serif;
    font-weight: 300;
    font-style: italic;
}

.version-filter-label:hover {
    color: #d4af37;
}

.version-filter-checkbox {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: #d4af37;
}

/* Grid */
.file-selector-grid {
    flex: 1;
    padding: 15px;
    display: grid;
    gap: 8px;
    align-content: start;
    background: rgba(18,18,18,0.3);
    position: relative;
    z-index: 1;
    scrollbar-width: thin;
    scrollbar-color: #d4af37 transparent;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Grid background pattern */
.file-selector-grid::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(255,215,0,0.01) 1px, transparent 1px), 
        linear-gradient(90deg, rgba(255,215,0,0.01) 1px, transparent 1px);
    background-size: 30px 30px;
    pointer-events: none;
    opacity: 0.3;
    z-index: -1;
}

.file-selector-grid::-webkit-scrollbar {
    width: 6px;
}

.file-selector-grid::-webkit-scrollbar-track {
    background: rgba(255,215,0,0.1);
}

.file-selector-grid::-webkit-scrollbar-thumb {
    background: #d4af37;
    border-radius: 0;
}

.file-selector-grid::-webkit-scrollbar-thumb:hover {
    background: #ffd700;
}

.file-selector-grid.type-images {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
}

.file-selector-grid.type-files {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.file-selector-grid.type-mixed {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

/* File Items */
.file-selector-item {
    background: rgba(30,30,30,0.8);
    border: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
    animation: fileFadeIn 0.2s ease forwards;
}

/* Hover effect accent */
.file-selector-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #d4af37, transparent);
    transform: scaleY(0);
    transition: transform 0.3s ease;
    opacity: 0.8;
}

.file-selector-item:hover {
    background: rgba(255,215,0,0.05);
    border-color: #d4af37;
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(255,215,0,0.2);
}

.file-selector-item:hover::before {
    transform: scaleY(1);
}

@keyframes fileFadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px);
    }
    to { 
        opacity: 1; 
        transform: translateY(0);
    }
}

/* Images */
.file-selector-img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    display: block;
    background: #000;
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* File with Icon */
.file-item-content {
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 4px;
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.file-selector-item:hover .file-icon {
    border-color: #d4af37;
    box-shadow: 0 0 10px rgba(255,215,0,0.3);
}

.file-icon i {
    font-size: 24px;
    transition: transform 0.3s ease;
}

.file-selector-item:hover .file-icon i {
    transform: scale(1.1);
}

.file-details {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 10px;
    color: #e0e0e0;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Montserrat', sans-serif;
    margin-bottom: 4px;
    transition: color 0.3s;
}

.file-selector-item:hover .file-name {
    color: #d4af37;
}

.file-size {
    font-size: 10px;
    color: #999;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    opacity: 0.7;
}

/* States */
.file-selector-loading,
.file-selector-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #999;
    font-size: 10px;
    font-family: 'Barlow', sans-serif;
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
}

.file-selector-loading::after {
    content: '';
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        #d4af37 50%, 
        transparent 100%);
    animation: loadingSlide 1.5s infinite;
}

@keyframes loadingSlide {
    0% { transform: translateX(-50%) scaleX(0); }
    50% { transform: translateX(-50%) scaleX(1); }
    100% { transform: translateX(-50%) scaleX(0); }
}

.file-selector-error {
    color: rgba(255,100,100,0.8);
}

/* Pagination */
.file-selector-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: rgba(0,0,0,0.6);
    border-top: 1px solid rgba(255,255,255,0.05);
    font-size: 11px;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.file-selector-pagination::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        #d4af37 50%, 
        transparent 100%);
    opacity: 0.6;
}

.file-selector-pagination button {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.05);
    color: #999;
    padding: 6px 15px;
    font-size: 10px;
    font-family: 'Barlow', sans-serif;
    font-weight: 300;
    font-style: italic;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.file-selector-pagination button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255,215,0,0.2);
    transition: left 0.5s ease;
    z-index: -1;
}

.file-selector-pagination button:hover:not(:disabled)::before {
    left: 0;
}

.file-selector-pagination button:hover:not(:disabled) {
    border-color: #d4af37;
    color: #ffd700;
    transform: translateY(-1px);
}

.file-selector-pagination button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.page-info {
    color: #999;
    font-size: 10px;
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
    letter-spacing: 3px;
}

/* Info Bar */
.file-selector-info {
    padding: 8px 12px;
    background: rgba(0,0,0,0.4);
    border-top: 1px solid rgba(255,255,255,0.05);
    font-size: 10px;
    color: #999;
    text-align: center;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    opacity: 0.6;
    flex-shrink: 0;
}

/* Context Menu */
.file-context-menu {
    position: fixed;
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    backdrop-filter: blur(10px);
    z-index: 10002;
    display: none;
    font-family: 'Barlow', sans-serif;
    font-size: 12px;
    min-width: 180px;
    animation: contextFadeIn 0.15s ease;
}

@keyframes contextFadeIn {
    from { 
        opacity: 0;
        transform: scale(0.95);
    }
    to { 
        opacity: 1;
        transform: scale(1);
    }
}

.file-context-menu.active {
    display: block;
}

.context-menu-item {
    padding: 10px 15px;
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 10px;
    font-weight: 300;
    font-style: italic;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.context-menu-item:last-child {
    border-bottom: none;
}

.context-menu-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #d4af37;
    transform: scaleY(0);
    transition: transform 0.2s;
}

.context-menu-item:hover {
    background: rgba(255, 215, 0, 0.1);
    color: #d4af37;
    padding-left: 20px;
}

.context-menu-item:hover::before {
    transform: scaleY(1);
}

.context-menu-item i {
    margin-right: 8px;
    width: 14px;
    display: inline-block;
    text-align: center;
}

/* Mobile */
@media (max-width: 768px) {
    .file-selector:not(.modal) {
        position: fixed;
        top: 10px;
        left: 10px;
        right: 10px;
        width: auto;
        max-width: none;
        height: calc(100vh - 20px);
        max-height: none;
    }
    
    .file-selector.modal {
        width: calc(100vw - 20px);
        height: calc(100vh - 20px);
    }
}

/* Focus States */
.file-selector *:focus-visible {
    outline: 2px solid #d4af37;
    outline-offset: 2px;
}


.file-selector.active, .file-selector.type-files.type-allfiles.modal.active {
    height: auto;
}