:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #059669;
    --danger-color: #dc2626;
    --warning-color: #d97706;
    --info-color: #0891b2;
    --dark-color: #1e293b;
    --light-color: #f8fafc;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
}

/* Base styling */
:root {
    --primary-color: #007bff;
    --text-primary: #212529;
    --text-secondary: #6c757d;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-primary);
    background-color: #f8f9fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Global Styles */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--light-color);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Navbar styling */
.navbar {
    background-color: #212529;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar-brand span {
    font-weight: 600;
}

/* Professional Navigation */
.navbar {
    background: linear-gradient(135deg, var(--dark-color) 0%, #334155 100%);
    box-shadow: var(--shadow-lg);
    border-bottom: 3px solid var(--primary-color);
    padding: 1rem 0;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: white !important;
    transition: transform 0.2s ease;
}

.navbar-brand:hover {
    transform: translateY(-1px);
}

.nav-link {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9) !important;
    transition: all 0.2s ease;
    border-radius: var(--radius-sm);
    margin: 0 0.25rem;
    padding: 0.5rem 1rem !important;
}

.nav-link:hover {
    color: white !important;
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.nav-link.active {
    background-color: var(--primary-color);
    color: white !important;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 3px;
}

/* User Badge */
.user-badge {
    background: linear-gradient(45deg, var(--primary-color), #3b82f6);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 500;
    margin-left: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.user-badge.preview-user {
    background: linear-gradient(45deg, var(--info-color), #06b6d4);
}

/* Card styling */
.card {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 15px 20px;
}

/* Modern Cards */
.card {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    background: white;
    overflow: hidden;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-bottom: 2px solid var(--border-color);
    padding: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 1.5rem;
}

/* Table styling */
.table {
    margin-bottom: 0;
}

.table td, .table th {
    vertical-align: middle;
}

.directory-row {
    cursor: pointer;
    background-color: rgba(0, 123, 255, 0.03);
}

.directory-row:hover {
    background-color: rgba(0, 123, 255, 0.08);
}

.parent-directory {
    background-color: rgba(0, 123, 255, 0.08);
}

.file-row:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.file-icon {
    margin-right: 10px;
    font-size: 1.2rem;
}

/* Professional Breadcrumb */
.breadcrumb {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.breadcrumb-item a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.breadcrumb-item a:hover {
    color: var(--dark-color);
}

/* Enhanced File Table */
.table {
    margin-bottom: 0;
}

.table thead th {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: var(--text-primary);
    font-weight: 600;
    border: none;
    padding: 1rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background-color: rgba(37, 99, 235, 0.05);
    transform: scale(1.01);
}

.file-row, .directory-row {
    cursor: pointer;
}

.directory-row {
    background-color: rgba(59, 130, 246, 0.05);
}

.directory-row:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

/* Breadcrumb styling */
.breadcrumb {
    background-color: #fff;
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 15px;
}

/* File Icons */
.file-icon {
    font-size: 1.25rem;
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
}

.bi-folder-fill {
    color: #fbbf24;
}

.bi-file-earmark-image {
    color: #10b981;
}

.bi-file-earmark-play {
    color: #ef4444;
}

.bi-file-earmark-music {
    color: #8b5cf6;
}

.bi-file-earmark-pdf {
    color: #dc2626;
}

.bi-file-earmark-code {
    color: #059669;
}

.bi-file-earmark-zip {
    color: #f59e0b;
}

/* File Thumbnails */
.file-thumbnail {
    width: 40px;
    height: 40px;
    margin-right: 0.75rem;
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease;
}

.file-thumbnail:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.file-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}

.video-thumbnail {
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #1e293b, #374151);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.video-thumbnail:hover {
    background: linear-gradient(45deg, #374151, #4b5563);
}

/* Modern Buttons */
.btn {
    border-radius: var(--radius-md);
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
    border: none;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #3b82f6 100%);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #10b981 100%);
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
}

.btn-outline-success {
    border: 2px solid var(--success-color);
    color: var(--success-color);
    background: transparent;
}

.btn-outline-success:hover {
    background: var(--success-color);
    color: white;
}

.btn-outline-info {
    border: 2px solid var(--info-color);
    color: var(--info-color);
    background: transparent;
}

.btn-outline-info:hover {
    background: var(--info-color);
    color: white;
}

.btn-outline-danger {
    border: 2px solid var(--danger-color);
    color: var(--danger-color);
    background: transparent;
}

.btn-outline-danger:hover {
    background: var(--danger-color);
    color: white;
}

/* File Actions */
.file-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.file-actions .btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* Professional Modals */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-bottom: 2px solid var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 1.5rem;
}

.modal-title {
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    background: #f8fafc;
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

/* Media Preview Modal */
#mediaPreviewModal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    backdrop-filter: blur(3px);
    overflow: auto;
}

#mediaPreviewModal .modal-content {
    max-width: 90%;
    max-height: 90%;
    background-color: transparent;
    border: none;
    margin: 0 auto;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Fixed close button styling */
#mediaPreviewModal .close {
    position: absolute;
    top: 15px;
    right: 15px;
    color: #f1f1f1;
    font-size: 35px;
    font-weight: bold;
    z-index: 10000;
    cursor: pointer;
    background: rgba(0,0,0,0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    padding: 0;
    line-height: 0;
}

#mediaPreviewModal .close:hover {
    color: #fff;
    background-color: rgba(255,0,0,0.7);
}

/* Lazy loading image styles */
img.lazy-image {
    opacity: 0;
    transition: opacity 0.3s;
}

img.lazy-image[src] {
    opacity: 1;
}

/* Add loading placeholder for lazy images */
.file-thumbnail {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    overflow: hidden;
    margin-right: 10px;
    border: 1px solid rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
    position: relative;
}

.file-thumbnail::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-radius: 50%;
    border-top-color: #007bff;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.file-thumbnail img {
    position: relative;
    z-index: 1;
}

/* Optimize performance for large folders */
.folder-large-warning {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 10px 15px;
    border-radius: 4px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Alerts and Notifications */
.alert {
    border: none;
    border-radius: var(--radius-md);
    padding: 1rem 1.5rem;
    border-left: 4px solid;
    box-shadow: var(--shadow-sm);
}

.alert-success {
    background-color: #f0fdf4;
    color: #166534;
    border-left-color: var(--success-color);
}

.alert-danger {
    background-color: #fef2f2;
    color: #991b1b;
    border-left-color: var(--danger-color);
}

.alert-warning {
    background-color: #fffbeb;
    color: #92400e;
    border-left-color: var(--warning-color);
}

.alert-info {
    background-color: #f0f9ff;
    color: #075985;
    border-left-color: var(--info-color);
}

/* Toast Notifications */
.toast {
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    background: var(--dark-color);
    color: white;
}

/* Footer */
.footer {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-top: 2px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 500;
}

/* Loading States */
.spinner-border {
    color: var(--primary-color);
}

/* Loading Indicator */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    z-index: 5;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .file-actions {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .file-actions .btn {
        width: 100%;
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .breadcrumb {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}

/* Login Page Specific Styles */
.login-container {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e40af 50%, var(--dark-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    margin: 1rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    color: var(--dark-color);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-secondary);
    margin: 0;
}

.form-floating label {
    color: var(--text-secondary);
}

.form-control {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* User Type Selector */
.user-type-selector {
    background: #f8fafc;
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1.5rem;
    border: 2px solid var(--border-color);
}

.user-type-option {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.user-type-option:hover {
    background-color: rgba(13, 110, 253, 0.04);
}

.user-type-option.selected {
    border-color: #0d6efd;
    background-color: rgba(13, 110, 253, 0.08);
}

.user-type-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.user-type-label {
    flex: 1;
    padding-left: 10px;
}

.user-type-title {
    font-weight: 600;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
}

.user-type-desc {
    font-size: 12px;
    color: #6c757d;
}

/* Add checkmark indicator for selected option */
.user-type-option.selected::before {
    content: '';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: #0d6efd;
    border-radius: 50%;
}

.user-type-option.selected::after {
    content: '';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-60%) rotate(45deg);
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
}

/* Ensure login form looks good */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #f8f9fa;
    padding: 15px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    padding: 30px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-weight: 700;
    color: #212529;
    margin-bottom: 5px;
}

.login-header p {
    color: #6c757d;
}

/* Performance Optimizations */
* {
    box-sizing: border-box;
}

img {
    max-width: 100%;
    height: auto;
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

button:focus, .btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Add this to your existing CSS file */

.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    z-index: 5;
}

.video-container {
    position: relative;
    max-width: 90%;
    margin: 0 auto;
}

.video-container video {
    width: 100%;
    max-height: 80vh;
}

#mediaPreviewModal .modal-content {
    max-width: 90%;
    max-height: 90%;
    background-color: transparent;
    border: none;
    margin: 0 auto;
}

#mediaPreviewModal .modal-header {
    color: white;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 6px 6px 0 0;
    padding: 10px 15px;
}

#mediaPreviewModal .modal-header h5 {
    margin: 0;
    font-size: 1.2rem;
    word-break: break-word;
}

#mediaPreviewModal .modal-header small {
    color: #ccc;
    display: block;
    margin-top: 5px;
}

#mediaPreviewModal .close {
    color: white;
    font-size: 28px;
    position: absolute;
    top: 10px;
    right: 15px;
    z-index: 1050;
    opacity: 0.8;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

#mediaPreviewModal .close:hover {
    opacity: 1;
}

/* Clipboard alerts */
.clipboard-alert {
    z-index: 1070;
}

/* Grid view */
.table-responsive.grid-view table {
    display: block;
}

.table-responsive.grid-view thead {
    display: none;
}

.table-responsive.grid-view tbody {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.table-responsive.grid-view tr {
    display: block;
    width: 150px;
    height: 150px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    background-color: #fff;
    padding: 10px;
    position: relative;
    text-align: center;
    overflow: hidden;
}

.table-responsive.grid-view td {
    display: block;
    border: none;
    padding: 5px;
}

.table-responsive.grid-view td:nth-child(1) {
    height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.table-responsive.grid-view .file-icon {
    font-size: 2.5rem;
    margin: 0 0 10px 0;
}

.table-responsive.grid-view td span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
    text-align: center;
    display: block;
}

.table-responsive.grid-view td:nth-child(2),
.table-responsive.grid-view td:nth-child(3) {
    display: none;
}

.table-responsive.grid-view td:last-child {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(255,255,255,0.9);
    padding: 5px;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.table-responsive.grid-view tr:hover td:last-child {
    visibility: visible;
    opacity: 1;
}

.table-responsive.grid-view .file-thumbnail {
    width: 100%;
    height: 60px;
    margin: 0 0 10px 0;
}

/* File actions button styling */
.d-flex.gap-1 {
    flex-wrap: wrap;
}

.btn-group-sm>.btn, .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.2rem;
}

/* Ensure all buttons in the file actions row have consistent size */
.file-actions .btn {
    margin-bottom: 0.25rem;
    white-space: nowrap;
}

/* Navigation and tab styling */
.nav-link {
  position: relative;
  transition: all 0.2s ease;
}

.nav-link.active {
  font-weight: 500;
}

/* Better section transitions */
#file-browser-section, 
#shared-links-section {
  transition: opacity 0.2s ease-in-out;
}

/* Improvements for shared links table */
#shared-links-section .table {
  margin-bottom: 0;
}

.link-actions {
  white-space: nowrap;
}

/* Improve buttons in table */
.btn-group-sm {
  box-shadow: none !important;
}

.btn-group-sm .btn {
  border-radius: 4px;
  margin: 0 2px;
}

/* Add some subtle animation for better UX */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fade-in {
  animation: fadeIn 0.3s ease-in forwards;
}

/* Enhance back button styling */
#back-to-files-btn {
  border-color: var(--border-color);
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

#back-to-files-btn:hover {
  background-color: var(--border-color);
  color: var(--text-primary);
}
