/**
 * NDK File Manager - Custom Styles
 */

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.dark ::-webkit-scrollbar-thumb {
    background: #475569;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Focus styles */
*:focus {
    outline: none;
}

*:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Transitions */
.transition-colors {
    transition-property: background-color, border-color, color, fill, stroke;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

/* File grid item hover effect */
.group:hover .group-hover\:shadow-md {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Context menu animation */
[x-show="contextMenu.show"] {
    animation: contextMenuIn 0.1s ease-out;
}

@keyframes contextMenuIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Modal backdrop blur */
.modal-backdrop {
    backdrop-filter: blur(4px);
}

/* Loading spinner */
.animate-spin {
    animation: spin 1s linear infinite;
}

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

/* Drag and drop overlay */
[x-show="dragOver"] {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* File/folder selection */
.selected-item {
    background-color: rgba(59, 130, 246, 0.1);
    border-color: #3b82f6;
}

/* Truncate text */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Grid responsive adjustments */
@media (max-width: 640px) {
    .grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Sidebar folder tree indentation */
.folder-tree-item {
    padding-left: calc(0.5rem + var(--depth, 0) * 1rem);
}

/* Toast notifications */
.toast-enter {
    animation: toastIn 0.3s ease-out;
}

.toast-leave {
    animation: toastOut 0.2s ease-in;
}

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

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

/* Preview modal image/video max sizing */
.preview-content img,
.preview-content video {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

/* Thumbnail loading animation */
img[loading="lazy"] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.dark img[loading="lazy"] {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Aspect ratio for grid thumbnails */
.aspect-square {
    aspect-ratio: 1 / 1;
}

/* Video thumbnail styling */
video[preload="metadata"] {
    background-color: #1f2937;
}

/* Table header sticky */
thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Hide scrollbar but keep functionality for sidebar */
.sidebar-scroll {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

.sidebar-scroll:hover {
    scrollbar-color: #cbd5e1 transparent;
}

.dark .sidebar-scroll:hover {
    scrollbar-color: #475569 transparent;
}

/* Keyboard focus for file items */
.file-item:focus {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
}

/* Button disabled state */
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Input placeholder styling */
input::placeholder {
    color: #9ca3af;
}

.dark input::placeholder {
    color: #6b7280;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Print styles - hide UI elements */
@media print {
    header,
    aside,
    .toolbar,
    .toast,
    .modal {
        display: none !important;
    }
}

/* Upload panel styling */
.upload-panel-enter {
    animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(1rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Upload progress bar animations */
.progress-bar {
    transition: width 0.15s ease-out;
}

/* Scrollbar for upload panel file list */
.upload-file-list::-webkit-scrollbar {
    width: 6px;
}

.upload-file-list::-webkit-scrollbar-track {
    background: transparent;
}

.upload-file-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.dark .upload-file-list::-webkit-scrollbar-thumb {
    background: #4b5563;
}
