* {
    margin: 0px;
    padding: 0px;
    box-sizing: border-box;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

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

/* Gen-Z Animation keyframes */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

.container {
    width: 100%;
    height: 100vh;
    display: grid;
    background: #f1f1f1;
    grid-template-columns: auto 1fr;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.rotate-90 {
    transform: rotate(90deg);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar Style Start */

.sidebar {
    width: 250px;
    height: 100%;
    background-color: #f8fafd;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: start;
    align-items: start;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: start;
}

.sidebar-header img {
    width: 40px;
    height: 40px;
    margin-right: 10px;
}

.sidebar-header span {
    font-size: 1.2rem;
    font-weight: 500;
    color: #444746;
}

.sidebar .new-button {
    padding: 15px 20px;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
    font-size: 0.9rem;
    color: #282c35;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.sidebar .new-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.sidebar .new-button:hover::before {
    width: 300px;
    height: 300px;
}

.sidebar .new-button:hover {
    background-color: #edf1fa;
    border: 1px solid #c9d0e6;
    box-shadow: 0px 5px 15px rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
}

.sidebar .new-button img {
    width: 24px;
    height: 24px;
    margin-right: 10px;
}

.new-upload {
    position: absolute;
    background-color: #ffffff;
    padding: 5px 0px;
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    width: 250px;
    top: 40px;
    z-index: -1;
    opacity: 0;
    transition: all 0.2s;
}

.new-upload div {
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: start;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.new-upload div:hover {
    background-color: #f1f1f1;
}

.new-upload div img {
    margin-right: 10px;
    height: 20px;
    width: 20px;
}

.new-upload hr {
    border: 1px solid #e0e0e0;
    margin: 5px 0px;
}

.bg-blur {
    position: fixed;
    background-color: #000000;
    height: 100dvh;
    width: 100dvw;
    transition: opacity 0.3s ease;
    z-index: -1;
    opacity: 0;
}

/* More Options Start */

.more-options {
    position: absolute;
    background-color: #ffffff;
    padding: 2px 0px;
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    z-index: -1;
    opacity: 0;
    transition: all 0.2s;
    width: 150px;
    transform: translateX(-50%);
}

.more-options div {
    width: 100%;
    padding: 5px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.more-options div:hover {
    background-color: #f1f1f1;
}

.more-options div img {
    margin-right: 10px;
    height: 20px;
    width: 20px;
}

.more-options hr {
    border: 1px solid #e0e0e0;
    margin: 2px 0px;
}

/* More Options End */


/* Create New Folder Start */
.create-new-folder {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background-color: #fff;
    border-radius: 10px;
    z-index: -1;
    opacity: 0;
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3);
    transition: opacity 0.3s ease;
    width: 400px;
}

.create-new-folder span {
    font-size: 1.2rem;
    font-weight: 400;
    color: #444746;
    margin-bottom: 20px;
    width: 100%;
    margin-left: 10px;
}

.create-new-folder input {
    width: 100%;
    padding: 10px 20px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    outline: none;
    font-size: 0.9rem;
    font-weight: 400;
    color: #444746;
    margin-bottom: 20px;
}

.create-new-folder div {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: end;
    gap: 10px;
}

.create-new-folder button {
    background-color: transparent;
    border: none;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    color: #0b57d0;
    font-weight: 500;
    padding: 10px 20px;
}

.create-new-folder button:hover {
    background-color: #edf1fa;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
}

/* Create New Folder End */

/* Remote URL Upload Start */

#single-threaded-div {
    display: flex;
    flex-direction: row;
    justify-content: start;
    align-items: center;
    width: 100%;
    margin: 10px 0px;
}

#single-threaded-div input {
    width: auto;
    margin: 0px;
    margin-left: 10px;
}

#single-threaded-div img {
    height: 16px;
    width: 16px;
}

#single-threaded-div a {
    height: 16px;
    width: 16px;
}

/* Remote URL Upload End */

/* File Uploader Start */

.file-uploader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background-color: #fff;
    border-radius: 10px;
    z-index: -1;
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3);
    transition: opacity 0.3s ease;
    width: 500px;
    opacity: 0;
}

.upload-head {
    font-size: 1.2rem;
    font-weight: 500;
    color: #444746;
    margin-bottom: 20px;
    width: 100%;
}

.upload-info {
    font-size: 16px;
    font-weight: 400;
    color: #444746;
    margin-bottom: 5px;
    width: 100%;
    max-height: 40px;
    overflow: hidden;
}

.progress {
    width: 100%;
    background-color: #ddd;
    border-radius: 5px;
    overflow: hidden;
    margin-top: 20px;
}

.progress-bar {
    height: 20px;
    background-color: #007bff;
    width: 0;
    transition: width 0.3s;
}

.file-uploader .btn-div {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: end;
    margin-top: 20px;
}

.file-uploader button {
    background-color: transparent;
    border: none;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    color: #0b57d0;
    font-weight: 500;
    padding: 10px 20px;
}

.file-uploader button:hover {
    background-color: #edf1fa;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
}

/* File Uploader End */

.sidebar-menu {
    margin-top: 20px;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: start;
    align-items: center;
}

.sidebar-menu a {
    width: 100%;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: start;
    color: #444746;
    font-size: 0.9rem;
    font-weight: 400;
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 20px;
}

.sidebar-menu .selected-item {
    background-color: #c2e7ff;
}

.sidebar-menu .unselected-item:hover {
    background-color: #cfcfcf;
}

.sidebar-menu a img {
    width: 20px;
    height: 20px;
    margin-right: 10px;
}

/* Sidebar Style End */

/* Main Content Style Start */

.main-content {
    width: 100%;
    height: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: start;
    align-items: start;
    background-color: #f8fafd;
}


.main-content .header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 15px;
}

#search-form {
    height: 100%;
    width: 100%;
}

.search-bar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: start;
    background-color: #e9eef6;
    border-radius: 20px;
    padding: 10px 20px;
    flex-grow: 1;
}

.search-bar img {
    width: 20px;
    height: 20px;
    margin-right: 20px;
}

.search-bar input {
    width: 100%;
    border: none;
    outline: none;
    background-color: transparent;
    font-size: 1rem;
    font-weight: 400;
}

.search-bar:focus-within {
    background-color: #ffffff;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
}

.directory {
    background-color: #fff;
    padding: 10px 20px;
    width: 100%;
    height: 100%;
    border-radius: 20px;
    margin-top: 20px;
}

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

.directory table tr th {
    text-align: start;
    font-size: 0.9rem;
    font-weight: 500;
    color: #444746;
    padding: 10px 0px;
    border-bottom: 1px solid #e0e0e0;
}

.directory table tr td {
    text-align: start;
    font-size: 0.9rem;
    font-weight: 400;
    color: #444746;
    border-bottom: 1px solid #e0e0e0;
    height: 50px;
}

.directory .body-tr {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.directory .body-tr:hover {
    background-color: #f1f1f1;
    transform: scale(1.01);
}

.directory .td-align {
    display: flex;
    align-items: center;
    justify-content: start;
    width: 100%;
    height: 100%;
}

.directory .td-align img {
    width: 24px;
    height: 24px;
    margin-right: 10px;
}

.directory .more-btn img {
    width: 14px;
    height: 14px;
    margin: 0px;
}

.directory .more-btn {
    padding: 8px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.directory .more-btn:hover {
    background-color: #b9b9b9;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
    transform: rotate(90deg) scale(1.1);
}

/* Theme Toggle & Dark Mode */
/* Theme Toggle & Dark Mode */


.theme-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    padding: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
    flex-shrink: 0;
}

.theme-toggle-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

body.dark-mode .theme-toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Dark Mode Variables/Overrides */
body.dark-mode .container {
    background-color: #121212;
}

body.dark-mode .sidebar {
    background-color: #1e1e1e;
    border-right: 1px solid #333;
}

body.dark-mode .sidebar-header span {
    color: #e0e0e0;
}

body.dark-mode .sidebar .new-button {
    background-color: #2d2d2d;
    color: #e0e0e0;
    border: 1px solid #444;
}

body.dark-mode .sidebar .new-button:hover {
    background-color: #383838;
}

body.dark-mode .new-upload {
    background-color: #2d2d2d;
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
}

body.dark-mode .new-upload div {
    color: #e0e0e0;
}

body.dark-mode .new-upload div:hover {
    background-color: #383838;
}

body.dark-mode .sidebar-menu a {
    color: #bfbfbf;
}

body.dark-mode .sidebar-menu .selected-item {
    background-color: #3a4a5e;
    color: #fff;
}

body.dark-mode .sidebar-menu .unselected-item:hover {
    background-color: #2d2d2d;
}

/* Sidebar Collapsed State */
.container.sidebar-collapsed {
    grid-template-columns: 0px 1fr;
}

.container.sidebar-collapsed .sidebar {
    padding: 0px;
    overflow: hidden;
    width: 0px;
}

body.dark-mode .main-content {
    background-color: #121212;
}

body.dark-mode .search-bar {
    background-color: #2d2d2d;
}

body.dark-mode .search-bar input {
    color: #e0e0e0;
}

body.dark-mode .directory {
    background-color: #1e1e1e;
}

body.dark-mode .directory table tr th {
    color: #aaa;
    border-bottom: 1px solid #333;
}

body.dark-mode .directory table tr td {
    color: #e0e0e0;
    border-bottom: 1px solid #333;
}

body.dark-mode .directory .body-tr:hover {
    background-color: #2d2d2d;
}

body.dark-mode .create-new-folder,
body.dark-mode .file-uploader,
body.dark-mode .more-options,
body.dark-mode #get-password {
    background-color: #1e1e1e;
    color: #e0e0e0;
}

body.dark-mode .create-new-folder input,
body.dark-mode #auth-pass {
    background-color: #2d2d2d;
    border: 1px solid #444;
    color: #e0e0e0;
}

body.dark-mode .create-new-folder span,
body.dark-mode .upload-head,
body.dark-mode .upload-info {
    color: #e0e0e0;
}

body.dark-mode .more-options div:hover {
    background-color: #383838;
}

body.dark-mode .more-options div {
    color: #e0e0e0;
}

/* Icon Inversion for Dark Mode */
body.dark-mode img {
    filter: invert(0.9);
}

/* Exceptions for images that shouldn't be inverted */
body.dark-mode .sidebar-header img,
/* Logo */
body.dark-mode .directory img[src*="file-icon"],
/* Maybe file icon colors matter? assuming svgs are mono for now */
body.dark-mode .directory img[src*="folder-solid"] {
    filter: none;
}

/* Re-invert folder icon if it is dark? */
body.dark-mode .directory img[src*="folder-solid"] {
    filter: invert(0.7) sepia(1) hue-rotate(180deg);
    /* Attempt to make it bluish or standard folder color if it was black */
}

/* Ideally, we should check what icons look like. Assuming black icons, invert 0.9 makes them white. */
body.dark-mode .directory img[src*="folder-solid-icon.svg"] {
    filter: invert(0.5);
    /* Grey */
}

/* SVG Fill */
body.dark-mode svg {
    fill: #e0e0e0 !important;
}

/* Toast Notification System */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 24px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    animation: slideInDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    pointer-events: all;
    font-weight: 500;
    font-size: 14px;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.5);
    animation: toastProgress 3s linear;
}

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

.toast.success {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.toast.error {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.toast.info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.toast.warning {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    line-height: 1.4;
}

.toast-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
    font-size: 18px;
    line-height: 1;
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.toast.hiding {
    animation: slideOutRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideOutRight {
    to {
        opacity: 0;
        transform: translateX(400px);
    }
}

body.dark-mode .toast {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 9999;
    animation: fadeIn 0.3s;
}

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    position: relative;
    width: 80px;
    height: 80px;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    border-radius: 50%;
    animation: spin 1.5s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.spinner-ring:nth-child(1) {
    border-top-color: #667eea;
    animation-delay: -0.45s;
}

.spinner-ring:nth-child(2) {
    border-top-color: #764ba2;
    animation-delay: -0.3s;
}

.spinner-ring:nth-child(3) {
    border-top-color: #f093fb;
    animation-delay: -0.15s;
}

#loading-text {
    color: white;
    margin-top: 20px;
    font-size: 16px;
    font-weight: 500;
    animation: fadeIn 0.5s;
}

/* Sort Dropdown */
.sort-dropdown {
    position: relative;
}

.sort-menu {
    position: absolute;
    top: 45px;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    padding: 8px;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

.sort-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.sort-option {
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
    color: #444746;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-option:hover {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    transform: translateX(4px);
}

.sort-option.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

body.dark-mode .sort-menu {
    background: #2d2d2d;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

body.dark-mode .sort-option {
    color: #e0e0e0;
}

body.dark-mode .sort-option:hover {
    background: #383838;
}

body.dark-mode .sort-option.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* Mobile Responsive Styles */
@media screen and (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100vh;
        z-index: 100;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar.mobile-open {
        left: 0;
    }
    
    .main-content {
        padding: 10px;
    }
    
    .header {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .search-bar {
        order: 3;
        width: 100%;
        margin-top: 10px;
    }
    
    .directory {
        overflow-x: auto;
        border-radius: 12px;
    }
    
    .directory table {
        min-width: 500px;
    }
    
    .create-new-folder,
    .file-uploader {
        width: 90%;
        max-width: 400px;
    }
    
    #toast-container {
        right: 10px;
        left: 10px;
        top: 10px;
    }
    
    .toast {
        min-width: auto;
        max-width: 100%;
    }
}

@media screen and (max-width: 480px) {
    .sidebar-header span {
        font-size: 1rem;
    }
    
    .new-button {
        font-size: 0.8rem;
        padding: 12px 16px !important;
    }
    
    .directory table tr th,
    .directory table tr td {
        font-size: 0.8rem;
        padding: 8px 5px;
    }
    
    .td-align img {
        width: 20px !important;
        height: 20px !important;
    }
}