/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.header-left p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.header-right {
    display: flex;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1rem;
}

.logout-btn {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

/* Fallback for older header styles */
header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Breadcrumb */
.breadcrumb {
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-size: 0.95rem;
}

.breadcrumb-link {
    color: #667eea;
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb-link:hover {
    color: #764ba2;
    text-decoration: underline;
}

.breadcrumb-separator {
    margin: 0 0.5rem;
    color: #6c757d;
}

.breadcrumb-current {
    color: #333;
    font-weight: 500;
}

/* File Browser */
.file-browser {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.browser-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.view-options, .filter-options {
    display: flex;
    gap: 0.5rem;
}

.view-btn, .filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.view-btn:hover, .filter-btn:hover {
    background: #e9ecef;
}

.view-btn.active, .filter-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* File List */
.file-list {
    min-height: 400px;
}

.file-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    font-size: 0.875rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.file-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f1f3f4;
    transition: background-color 0.2s;
    align-items: center;
}

.file-item:hover {
    background-color: #f8f9fa;
}

.file-item:last-child {
    border-bottom: none;
}

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

.file-icon {
    width: 1.25rem;
    color: #6c757d;
}

.file-icon.fa-folder {
    color: #ffc107;
}

.file-icon.fa-video {
    color: #dc3545;
}

.file-icon.fa-music {
    color: #28a745;
}

.file-icon.fa-image {
    color: #17a2b8;
}

.file-icon.fa-file-pdf {
    color: #dc3545;
}

.file-icon.fa-file-text {
    color: #6f42c1;
}

.file-link {
    color: #333;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.file-link:hover {
    color: #667eea;
}

/* Type Badges */
.type-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.type-folder {
    background: #fff3cd;
    color: #856404;
}

.type-video {
    background: #f8d7da;
    color: #721c24;
}

.type-audio {
    background: #d4edda;
    color: #155724;
}

.type-image {
    background: #cce5ff;
    color: #0c5460;
}

.type-pdf {
    background: #f8d7da;
    color: #721c24;
}

.type-text {
    background: #e2e3f1;
    color: #383d41;
}

.type-file {
    background: #e9ecef;
    color: #495057;
}

/* Empty Folder */
.empty-folder {
    text-align: center;
    padding: 4rem 2rem;
    color: #6c757d;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Stats Panel */
.stats-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.stats-item {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stats-item i {
    font-size: 1.5rem;
    color: #667eea;
}

.stats-item span {
    font-size: 0.9rem;
    color: #6c757d;
}

.stats-item strong {
    color: #333;
    font-size: 1.1rem;
}

/* Footer */
footer {
    background: #343a40;
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 4rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .browser-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .file-header,
    .file-item {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .file-type,
    .file-size,
    .file-modified {
        display: none;
    }
    
    .stats-panel {
        grid-template-columns: 1fr;
    }
}

/* Grid View */
.file-list.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1.5rem;
}

.file-list.grid-view .file-header {
    display: none;
}

.file-list.grid-view .file-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.5rem;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    background: white;
}

.file-list.grid-view .file-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.file-list.grid-view .file-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.file-list.grid-view .file-name {
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.file-list.grid-view .file-link {
    font-size: 0.875rem;
    word-break: break-word;
}

/* Hidden items for filtering */
.file-item.hidden {
    display: none !important;
}

/* Media Player Styles */
.media-play-icon {
    margin-left: 0.5rem;
    color: #28a745;
    transition: color 0.2s;
}

.media-file:hover .media-play-icon {
    color: #20c997;
}

.media-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.media-modal-content {
    position: relative;
    background: white;
    margin: 2% auto;
    padding: 0;
    border-radius: 0.75rem;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.media-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.media-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.media-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s;
}

.media-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.media-modal-body {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

#mediaContainer {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
    border-radius: 0.5rem;
    overflow: hidden;
    position: relative;
}

#mediaContainer video,
#mediaContainer audio {
    width: 100%;
    max-width: 100%;
    border-radius: 0.5rem;
}

#mediaContainer video {
    height: auto;
    max-height: 60vh;
}

#mediaContainer audio {
    width: 100%;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.media-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #6c757d;
}

.media-loading i {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.media-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.375rem;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #545b62;
    transform: translateY(-1px);
}

/* Responsive Media Player */
@media (max-width: 768px) {
    .media-modal-content {
        width: 95%;
        margin: 5% auto;
    }
    
    .media-modal-header,
    .media-modal-body {
        padding: 1rem;
    }
    
    #mediaContainer video {
        max-height: 40vh;
    }
}