/* Base Styles */
:root {
    --background: #ffffff;
    --foreground: #0f172a;
    --muted: #f1f5f9;
    --muted-foreground: #64748b;
    --border: #e2e8f0;
    --primary: #5865f2;
    --primary-foreground: #ffffff;
}

.dark {
    --background: #0f172a;
    --foreground: #ffffff;
    --muted: #1e293b;
    --muted-foreground: #94a3b8;
    --border: #1e293b;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    background-color: var(--background);
    color: var(--foreground);
}

/* Header Styles */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 50;
    width: 100%;
    border-bottom: 1px solid var(--border);
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
}

.logo {
    font-weight: bold;
    font-size: 1.25rem;
}

.search-container {
    position: relative;
    flex: 1;
    max-width: 36rem;
    margin: 0 2rem;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

.search-input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    border-radius: 0.375rem;
    border: 1px solid var(--border);
    background-color: var(--muted);
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.icon-button {
    padding: 0.5rem;
    border: none;
    background: none;
    border-radius: 0.375rem;
    cursor: pointer;
    color: var(--foreground);
    text-decoration: none;
    color: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-button:hover {
    background: var(--muted);
}

.icon-button i {
    font-size: 1.2rem;
}

.profile-button {
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    border: 2px solid var(--border);
    overflow: hidden;
    padding: 0;
    cursor: pointer;
}

.profile-button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Main Container */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    display: grid;
    grid-template-columns: 240px 1fr 300px;
    gap: 2.5rem;
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: 5rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    border: none;
    background: none;
    color: var(--foreground);
    cursor: pointer;
    transition: background-color 0.2s;
}

.nav-item:hover {
    background-color: var(--muted);
}

.nav-item.active {
    background-color: var(--primary);
    color: var(--primary-foreground);
}

/* Content Area */
.content {
    padding: 2rem;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.left-section {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.left-section h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.primary-button {
    background-color: var(--primary);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

.primary-button:hover {
    opacity: 0.9;
}

.secondary-button {
    background-color: var(--muted);
    color: var(--foreground);
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.icon-only-button {
    padding: 0.5rem;
    border: none;
    background: none;
    color: var(--muted-foreground);
    cursor: pointer;
    border-radius: 0.375rem;
}

.sort-dropdown {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: var(--muted);
    border-radius: 0.375rem;
    cursor: pointer;
}

/* Recommended Section */
.recommended-section {
    margin-bottom: 2rem;
}

.recommended-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.recommended-card {
    background-color: var(--muted);
    border-radius: 0.5rem;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.file-preview {
    width: 48px;
    height: 48px;
    background-color: var(--background);
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary);
}

/* Folders Section */
.folders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.folder-card {
    background-color: var(--muted);
    border-radius: 0.5rem;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.folder-icon {
    color: var(--primary);
    font-size: 1.5rem;
}

.folder-info {
    flex: 1;
}

.folder-name {
    display: block;
    font-weight: 500;
}

.folder-meta {
    display: block;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

/* Files Table */
.files-table {
    margin-top: 1rem;
    background-color: var(--muted);
    border-radius: 0.5rem;
    overflow: hidden;
}

.table-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    padding: 0.75rem 1rem;
    background-color: var(--background);
    font-weight: 500;
}

.table-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    padding: 0.75rem 1rem;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.table-row:last-child {
    border-bottom: none;
}

.col-name {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.col-actions {
    display: flex;
    gap: 0.5rem;
}

/* Storage Sidebar */
.storage-sidebar {
    position: sticky;
    top: 5rem;
}

.storage-stats {
    background-color: var(--muted);
    padding: 1.5rem;
    border-radius: 0.5rem;
}

.storage-progress {
    height: 0.5rem;
    background-color: var(--border);
    border-radius: 9999px;
    margin: 1rem 0;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: var(--primary);
    transition: width 0.2s;
}

.storage-text {
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

/* Utility Classes */
.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;
}

/* File Explorer Styles */
.file-explorer {
    background-color: var(--background);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    overflow: hidden;
}

.file-explorer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.file-explorer-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.view-options {
    display: flex;
    gap: 0.5rem;
}

.view-button {
    padding: 0.5rem;
    border: none;
    background: none;
    color: var(--muted-foreground);
    cursor: pointer;
    border-radius: 0.25rem;
    transition: all 0.2s;
}

.view-button:hover {
    background-color: var(--muted);
    color: var(--foreground);
}

.view-button.active {
    background-color: var(--muted);
    color: var(--primary);
}

.file-explorer-content {
    padding: 1rem;
}

.folder-group {
    margin-bottom: 1rem;
}

.folder-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 0.25rem;
    transition: background-color 0.2s;
}

.folder-header:hover {
    background-color: var(--muted);
}

.folder-header i {
    color: var(--muted-foreground);
}

.folder-header .fa-folder {
    color: var(--primary);
}

.item-count {
    margin-left: auto;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.folder-content {
    margin-left: 1.5rem;
    padding-left: 1rem;
    border-left: 1px solid var(--border);
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s;
}

.file-item:hover {
    background-color: var(--muted);
}

.file-item-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.file-item-info i {
    color: var(--muted-foreground);
}

.file-item-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.file-size {
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

.file-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.file-item:hover .file-actions {
    opacity: 1;
}

.action-button {
    padding: 0.25rem;
    border: none;
    background: none;
    color: var(--muted-foreground);
    cursor: pointer;
    border-radius: 0.25rem;
    transition: all 0.2s;
}

.action-button:hover {
    background-color: var(--background);
    color: var(--foreground);
}

.action-button.favorite:hover {
    color: #faa61a;
}

.action-button.share:hover {
    color: #43b581;
}

.action-button.download:hover {
    color: var(--primary);
}

.action-button.delete:hover {
    color: #ed4245;
}

/* Updated Sidebar Styles */
.nav-section {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-section:not(:last-child) {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

/* File Tree Styles */
.file-tree {
    margin-left: 0.5rem;
}

.tree-item {
    margin: 0.25rem 0;
}

.tree-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 0.25rem;
    transition: background-color 0.2s;
}

.tree-header:hover {
    background-color: var(--muted);
}

.tree-item.active > .tree-header {
    background-color: var(--muted);
}

.tree-content {
    padding-left: 1.5rem;
    border-left: 1px solid var(--border);
    margin-left: 0.75rem;
}

.tree-item {
    user-select: none;
}

/* Ensure chevron has consistent width */
.tree-header i:first-child {
    width: 1rem;
    text-align: center;
}

.tree-header i {
    font-size: 0.875rem;
    width: 1rem;
    text-align: center;
}

.tree-header i.fa-folder,
.tree-header i.fa-folder-open {
    color: var(--primary);
}

/* Upload Button Style */
.upload-button {
    background-color: var(--primary);
    color: var(--primary-foreground);
}

.upload-button:hover {
    background-color: var(--primary);
    opacity: 0.9;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--background);
    border-radius: 0.5rem;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--muted-foreground);
}

/* Upload Form Styles */
.drop-zone {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    margin: 1rem;
    transition: border-color 0.2s;
}

.drop-zone.drag-over {
    border-color: var(--primary);
    background-color: var(--muted);
}

.file-input {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.drop-zone-text {
    color: var(--muted-foreground);
}

.drop-zone-text i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.file-list {
    margin: 1rem;
    max-height: 200px;
    overflow-y: auto;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    background-color: var(--muted);
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
}

/* Create Options Styles */
.create-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

.create-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: none;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.create-option:hover {
    background-color: var(--muted);
    border-color: var(--primary);
}

.create-option i {
    font-size: 2rem;
    color: var(--primary);
}

/* Modal Form Styles */
.modal-form {
    padding: 1rem;
}

.modal-form input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    margin-bottom: 1rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid var(--border);
}

/* File Viewer Modal Styles */
.viewer-modal .modal-content {
    width: 95%;
    height: 90vh;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
}

.viewer-modal .modal-header {
    padding: 1rem;
    background-color: var(--background);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.viewer-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.viewer-title h2 {
    margin: 0;
    font-size: 1.25rem;
    max-width: 500px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.viewer-actions {
    display: flex;
    gap: 0.5rem;
}

.viewer-container {
    flex: 1;
    overflow: auto;
    background-color: var(--muted);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.viewer-element {
    max-height: 100%;
    max-width: 100%;
    display: none;
}

#imageViewer {
    object-fit: contain;
    max-height: 80vh;
}

#videoPlayer {
    width: 100%;
    max-height: 80vh;
}

#pdfViewer {
    width: 100%;
    height: 100%;
    border: none;
}

.text-content {
    background-color: var(--background);
    padding: 2rem;
    margin: 2rem;
    border-radius: 0.5rem;
    width: 100%;
    max-width: 800px;
    overflow: auto;
    white-space: pre-wrap;
}

.unsupported-message {
    text-align: center;
    color: var(--muted-foreground);
    padding: 2rem;
}

.unsupported-message i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Add loading state styles */
.viewer-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--muted-foreground);
}

.viewer-loading i {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.viewer-loading p {
    margin: 0;
}

/* Update viewer container styles */
.viewer-container {
    flex: 1;
    overflow: auto;
    background-color: var(--muted);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.viewer-element {
    max-height: 100%;
    max-width: 100%;
    display: none;
}

#imageViewer {
    object-fit: contain;
    max-height: 80vh;
}

#videoPlayer {
    width: 100%;
    max-height: 80vh;
}

#pdfViewer {
    width: 100%;
    height: 100%;
    border: none;
}

.text-content {
    background-color: var(--background);
    padding: 2rem;
    margin: 2rem;
    border-radius: 0.5rem;
    width: 100%;
    max-width: 800px;
    overflow: auto;
    white-space: pre-wrap;
}

.unsupported-message {
    text-align: center;
    color: var(--muted-foreground);
    padding: 2rem;
}

.unsupported-message i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Add visual hierarchy */
.tree-item .tree-item {
    margin-top: 0.25rem;
}

/* Update tree styles */
.tree-content {
    padding-left: 1.5rem;
    border-left: 1px solid var(--border);
    margin-left: 0.75rem;
}

.tree-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 0.25rem;
    transition: background-color 0.2s;
}

.tree-header:hover {
    background-color: var(--muted);
}

.tree-item {
    user-select: none;
}

.file-header {
    padding-left: 1.5rem; /* Align with folder content */
}

/* Ensure chevron has consistent width */
.tree-header i:first-child {
    width: 1rem;
    text-align: center;
}

/* Add visual hierarchy */
.tree-item .tree-item {
    margin-top: 0.25rem;
}

/* Upload Modal Styles */
.upload-location {
    margin-bottom: 1rem;
    padding: 1rem;
    background-color: var(--muted);
    border-radius: 0.375rem;
}

.folder-select {
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background-color: var(--background);
}

.file-list {
    max-height: 200px;
    overflow-y: auto;
    margin: 1rem 0;
}

.file-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
    background-color: var(--background);
}

.file-list-item .file-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.file-list-item .file-size {
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

.file-list-item .remove-file {
    background: none;
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
}

.file-list-item .remove-file:hover {
    color: #ef4444;
    background-color: var(--muted);
}

.upload-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* Context Menu Styles */
.context-menu {
    position: fixed;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    padding: 0.5rem;
    min-width: 160px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.context-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    width: 100%;
    border: none;
    background: none;
    color: var(--foreground);
    cursor: pointer;
    text-align: left;
    border-radius: 0.25rem;
}

.context-item:hover {
    background-color: var(--muted);
}

.context-item.delete-item {
    color: #ef4444;
}

.context-item.delete-item:hover {
    background-color: #fee2e2;
}

/* Confirmation Dialog Styles */
.modal-body {
    padding: 1.5rem;
    text-align: center;
    color: var(--foreground);
}

.confirm-delete {
    background-color: #ef4444 !important;
    color: white !important;
}

.confirm-delete:hover {
    background-color: #dc2626 !important;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid var(--border);
}

/* Back folder styles */
.back-folder {
    background-color: var(--muted);
    border: 1px dashed var(--border);
}

.back-folder:hover {
    background-color: var(--border);
}

.back-folder .folder-icon {
    color: var(--muted-foreground);
}

.back-folder .folder-info {
    color: var(--muted-foreground);
}

/* Breadcrumb styles */
.breadcrumb-item {
    color: var(--primary);
    cursor: pointer;
}

.breadcrumb-item:hover {
    text-decoration: underline;
}

.empty-message {
    text-align: center;
    color: var(--muted-foreground);
    padding: 2rem;
} 