:root {
    --primary-color: #4a4e69;
    --secondary-color: #9a8c98;
    --accent-color: #c9ada7;
    --background-color: #f2e9e4;
    --text-color: #22223b;
    --error-color: #d9534f;
    --success-color: #5cb85c;
    --warning-color: #f0ad4e;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }

body {
    background: var(--background-color);
    color: var(--text-color);
    height: 100vh;
    margin: 0;
    overflow: hidden; /* Prevent body scroll, handle in main-content */
}

.login-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 400px;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
    z-index: 10;
    backdrop-filter: blur(5px);
    animation: fadeInCentered 1s ease-in-out;
}

/* App Layout */
.app-layout {
    display: flex;
    width: 100vw;
    height: 100vh;
    background: rgba(255,255,255,0.5);
    backdrop-filter: blur(10px);
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: rgba(255,255,255,0.9);
    border-right: 1px solid rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 100;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.sidebar-header h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin: 0;
}

.sidebar-user {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    color: var(--text-color);
}

.sidebar-menu {
    flex: 1;
    padding: 10px 0;
    overflow-y: auto;
}

.sidebar-menu .menu-item {
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-color);
    transition: background 0.2s;
    font-size: 1rem;
}

.sidebar-menu .menu-item:hover, .sidebar-menu .menu-item.active {
    background: rgba(74, 78, 105, 0.1);
    color: var(--primary-color);
    border-right: 3px solid var(--primary-color);
}

.sidebar-details {
    padding: 20px;
    background: rgba(255,255,255,0.5);
    border-top: 1px solid rgba(0,0,0,0.05);
    min-height: 200px;
}

.empty-details {
    text-align: center;
    color: var(--secondary-color);
    padding: 20px 0;
}

.empty-details i {
    font-size: 2rem;
    margin-bottom: 10px;
    opacity: 0.5;
}

.file-details-content {
    animation: fadeIn 0.3s;
}

.detail-icon {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.detail-info p {
    margin: 5px 0;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
}

.detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 15px;
    justify-content: center;
}

.sidebar-storage {
    padding: 20px;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.storage-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 5px;
    color: var(--text-color);
}

.storage-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.storage-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 20px 40px;
    overflow-y: auto;
    position: relative;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.mobile-menu-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary-color);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        height: 100%;
        box-shadow: 5px 0 15px rgba(0,0,0,0.1);
    }
    .sidebar.open {
        transform: translateX(280px);
    }
    .mobile-menu-toggle {
        display: block;
    }
    .main-content {
        padding: 15px;
    }
}

.container, .error-container { width: 90%; max-width: 1000px; text-align: center; padding: 2rem; background: rgba(255,255,255,0.8); border-radius: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); backdrop-filter: blur(5px); animation: fadeIn 1s ease-in-out; margin: 0 auto; }

h1 { color: var(--primary-color); font-size: 2.2rem; margin-bottom: 1rem; position: relative; display: inline-block; }
h1::after { content: ''; position: absolute; bottom: -10px; left: 0; width: 100%; height: 5px; background: linear-gradient(90deg, var(--primary-color), var(--accent-color), var(--secondary-color)); border-radius: 10px; transform: scaleX(0); transform-origin: left; animation: lineGrow 1.5s forwards ease-out; }

p { font-size: 1.1rem; line-height: 1.6; color: var(--text-color); margin: 1rem 0; }

a { color: var(--primary-color); text-decoration: none; font-weight: bold; }
a:hover { text-decoration: underline; }

.btn { display: inline-block; padding: 10px 20px; background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)); color: white; border: none; border-radius: 30px; font-size: 1rem; cursor: pointer; text-decoration: none; margin: 8px; transition: transform 0.3s, box-shadow 0.3s; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.btn:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,0.15); text-decoration: none; }
.btn.small { padding: 6px 12px; font-size: .9rem; }

.floating-bg { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: -1; overflow: hidden; }
.floating-bg div { position: absolute; border-radius: 50%; background: rgba(201, 173, 167, 0.2); animation: float 20s infinite; }
.floating-bg div:nth-child(1) { width: 300px; height: 300px; left: -100px; top: 10%; animation-delay: 0s; }
.floating-bg div:nth-child(2) { width: 200px; height: 200px; right: -50px; top: 40%; animation-delay: 4s; }
.floating-bg div:nth-child(3) { width: 150px; height: 150px; left: 30%; bottom: 10%; animation-delay: 8s; }

.status { display: flex; align-items: center; justify-content: center; margin: 1rem 0; gap: 10px; }
.status-dot { width: 12px; height: 12px; background-color: #4CAF50; border-radius: 50%; animation: pulse 2s infinite; }

/* Login */
/* .login-container moved to top */
.input-group { margin-bottom: 1rem; text-align: left; }
.input-group label { display: block; margin-bottom: .5rem; color: var(--primary-color); font-weight: bold; }
.input-group input { width: 100%; padding: 10px 12px; border: 1px solid var(--secondary-color); border-radius: 8px; font-size: 1rem; color: var(--text-color); background-color: #fff; }
.input-group input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(74,78,105,0.2); }

/* Message */
.message { margin-top: 1rem; padding: 10px; border-radius: 5px; font-size: .9rem; display: none; }
.message.success { background-color: var(--success-color); color: #fff; display:block }
.message.error { background-color: var(--error-color); color: #fff; display:block }

/* File Grid View */
.file-grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    padding: 10px 0;
}

.file-card {
    background: white;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 140px;
}

.file-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-color: var(--accent-color);
}

.file-card.selected {
    background-color: #f0f4ff;
    border-color: var(--primary-color);
}

.file-card-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.file-card-icon.folder { color: #f0ad4e; }
.file-card-icon.image { color: #5cb85c; }
.file-card-icon.video { color: #d9534f; }
.file-card-icon.audio { color: #5bc0de; }
.file-card-icon.pdf { color: #d9534f; }
.file-card-icon.archive { color: #f0ad4e; }
.file-card-icon.code { color: #4a4e69; }

.file-card-name {
    font-size: 0.9rem;
    word-break: break-all;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.2;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 20px;
    background: rgba(255,255,255,0.5);
    padding: 10px 15px;
    border-radius: 8px;
    flex-wrap: wrap;
}

.breadcrumb-item {
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
}

.breadcrumb-item:hover { color: var(--primary-color); text-decoration: underline; }
.breadcrumb-separator { color: var(--secondary-color); margin: 0 5px; }
.breadcrumb-item.active { color: var(--secondary-color); cursor: default; text-decoration: none; }

/* Context Menu */
.context-menu {
    position: fixed;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    padding: 5px 0;
    z-index: 1000;
    display: none;
    min-width: 180px;
    animation: fadeIn 0.1s ease-out;
}

.menu-item {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    color: var(--text-color);
}

.menu-item:hover { background-color: #f5f5f5; color: var(--primary-color); }
.menu-item i { width: 20px; text-align: center; }
.menu-divider { height: 1px; background-color: #eee; margin: 5px 0; }
.menu-item.delete { color: var(--error-color); }
.menu-item.delete:hover { background-color: #fff0f0; }

/* FAB */
.fab-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 900;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    pointer-events: none;
}

.fab-main {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.3s, background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.fab-main:hover { transform: scale(1.1); background: #3a3e59; }
.fab-main.active { transform: rotate(45deg); background: var(--error-color); }

.fab-menu {
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.8);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: bottom center;
}

.fab-container.active .fab-menu { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); }

.fab-item {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    color: var(--primary-color);
    border: none;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    position: relative;
    transition: transform 0.2s;
}

.fab-item:hover { transform: scale(1.1); }

.fab-label {
    position: absolute;
    right: 60px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.fab-item:hover .fab-label { opacity: 1; }

/* Upload Queue Panel */
.upload-queue-panel {
    position: fixed;
    bottom: 30px;
    right: 100px; /* Left of FAB */
    width: 350px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    z-index: 800;
    display: flex;
    flex-direction: column;
    max-height: 400px;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.upload-queue-panel.collapsed {
    max-height: 50px;
    overflow: hidden;
}

.queue-header {
    padding: 15px;
    background: var(--primary-color);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: bold;
}

.queue-controls { display: flex; gap: 10px; align-items: center; }
.queue-controls i { cursor: pointer; transition: transform 0.3s; }
.upload-queue-panel.collapsed .toggle-icon { transform: rotate(180deg); }

.queue-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.queue-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}

.queue-item-icon { font-size: 1.2rem; color: var(--secondary-color); }
.queue-item-info { flex: 1; overflow: hidden; }
.queue-item-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 5px; }
.queue-progress-bar { height: 4px; background: #eee; border-radius: 2px; overflow: hidden; }
.queue-progress-fill { height: 100%; background: var(--success-color); width: 0%; transition: width 0.2s; }
.queue-item-status { font-size: 0.8rem; color: #888; margin-top: 2px; display: flex; justify-content: space-between; }

.queue-empty-state { text-align: center; padding: 30px; color: #ccc; }
.queue-empty-state i { font-size: 3rem; margin-bottom: 10px; }

/* Mobile Adjustments */
@media (max-width: 768px) {
    .file-grid-view { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
    .file-card { height: 120px; padding: 10px; }
    .file-card-icon { font-size: 2.5rem; }
    .upload-queue-panel { width: 90%; right: 5%; bottom: 100px; }
    .fab-container { bottom: 20px; right: 20px; }
    .fab-label { display: none; } /* Hide labels on mobile */
}

footer { margin-top: 1rem; font-size: .9rem; color: var(--secondary-color); }

/* Animations */
@keyframes pulse { 0%{transform:scale(1);opacity:.8} 50%{transform:scale(1.3);opacity:1} 100%{transform:scale(1);opacity:.8} }
@keyframes float { 0%{transform:translate(0,0) rotate(0)} 25%{transform:translate(10%,15%) rotate(5deg)} 50%{transform:translate(5%,-10%) rotate(10deg)} 75%{transform:translate(-10%,5%) rotate(5deg)} 100%{transform:translate(0,0) rotate(0)} }
@keyframes fadeIn { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }
@keyframes fadeInCentered { from{opacity:0;transform:translate(-50%, -50%) translateY(20px)} to{opacity:1;transform:translate(-50%, -50%)} }
@keyframes lineGrow { to{transform:scaleX(1)} }

@media (max-width: 900px) { .file-item{grid-template-columns: 30px 1fr 80px 150px 150px} .file-grid{grid-template-columns: 1fr 1fr} }
@media (max-width: 600px) { .file-item{grid-template-columns: 30px 1fr 60px 120px 120px} .file-grid{grid-template-columns: 1fr} }

/* Modal */
.modal { display: none; position: fixed; z-index: 100; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.4); backdrop-filter: blur(3px); }
.modal-content { background-color: #fefefe; margin: 15% auto; padding: 20px; border: 1px solid #888; width: 90%; max-width: 500px; border-radius: 15px; box-shadow: 0 5px 15px rgba(0,0,0,0.3); position: relative; animation: fadeIn 0.3s; }
.close { color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer; }
.close:hover, .close:focus { color: black; text-decoration: none; cursor: pointer; }
.form-group { margin-bottom: 15px; text-align: left; }
.form-group label { display: block; margin-bottom: 5px; font-weight: bold; }
.form-group select, .form-group input { width: 100%; padding: 8px; border-radius: 5px; border: 1px solid #ccc; }

/* Toolbar */
.toolbar { display: flex; gap: 10px; margin-bottom: 15px; flex-wrap: wrap; }

/* Action buttons in grid */
.action-buttons { display: flex; gap: 5px; flex-wrap: wrap; }
.action-buttons .btn.small { margin: 0; padding: 4px 8px; font-size: 0.8rem; }
.delete-btn { background: linear-gradient(135deg, #d9534f, #c9302c); }
.rename-btn { background: linear-gradient(135deg, #f0ad4e, #ec971f); }

/* Progress Bar */
#progressContainer { width: 100%; background-color: #ddd; border-radius: 10px; overflow: hidden; }
#progressBar { height: 20px; background-color: var(--success-color); text-align: center; line-height: 20px; color: white; width: 0%; transition: width 0.3s; }

/* Mobile Layout */
@media (max-width: 768px) {
    .container { width: 95%; padding: 1rem; }
    h1 { font-size: 1.8rem; }
    
    .gridjs-wrapper { overflow-x: auto; }
    
    .action-buttons { flex-direction: row; justify-content: space-around; }
    .action-buttons .btn.small { flex: 1; margin: 2px; }
    
    .toolbar { flex-direction: column; }
    .toolbar .btn { width: 100%; margin: 5px 0; }
    
    .modal-content { margin: 20% auto; width: 95%; }
}