:root {
    --bg-color: #0f172a;
    --surface-color: rgba(30, 41, 59, 0.7);
    --surface-hover: rgba(51, 65, 85, 0.8);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --success-color: #10b981;
    --border-radius: 16px;
    --transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    z-index: -1;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--surface-hover);
    border-radius: 4px;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: #1e293b; /* Solid color for performance */
    border-right: 1px solid var(--border-color);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition);
    will-change: transform;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.brand .logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.brand h2 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.025em;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: 10px;
    transition: var(--transition);
    font-size: 0.95rem;
    font-weight: 500;
}

/* --- BOTTOM NAV (Mobile Only) --- */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    z-index: 999;
    justify-content: space-around;
    align-items: center;
    padding: 0 10px;
}

.bottom-nav .nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.7rem;
    transition: var(--transition);
    flex: 1;
}

.bottom-nav .nav-link i {
    font-size: 1.25rem;
}

.bottom-nav .nav-link.active {
    color: var(--accent-color);
}

.bottom-nav .nav-placeholder {
    width: 60px; /* Space for FAB */
}

/* --- MOBILE FAB --- */
.mobile-fab {
    display: none;
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
}

.fab-btn {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fab-btn.active {
    transform: rotate(45deg) scale(0.9);
    background: var(--danger-color);
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4);
}

.fab-options {
    position: absolute;
    bottom: 75px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fab-options.active {
    opacity: 1;
    pointer-events: all;
    transform: translateX(-50%) translateY(0);
}

.fab-opt {
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    border-radius: 12px;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.fab-opt i {
    color: var(--accent-color);
}


.nav-item i {
    font-size: 1.1rem;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-color);
}

.storage-widget {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
}

.storage-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 0.75rem;
}

.storage-info #storage-text {
    font-size: 1.25rem;
    font-weight: 600;
}

.storage-info .storage-limit {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.progress-bar {
    height: 6px;
    background: var(--surface-hover);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    width: 0%;
    transition: width 0.5s ease;
}

.storage-status {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    text-align: right;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem 3rem;
    overflow-y: auto;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1.5rem;
    position: relative;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex: 1;
    min-width: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    white-space: nowrap;
}

.user-profile .avatar {
    width: 40px;
    height: 40px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.user-profile .avatar:hover {
    color: var(--text-primary);
    border-color: var(--accent-color);
}

/* Action Bar & Breadcrumbs */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    background: var(--surface-color);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.breadcrumb-item {
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.breadcrumb-item:hover {
    color: var(--text-primary);
}

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

.breadcrumb-item:not(:last-child)::after {
    content: '/';
    margin-left: 0.5rem;
    color: var(--border-color);
}

.action-buttons {
    display: flex;
    gap: 0.75rem;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--text-secondary);
}

/* Bulk Actions Bar */
/* Bulk Actions Bar (Floating Dock) */
.bulk-actions-bar {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(150%); /* Hidden state */
    z-index: 1000;
    background: #3b82f6; /* Solid Blue for visibility */
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.bulk-actions-bar.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: all;
    visibility: visible;
}

.selection-info {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    padding-right: 1.5rem;
}

.bulk-buttons {
    display: flex;
    gap: 0.75rem;
}

.bulk-buttons .btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 30px;
    transition: var(--transition);
}

.bulk-buttons .btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.bulk-buttons .btn-danger {
    background: rgba(239, 68, 68, 0.8);
}

.bulk-buttons .btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    border: none;
}

.bulk-buttons .btn-danger {
    background: #fff;
    color: var(--danger-color);
}

/* Details Side Panel */
.details-panel {
    width: 320px;
    background: #1e293b; /* Solid color for performance */
    border-bottom: 1px solid var(--border-color);
    display: none;
    flex-direction: column;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.panel-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.detail-item {
    margin-bottom: 1.5rem;
}

.detail-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    display: block;
}

.detail-value {
    font-size: 0.95rem;
    word-break: break-all;
}

.preview-thumb {
    width: 100%;
    aspect-ratio: 1/1;
    background: #000;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.details-thumb-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.details-thumb-placeholder {
    position: absolute;
    font-size: 3rem;
    color: var(--border-color);
}

.details-thumb-container img {
    position: relative;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.preview-thumb i {
    font-size: 3rem;
    color: var(--accent-color);
}

/* Upload Section */
.upload-section {
    margin-bottom: 2rem;
}

.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 2.5rem 2rem;
    text-align: center;
    background: var(--surface-color);
    transition: var(--transition);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--accent-color);
    background: rgba(59, 130, 246, 0.05);
}

.upload-icon {
    font-size: 3.5rem;
    color: var(--accent-color);
    margin-bottom: 0;
}

.drop-zone h3 {
    margin: 0;
    font-weight: 600;
}

.drop-zone p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Premium Upload Card */
.upload-card {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 380px;
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    overflow: hidden;
    transform: translateY(120%);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    visibility: hidden;
}

.upload-card.active {
    transform: translateY(0);
    visibility: visible;
}

.upload-card-header {
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.upload-card-header span {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-color);
    letter-spacing: 0.5px;
}

.close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 1.2rem;
}

.close-btn:hover {
    background: var(--danger-color);
    transform: rotate(90deg);
}

.upload-card-body {
    padding: 20px;
}

.upload-info {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.file-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent-color), #3b82f6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.upload-info .file-details {
    flex: 1;
    min-width: 0;
}

.upload-filename {
    display: block;
    font-weight: 500;
    font-size: 0.95rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #f8fafc;
}

.upload-count {
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.upload-percent {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--accent-color);
    font-variant-numeric: tabular-nums;
}

.upload-progress-container {
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), #60a5fa);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

/* Shine effect on progress bar */
.upload-progress-fill::after {
    content: '';
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,0.2) 50%,
        rgba(255,255,255,0) 100%
    );
    animation: progress-shine 2s infinite;
}

@keyframes progress-shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@media (max-width: 480px) {
    .upload-card {
        right: 16px;
        left: 16px;
        width: auto;
        bottom: 16px;
    }
}

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

#upload-conflict-ui {
    animation: fadeInScale 0.3s ease-out;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 8px;
}

/* Files Section */
.files-section {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.table-container {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.files-table {
    width: 100%;
    border-collapse: collapse;
}

.files-table th, .files-table td {
    padding: 1rem 1.5rem;
    text-align: left;
}

.files-table th {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}

.files-table td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.95rem;
}

.files-table tr:last-child td {
    border-bottom: none;
}

.files-table tbody tr {
    content-visibility: auto;
    contain-intrinsic-size: 1px 60px;
}

.files-table tbody tr:hover {
    background: var(--surface-hover);
}

.file-name-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.file-name-cell i {
    color: var(--accent-color);
    font-size: 1.2rem;
    flex-shrink: 0; /* Prevent icon from shrinking */
}

.file-name-cell > div {
    min-width: 0; /* Critical for ellipsis in flex */
    flex: 1;
}

.file-name-cell span {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.btn-star {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    margin-right: 4px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-star:hover {
    color: #eab308;
}

.btn-star.active {
    color: #eab308;
}

/* Selection UI Refinement */
.item-checkbox {
    opacity: 0;
    transition: var(--transition);
}

tr:hover .item-checkbox,
tr.selected .item-checkbox {
    opacity: 1;
}

/* Grid View Styles */
.table-container.grid-view {
    background: transparent;
    border: none;
}

.grid-view table {
    display: block;
}

.grid-view thead {
    display: none;
}

.grid-view #files-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

.grid-view tr {
    display: flex;
    flex-direction: column;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.25rem;
    position: relative;
    transition: var(--transition);
    height: 100%;
    cursor: pointer;
    content-visibility: auto;
    contain-intrinsic-size: 180px 250px;
}

.grid-view tr:hover {
    border-color: var(--accent-color);
    background: var(--surface-hover);
}
/* Removed heavy transforms and shadows for performance */

.grid-view tr.selected {
    border-color: var(--accent-color);
    background: rgba(59, 130, 246, 0.05);
}

.grid-view td {
    display: block;
    border: none;
    padding: 0;
}

.grid-view td:nth-child(1) { /* Checkbox */
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
}

.grid-view td:nth-child(2) { /* Name & Icon */
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
}

.grid-view .file-name-cell {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    align-items: center;
}

.grid-view .file-name-cell div {
    width: 100%;
    text-align: center;
}

.grid-view .file-name-cell i {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
}

.grid-view .btn-star {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
}

.grid-view .btn-star i {
    font-size: 1.1rem !important;
}

.grid-view td:nth-child(3), 
.grid-view td:nth-child(4) { /* Date & Size */
    display: none;
}

.grid-view td:nth-child(5) { /* Actions */
@media (max-width: 768px) {
    .hide-mobile { display: none !important; }
    .show-mobile { display: block !important; }
}
    margin-top: 1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
    width: 100%;
}

.grid-view .actions-cell {
    justify-content: center;
}

tr.drag-target {
    border: 2px dashed var(--accent-color) !important;
    background: rgba(59, 130, 246, 0.1) !important;
    transform: scale(1.02);
}

.color-picker {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.color-opt {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
}

.color-opt:hover {
    transform: scale(1.1);
}

.color-opt.active {
    border-color: #fff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.tag {
    font-size: 0.7rem;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--text-secondary);
    margin-right: 4px;
}

.file-name-cell i {
    transition: color 0.3s ease;
}

/* Dashboard Styles */
.dashboard-stats {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.stat-main {
    text-align: center;
}

.stat-main h3 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-color);
}

.storage-bar-multi {
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    display: flex;
    overflow: hidden;
}

.storage-segment {
    height: 100%;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.storage-segment:hover {
    filter: brightness(1.2);
    transform: scaleY(1.3);
    z-index: 10;
}

.category-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.5rem;
}

.category-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 1.25rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.category-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.category-info h4 {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.category-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Search Filters */
.search-container {
    position: relative;
}

.search-filter-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.search-filter-btn:hover {
    color: var(--accent-color);
}

.search-filters {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--surface-color);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    width: 250px;
    display: none;
    flex-direction: column;
    gap: 1rem;
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.search-filters.active {
    display: flex;
}

/* Mobile specific filter adjustments */
@media (max-width: 768px) {
    .search-filters {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 90%;
        max-width: 320px;
        box-shadow: 0 0 0 100vmax rgba(0,0,0,0.5);
        border-radius: 20px;
    }
}

.filter-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-group select {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.5rem;
    border-radius: 8px;
    outline: none;
}
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.btn-danger:hover {
    background: var(--danger-color);
    color: white;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-icon.active {
    color: var(--accent-color);
    background: rgba(59, 130, 246, 0.1);
}

.btn-block {
    width: 100%;
}

.btn-large {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.actions-cell {
    display: flex;
    gap: 0.5rem;
    opacity: 1 !important;
}

.actions-cell .btn-icon {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.05);
}

.actions-cell .btn-icon:hover {
    background: var(--accent-color);
    color: white;
}

.actions-cell button[onclick*="openShareModal"] {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: #8b5cf6 !important; /* Purple/Violet to stand out */
}

.actions-cell button[onclick*="openShareModal"] i {
    font-size: 1.2rem !important;
}

.mt-4 {
    margin-top: 1rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
    z-index: 1000;
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    width: 95%;
    max-width: 450px;
    margin: auto;
    max-height: 95vh;
    overflow: hidden; /* Prevent the whole modal from scrolling */
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: var(--transition);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.25rem;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    transition: var(--transition);
}

.close-btn:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

.modal-body p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

.input-group input {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-family: inherit;
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* Public Share Page */
.public-share-bg {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.share-container {
    width: 100%;
    max-width: 480px;
}

.share-card {
    background: var(--surface-color);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 3rem 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.brand.center {
    justify-content: center;
    margin-bottom: 3rem;
}

.file-details {
    text-align: center;
}

.file-icon-large {
    font-size: 4rem;
    color: var(--accent-color);
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 20px rgba(59, 130, 246, 0.3));
}

.file-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    word-break: break-all;
}

.file-meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.error-state {
    text-align: center;
    color: var(--danger-color);
}

.error-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.error-state h3 {
    margin-bottom: 0.5rem;
}

.error-state p {
    color: var(--text-secondary);
}

/* Premium Toast Notification */
.toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column-reverse; /* Newest toasts appear on top */
    gap: 10px;
    pointer-events: none;
    width: 100%;
    max-width: 400px;
    padding: 0 20px;
}

.toast {
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    animation: toastSlideUp 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    position: relative;
    overflow: hidden;
    pointer-events: auto;
    word-break: break-word;
}

.toast::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--accent-color);
    width: 100%;
    animation: toastProgress 3s linear forwards;
}

.toast.success { border-left: 4px solid #10b981; }
.toast.success i { color: #10b981; }
.toast.success::after { background: #10b981; }

.toast.error { border-left: 4px solid #ef4444; }
.toast.error i { color: #ef4444; }
.toast.error::after { background: #ef4444; }

.toast.info { border-left: 4px solid #3b82f6; }
.toast.info i { color: #3b82f6; }
.toast.info::after { background: #3b82f6; }

.toast.fade-out {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    transition: all 0.4s ease;
}

@keyframes toastSlideUp {
    from { opacity: 0; transform: translateY(40px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* ============================================================
   RESPONSIVE STYLES — Mobile only. Desktop untouched.
   ============================================================ */

.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    margin-right: 0.75rem;
    padding: 0.35rem 0.5rem;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.menu-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
}

.topbar-left {
    display: flex;
    align-items: center;
}

.topbar-actions-mobile {
    display: none;
    gap: 0.5rem;
    margin-right: 1rem;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    z-index: 99;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* ---- Tablet (≤1024px) ---- */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100%;
        z-index: 100;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 24px rgba(0,0,0,0.4);
    }

    .sidebar.active {
        left: 0;
    }

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }

    .main-content {
        padding: 1.5rem;
    }
}

/* Mobile Grid View Responsive Fix */
@media (max-width: 500px) {
    .grid-view #files-list {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
        display: grid !important;
    }

    .grid-view tr {
        padding: 0.75rem !important;
        border-radius: 12px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        width: 100% !important;
        position: relative !important;
        min-height: 180px;
    }

    .grid-view .item-checkbox {
        position: absolute !important;
        top: 8px !important;
        left: 8px !important;
        opacity: 1 !important;
        z-index: 5;
    }

    .grid-view .btn-star {
        position: absolute !important;
        top: 5px !important;
        right: 5px !important;
        z-index: 5;
        font-size: 0.9rem !important;
    }

    .grid-view .file-thumb-container {
        width: 100% !important;
        height: 70px !important;
        margin-top: 1.5rem !important;
        margin-bottom: 0.5rem !important;
    }

    .grid-view .file-thumb-container i {
        font-size: 2rem !important;
    }

    .grid-view .file-name-cell {
        width: 100% !important;
        padding: 0 !important;
    }

    .grid-view .file-name-cell span {
        font-size: 0.8rem !important;
        line-height: 1.2;
        max-height: 2.4em;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        text-align: center;
        white-space: normal !important;
    }

    .grid-view td:nth-child(5) {
        margin-top: auto !important;
        padding-top: 0.5rem !important;
        border-top: 1px solid rgba(255,255,255,0.05) !important;
    }
}

/* ---- Mobile (≤768px) ---- */
@media (max-width: 768px) {
    .menu-toggle {
        display: block !important;
    }

    .topbar-right {
        flex-shrink: 0;
        width: auto;
        order: 2;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .topbar-actions-mobile {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        margin-right: 0.75rem;
    }
    
    .topbar-actions-mobile .btn-icon {
        font-size: 1rem;
        color: var(--text-secondary);
        width: 40px;
        height: 40px;
        background: rgba(255, 255, 255, 0.05);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        border: 1px solid var(--border-color);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s ease;
    }

    .topbar-actions-mobile .btn-icon:hover, 
    .topbar-actions-mobile .btn-icon:active {
        background: rgba(59, 130, 246, 0.15);
        border-color: var(--accent-color);
        color: var(--accent-color);
        transform: scale(1.05);
    }

    .user-profile {
        gap: 0.5rem !important;
    }

    .user-profile span#user-greeting {
        display: none !important;
    }

    .topbar {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        margin-bottom: 1.5rem;
        padding: 0.5rem 0;
    }

    .topbar-left {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.75rem;
    }

    .topbar-right {
        flex-shrink: 0;
        display: flex;
        align-items: center;
    }

    .page-title {
        font-size: 1.15rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .user-profile span {
        display: none;
    }

    /* Search bar full width below title row */
    .search-container {
        width: 100%;
        max-width: 100%;
        margin: 0.5rem 0 0 0 !important;
        flex: 0 0 100%;
        height: 44px;
        order: 10; /* Put it at the bottom of topbar-left */
    }

    /* Action bar stacked */
    .action-bar {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
        padding: 1rem;
    }

    .breadcrumbs-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .action-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.6rem;
        width: 100%;
    }

    .action-buttons .btn {
        width: 100%;
        justify-content: center;
        font-size: 0.8rem;
        padding: 0.55rem 0.75rem;
    }

    .view-toggle {
        grid-column: span 2;
        display: flex;
        justify-content: center;
        background: rgba(255,255,255,0.05);
        padding: 4px;
        border-radius: 10px;
    }

    /* Drop zone compact */
    .drop-zone {
        padding: 1.5rem 1rem;
        gap: 0.35rem;
    }

    .upload-icon {
        font-size: 2.5rem;
    }

    .drop-zone h3 {
        font-size: 1rem;
    }

    /* File table → card list */
    .table-container {
        background: transparent;
        border: none;
        border-radius: 0;
    }

    .files-table thead {
        display: none;
    }

    .files-table,
    .files-table tbody,
    .files-table tr,
    .files-table td {
        display: block;
        width: 100%;
    }

    .files-table tr {
        margin-bottom: 0.85rem;
        background: var(--surface-color);
        border-radius: 14px;
        padding: 1rem 1rem 0.85rem;
        position: relative;
        border: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    }

    .files-table tr:hover {
        border-color: rgba(59,130,246,0.4);
        background: var(--surface-hover);
    }

    .files-table td {
        padding: 0.3rem 0;
        border: none;
    }

    /* Checkbox — absolute top-left */
    .files-table td:nth-child(1) {
        position: absolute;
        top: 14px;
        left: 14px;
        width: auto;
    }

    /* File name — indent past checkbox */
    .files-table td:nth-child(2) {
        padding-left: 2.25rem;
        padding-right: 2.5rem; /* space for star button */
    }

    .file-name-cell {
        gap: 0.6rem;
    }

    /* Meta row: date + size inline */
    .files-table td:nth-child(3),
    .files-table td:nth-child(4) {
        display: inline-block;
        width: auto;
        font-size: 0.75rem;
        color: var(--text-secondary);
        padding-left: 2.25rem;
        margin-right: 1rem;
    }

    .files-table td:nth-child(3)::before { content: '\f017  '; font-family: 'Font Awesome 6 Free'; font-weight: 900; opacity: 0.5; margin-right: 3px; }
    .files-table td:nth-child(4)::before { content: '\f0c7  '; font-family: 'Font Awesome 6 Free'; font-weight: 900; opacity: 0.5; margin-right: 3px; }

    /* Actions bar at bottom of card */
    .files-table td:nth-child(5) {
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px solid rgba(255,255,255,0.06);
        display: flex;
        justify-content: flex-end;
        gap: 0.35rem;
    }

    /* Star button repositioned */
    .btn-star {
        position: absolute;
        top: 12px;
        right: 12px;
    }

    /* Details panel full screen */
    .details-panel {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        width: 100%;
        z-index: 1000;
        background: var(--bg-color);
    }

    /* Modal */
    .modal-content {
        width: 96%;
        margin: 0 auto;
        border-radius: 20px;
        max-height: 92vh;
    }

    /* Bulk actions dock — vertical stack on small */
    .bulk-actions-bar {
        flex-direction: column;
        gap: 0.85rem;
        border-radius: 20px;
        padding: 1rem 1.25rem;
        bottom: 1.25rem;
        width: 88vw;
        min-width: 0;
        transform: translateX(-50%) translateY(150%);
        opacity: 0;
    }
    
    .bulk-actions-bar.active {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }

    .selection-info {
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.2);
        padding-right: 0;
        padding-bottom: 0.75rem;
        width: 100%;
        text-align: center;
    }

    .bulk-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        width: 100%;
    }

    .bulk-buttons .btn {
        width: 100%;
        font-size: 0.8rem;
    }

    /* Grid view adjustments */
    .grid-view #files-list {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 1rem;
    }
}

/* --- Search & Interaction UI --- */
.search-container {
    flex: 1;
    max-width: 450px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.45rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: 2rem;
    transition: all 0.3s ease;
}

.search-container:focus-within {
    border-color: var(--accent-color);
    background: rgba(15, 23, 42, 0.6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-container i {
    color: var(--accent-color);
    font-size: 0.9rem;
    opacity: 0.7;
}

.search-container input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 100%;
    outline: none;
    font-size: 0.9rem;
}

.modal-large {
    max-width: 800px;
}

.preview-body {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 300px;
    background: #000;
    border-radius: 8px;
    padding: 0;
    overflow: auto;
}

.loading {
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.loading::after {
    content: '';
    width: 30px;
    height: 30px;
    border: 3px solid var(--surface-hover);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.preview-body img, .preview-body video {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

/* Mobile-only Premium Styles */
@media (max-width: 768px) {
    /* Bottom Sheet Modals */
    .modal {
        align-items: flex-end;
    }

    .modal-content {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 24px 24px 0 0;
        transform: translateY(100%);
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        padding-bottom: 30px;
    }

    .modal.active .modal-content {
        transform: translateY(0);
    }

    .modal-header::before {
        content: '';
        width: 40px;
        height: 4px;
        background: var(--border-color);
        border-radius: 2px;
        position: absolute;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
    }

    /* Show Bottom Nav & FAB */
    .bottom-nav {
        display: flex;
    }

    .mobile-fab {
        display: block;
    }

    /* Hide redundant desktop buttons */
    .action-buttons .btn-primary, 
    #new-folder-btn-desktop,
    #folder-upload-label {
        display: none;
    }

    /* Adjust main content padding for bottom nav */
    .main-content {
        padding: 1rem !important;
        padding-bottom: 120px !important;
    }

    .topbar {
        padding: 0.5rem 0;
        margin-bottom: 1rem;
    }

    .search-container {
        margin: 0.5rem 0 !important;
        height: 48px;
    }

    /* Share Modal Specifics */
    .form-row {
        flex-direction: column;
        gap: 0;
    }


    .share-link-group {
        flex-direction: column;
        gap: 0.75rem;
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
    }

    .share-link-group input {
        width: 100% !important;
        border-radius: 12px !important;
        padding: 0.85rem !important;
        background: rgba(0, 0, 0, 0.2) !important;
        border: 1px solid var(--border-color) !important;
    }

    .share-link-group .btn {
        width: 100% !important;
        margin: 0 !important;
        border-radius: 12px !important;
        height: 48px;
    }

    /* Better spacing for file cards */
    .files-table tr {
        margin-bottom: 0.85rem;
        border: 1px solid rgba(255, 255, 255, 0.08);
    }
}

.mobile-close-sidebar {
    display: none;
}

.modal-footer {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid var(--border-color);
    background: var(--bg-color);
}

.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.sortable:hover {
    color: var(--text-primary);
}

.sortable::after {
    content: '\f0dc';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-left: 0.5rem;
    font-size: 0.7rem;
    opacity: 0.3;
}

.sortable.asc::after {
    content: '\f0de';
    opacity: 1;
    color: var(--accent-color);
}

.sortable.desc::after {
    content: '\f0dd';
    opacity: 1;
    color: var(--accent-color);
}

/* (merged into the ≤768px block above) */
/* ---- Small phones (≤480px) ---- */
@media (max-width: 480px) {
    .main-content {
        padding: 1rem 0.85rem;
    }

    .topbar {
        gap: 0.6rem;
        margin-bottom: 1rem;
    }

    .page-title {
        font-size: 1rem;
    }

    .sidebar {
        width: 260px;
        left: -260px;
    }

    .brand h2 {
        font-size: 1.1rem;
    }

    /* Search Bar Mobile */
    .search-container {
        width: 100%;
        max-width: 100%;
        margin: 0.75rem 0 0 0 !important;
        flex: 0 0 100%;
        height: 46px;
        order: 10;
    }

    /* Action bar */
    .action-bar {
        padding: 0.85rem;
        gap: 0.85rem;
    }

    .action-buttons {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    /* File cards */
    .files-table tr {
        border-radius: 12px;
        padding: 0.85rem 0.85rem 0.75rem;
    }

    /* Actions in card smaller */
    .actions-cell .btn-icon {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    /* Bulk dock */
    .bulk-actions-bar {
        width: 94vw;
        padding: 0.85rem;
        bottom: 1.5rem;
        flex-direction: column;
        border-radius: 20px;
        transform: translateX(-50%) translateY(200%); /* Force Hidden on mobile */
        opacity: 0;
        visibility: hidden;
    }

    .bulk-actions-bar.active {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
        visibility: visible;
    }

    /* Modal */
    .modal-content {
        width: 97vw;
        border-radius: 16px;
        max-height: 92vh;
    }

    .modal-header {
        padding: 1rem 1.1rem;
    }

    .modal-body {
        padding: 1rem 1.1rem;
    }

    .modal-footer {
        padding: 1rem 1.1rem;
    }

    /* Preview modal */
    .modal-large {
        max-width: 100vw !important;
        width: 100vw !important;
        border-radius: 0 !important;
        height: 100vh;
        max-height: 100vh;
    }

    .preview-body {
        min-height: 200px;
    }

    .preview-body iframe {
        height: 55vh;
    }

    /* Drop zone mobile */
    .drop-zone {
        padding: 1.5rem 1rem;
        gap: 0.35rem;
    }

    /* Grid view — 2 columns on phone */
    .grid-view #files-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    /* Help modal */
    .help-section {
        margin-bottom: 1.25rem;
    }

    /* Form rows stack on tiny screens */
    .form-row {
        flex-direction: column;
        gap: 0.75rem;
    }

    /* Share advanced opts */
    .share-advanced-opts {
        padding: 1rem;
    }
}
/* Advanced Share Modal Styles */
.share-advanced-opts {
    display: none;
    margin-top: 1rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.share-advanced-opts.active {
    display: block;
}

.upload-card {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 320px;
    background: #1e293b;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.4);
    z-index: 9000;
    overflow: hidden;
    display: none !important;
}

.upload-card.active {
    display: block !important;
    animation: slideInUp 0.3s ease-out forwards;
}

@keyframes slideInUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.upload-card-header {
    padding: 1rem 1.25rem;
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.upload-card-header span {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.upload-card-body {
    padding: 1.25rem;
}

.upload-info {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.25rem;
}

.upload-info i {
    font-size: 1.5rem;
    color: var(--accent-color);
    background: rgba(59, 130, 246, 0.1);
    padding: 12px;
    border-radius: 12px;
}

.upload-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.upload-filename {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.upload-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.upload-progress-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.upload-progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-color), #60a5fa);
    border-radius: 10px;
    transition: width 0.3s ease;
}

.upload-percent {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-color);
    min-width: 35px;
}

@media (max-width: 768px) {
    .upload-card {
        right: 1rem;
        left: 1rem;
        width: calc(100% - 2rem);
        bottom: 6rem;
    }
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-group label {
    font-size: 0.9rem;
    color: var(--text-primary);
    cursor: pointer;
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

.input-group input {
    flex: 1;
}

.badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--accent-color);
    color: white;
}

.modal-large {
    max-width: 90vw !important;
    width: 1000px !important;
}

.preview-body {
    background: #000;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

.preview-body img {
    max-width: 100%;
    max-height: 80vh;
}

.preview-body iframe.pdf-viewer {
    width: 100%;
    height: 80vh;
    border: none;
    background: #525659; /* Standard PDF viewer background */
    border-radius: 8px;
}

@media (max-width: 768px) {
    .preview-body iframe.pdf-viewer {
        height: 85vh;
        border-radius: 0;
    }
    .preview-body {
        padding: 0 !important;
    }
}

.preview-body pre {
    width: 100%;
    margin: 0;
    padding: 2rem;
    font-size: 14px;
}

.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-4 { margin-top: 1.5rem; }
.mr-2 { margin-right: 0.5rem; }
.btn-block { width: 100%; }

.center { text-align: center; }

/* QR Code Section */
.qr-preview img {
    max-width: 150px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

/* Form Input Enhancements */
.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: rgba(15, 23, 42, 0.8);
}

/* Mobile Touch Targets */
@media (max-width: 768px) {
    .btn, .nav-item, .category-item, .action-buttons .btn {
        min-height: 44px; /* Standard touch target size */
    }
    
    .item-checkbox {
        width: 20px;
        height: 20px;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

.activity-list {
    list-style: none;
    padding: 0;
}
.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
}
.activity-icon.upload { color: #3b82f6; }
.activity-icon.trash { color: #f59e0b; }
.activity-icon.delete { color: #ef4444; }
.activity-icon.share { color: #8b5cf6; }
.activity-info { flex: 1; }
.activity-action { font-weight: 500; display: block; margin-bottom: 2px; }
.activity-details { font-size: 0.85rem; color: var(--text-secondary); }
.activity-time { font-size: 0.75rem; color: var(--text-secondary); opacity: 0.6; }

/* Toast Notifications */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 10000; }
.toast { background: var(--surface-color); border: 1px solid var(--border-color); color: var(--text-primary); padding: 12px 20px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); margin-bottom: 10px; display: flex; align-items: center; gap: 12px; min-width: 250px; transform: translateX(120%); transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55); backdrop-filter: blur(10px); }
.toast.active { transform: translateX(0); }
.toast i { font-size: 1.25rem; }
.toast-success i { color: #10b981; }
.toast-error i { color: var(--danger-color); }
.toast-info i { color: var(--accent-color); }
@media (max-width: 480px) { .toast-container { top: 10px; right: 10px; left: 10px; } .toast { min-width: 0; width: 100%; } }
/* Shared Gallery Styles */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.gallery-item {
    background: var(--surface-color);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    position: relative;
    backdrop-filter: blur(8px);
}

.gallery-item:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--accent-color);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
}

.gallery-thumb {
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.3);
    overflow: hidden;
    position: relative;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-item:hover .gallery-thumb img {
    transform: scale(1.1);
}

.gallery-thumb i {
    font-size: 3.5rem;
    color: var(--accent-color);
    opacity: 0.5;
}

.gallery-info {
    padding: 1.25rem;
    position: relative;
}

.gallery-name {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.gallery-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.bulk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.bulk-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
}

.public-share-bg {
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.share-card {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    width: 100%;
}

.file-icon-large {
    font-size: 5rem;
    color: var(--accent-color);
    margin-bottom: 1.5rem;
    text-shadow: 0 0 30px rgba(59, 130, 246, 0.3);
}

.badge {
    background: var(--accent-color);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.help-section {
    margin-bottom: 2rem;
}

.help-section h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--accent-color);
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.help-section p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.help-section ul {
    padding-left: 1.5rem;
    color: var(--text-secondary);
}

.help-section li {
    margin-bottom: 0.5rem;
}

.pro-tip {
    background: rgba(59, 130, 246, 0.1);
    border-left: 4px solid var(--accent-color);
    padding: 1rem;
    border-radius: 0 12px 12px 0;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin: 1rem 0;
}

/* Thumbnail Styles */
.file-thumb-container {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    max-width: 32px !important;
    max-height: 32px !important;
    position: relative !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255,255,255,0.08);
    flex-shrink: 0 !important;
}

.file-thumb-container i {
    font-size: 1.25rem !important;
}

.grid-view .file-thumb-container {
    width: 140px !important;
    height: 140px !important;
    min-width: 140px !important;
    min-height: 140px !important;
    margin: 0 auto 1rem auto !important;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(255,255,255,0.05);
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.grid-view .file-thumb-container i {
    font-size: 4.5rem !important;
}

.lazy-thumb {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    display: block !important;
    opacity: 0;
    transition: opacity 0.3s ease;
    will-change: transform, opacity;
    transform: translateZ(0);
}

/* Performance Mode during Scroll */
body.is-scrolling * {
    pointer-events: none !important;
}

.table-container {
    contain: layout;
}

#files-list {
    contain: layout;
}

/* Pagination Styles */
.pagination-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.25rem 1rem;
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.page-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Global Performance - Remove expensive effects */
.sidebar, .card, .modal-content, .details-panel {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.thumb-placeholder {
    font-size: 1.1rem;
    color: var(--accent-color);
    opacity: 0.7;
}

.grid-view .thumb-placeholder {
    font-size: 3rem;
}

.help-footer a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
}

/* --- Mobile Navigation --- */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid var(--border-color);
    z-index: 1000;
    padding: 0 0.25rem;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.3);
}

.nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 500;
    gap: 4px;
    flex: 1;
    min-width: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
}

.nav-link i {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.nav-link.active {
    color: var(--accent-color);
}

.nav-link.active i {
    transform: translateY(-2px);
    filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.5));
}

.nav-placeholder {
    width: 50px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
    }
}

/* --- Mobile FAB (Floating Action Button) --- */
.mobile-fab {
    display: none;
    position: fixed;
    bottom: 12px; /* Positioned to align with bottom nav icons */
    left: 50%;
    transform: translateX(-50%);
    z-index: 1100;
}

@media (max-width: 768px) {
    .mobile-fab {
        display: block;
    }
}

.fab-btn {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    border: 4px solid #0f172a; /* Match the background to look like it's cut out */
    font-size: 1.6rem;
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fab-btn.active {
    transform: rotate(45deg);
    background: #475569;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.fab-options {
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.fab-options.active {
    opacity: 1;
    pointer-events: all;
    transform: translateX(-50%) translateY(0);
}

.fab-opt {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.fab-opt i {
    color: var(--accent-color);
    font-size: 1.1rem;
}
