@font-face { font-family: 'Play'; src: url('/static/fonts/play.ttf') format('truetype'); font-weight: normal; font-style: normal; }
@font-face { font-family: 'Play'; src: url('/static/fonts/play.ttf') format('truetype'); font-weight: bold; font-style: normal; }

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #3b82f6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --gray: #6b7280;
    --dark: #1f2937;
    --light: #f9fafb;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --radius: 8px;
    --spacing: 12px;
}

body {
    font-family: 'Play', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    background: #9ca3af;
    min-height: 100vh;
    color: var(--dark);
    line-height: 1.6;
}

/* Login Page */
.login-page {
    display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px;
}
.login-container {
    background: white; padding: 40px; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%; max-width: 420px; animation: slideUp 0.5s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.login-container h1 {
    text-align: center; margin-bottom: 30px; color: var(--primary); font-size: 32px; font-weight: bold;
}
.login-container input {
    width: 100%; padding: 14px 18px; margin-bottom: 16px; border: 2px solid var(--border);
    border-radius: var(--radius); font-family: 'Play', sans-serif; font-size: 16px;
    transition: border-color 0.3s; outline: none;
}
.login-container input:focus { border-color: var(--primary); }
.login-container button {
    width: 100%; padding: 14px; background: var(--primary); color: white; border: none;
    border-radius: var(--radius); font-family: 'Play', sans-serif; font-size: 18px; font-weight: bold;
    cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
}
.login-container button:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(59,130,246,0.4); }
.login-container button:active { transform: translateY(0); }

/* Main Layout */
.app-container {
    max-width: 1400px; margin: 0 auto; padding: 20px; display: flex; flex-direction: column; height: 100vh;
}

/* Header */
.header {
    background: white; border-radius: var(--radius); padding: 14px 24px; margin-bottom: var(--spacing);
    box-shadow: var(--shadow); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;
    flex-shrink: 0; position: relative; min-height: 60px;
}
.header-left { display: flex; align-items: center; gap: 20px; }
.header-left h1 { font-size: 28px; color: var(--primary); font-weight: bold; }
.welcome-text { 
    color: var(--gray); font-size: 18px; font-weight: bold;
    position: absolute; left: 50%; transform: translateX(-50%);
}
.header-right { display: flex; align-items: center; gap: 12px; }

/* Admin Link */
.admin-link {
    display: inline-flex; align-items: center; padding: 8px 18px;
    background: white; color: var(--primary); border: 2px solid var(--primary); border-radius: var(--radius);
    text-decoration: none; font-weight: bold; font-size: 14px; transition: all 0.3s;
    line-height: 1.4;
}
.admin-link:hover { background: var(--primary); color: white; transform: translateY(-1px); }

/* Toolbar */
.toolbar {
    background: white; border-radius: var(--radius); padding: 14px 24px; margin-bottom: var(--spacing);
    box-shadow: var(--shadow); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;
    flex-shrink: 0;
}
.toolbar-buttons { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn {
    padding: 8px 18px; border-radius: var(--radius); border: 2px solid; cursor: pointer;
    font-family: 'Play', sans-serif; font-size: 14px; font-weight: bold;
    transition: all 0.3s; display: inline-flex; align-items: center;
    background: white; position: relative; overflow: hidden; line-height: 1.4;
}
.btn:active { transform: scale(0.95); }

.btn-create { color: var(--gray); border-color: var(--gray); }
.btn-create:hover { background: var(--gray); color: white; }

.btn-upload { color: var(--success); border-color: var(--success); }
.btn-upload:hover { background: var(--success); color: white; }

.btn-download { color: var(--info); border-color: var(--info); padding: 5px 10px; font-size: 13px; white-space: nowrap; }
.btn-download:hover { background: var(--info); color: white; }

.btn-view { color: var(--success); border-color: var(--success); padding: 5px 10px; font-size: 13px; white-space: nowrap; }
.btn-view:hover { background: var(--success); color: white; }

.btn-rename { color: var(--warning); border-color: var(--warning); padding: 5px 10px; font-size: 13px; white-space: nowrap; }
.btn-rename:hover { background: var(--warning); color: white; }

.btn-remove { color: var(--danger); border-color: var(--danger); padding: 5px 10px; font-size: 13px; white-space: nowrap; }
.btn-remove:hover { background: var(--danger); color: white; }

/* Path Bar */
.path-bar {
    background: #f3f4f6; padding: 8px 16px; border-radius: var(--radius);
    font-family: 'Courier New', monospace; font-size: 15px; color: var(--dark);
    display: flex; align-items: center; gap: 8px;
}
.path-label { color: var(--gray); font-weight: bold; font-family: 'Play', sans-serif; }

/* Content Area */
.content-area {
    background: white; border-radius: var(--radius); box-shadow: var(--shadow);
    margin-bottom: var(--spacing); overflow: hidden; flex: 1; display: flex; flex-direction: column; min-height: 0;
    position: relative;
}

/* File List */
.file-list { flex: 1; overflow-y: auto; position: relative; }
.file-list::-webkit-scrollbar { width: 8px; }
.file-list::-webkit-scrollbar-track { background: #f1f1f1; }
.file-list::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 4px; }
.file-list::-webkit-scrollbar-thumb:hover { background: #a1a1a1; }

.file-header {
    display: flex; padding: 10px 20px; background: #f8fafc; border-bottom: 2px solid var(--border);
    font-weight: bold; color: var(--gray); position: sticky; top: 0; z-index: 10; font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px;
}
.col-name { flex: 1; min-width: 0; padding: 0 8px; }
.col-size { width: 100px; padding: 0 8px; text-align: right; }
.col-actions { width: 320px; padding: 0 8px; text-align: center; flex-shrink: 0; }

.file-item {
    display: flex; padding: 10px 20px; border-bottom: 1px solid var(--border);
    align-items: center; transition: all 0.2s; cursor: pointer; position: relative;
    font-size: 16px;
}
.file-item:hover { background: #f0f4ff; }
.file-item:last-child { border-bottom: none; }
.file-item.dragover { background: #dbeafe; box-shadow: inset 0 0 0 2px var(--info); }

.file-item .col-name {
    flex: 1; min-width: 0; padding: 0 8px; white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; display: flex; align-items: center; gap: 8px; font-size: 16px;
}
.file-item .col-size { width: 100px; padding: 0 8px; text-align: right; color: var(--gray); font-size: 16px; flex-shrink: 0; }
.file-item .col-actions { width: 320px; padding: 0 8px; flex-shrink: 0; }

/* Folder styles - using direct class on the item */
.file-item.folder-item .col-name { font-weight: 700 !important; }
.file-item:not(.folder-item) .col-name { font-weight: 400; }

/* Folder & File icons */
.folder-icon { width: 24px; height: 24px; flex-shrink: 0; }
.file-icon { width: 24px; height: 24px; flex-shrink: 0; }

/* Back & Home buttons */
.back-item { background: #fafafa; }
.back-item .col-name { color: var(--gray); font-weight: bold; }
.back-item:hover { background: #f0f4ff; }
.home-item { background: #fafafa; }
.home-item .col-name { color: var(--primary); font-weight: bold; }
.home-item:hover { background: #f0f4ff; }

/* Actions buttons container */
.actions { display: flex; gap: 4px; justify-content: center; flex-wrap: nowrap; }

/* Footer */
.footer {
    background: white; border-radius: var(--radius); padding: 12px 20px; box-shadow: var(--shadow);
    flex-shrink: 0;
}
.disk-info { display: flex; gap: 12px; margin-bottom: 8px; }
.disk-stat {
    display: flex; align-items: baseline; gap: 8px; padding: 8px 14px;
    background: #f9fafb; border-radius: var(--radius); flex: 1;
}
.disk-stat-label { color: var(--gray); font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: bold; }
.disk-stat-value { font-size: 18px; font-weight: bold; }

.progress-container { width: 100%; }
.progress-bar {
    width: 100%; height: 6px; background: #e5e7eb; border-radius: 3px;
    overflow: hidden; position: relative;
}
.progress-fill {
    height: 100%; background: linear-gradient(90deg, #10b981 0%, #f59e0b 50%, #ef4444 100%);
    border-radius: 3px; transition: width 0.5s ease;
}

/* Scroll to top button */
.scroll-top {
    position: fixed; bottom: 120px; right: 20px; padding: 8px 16px;
    background: white; color: var(--gray); border: 2px solid var(--gray);
    border-radius: 20px; font-size: 16px; cursor: pointer; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.3s; z-index: 9999; display: none; align-items: center; justify-content: center;
    font-weight: bold; opacity: 0; pointer-events: none; font-family: 'Play', sans-serif;
}
.scroll-top.visible { 
    display: flex; opacity: 1; pointer-events: auto;
}
.scroll-top:hover { 
    background: var(--gray); color: white;
    transform: translateY(-2px); 
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.scroll-top:active { transform: translateY(0); }

/* Modal */
.modal {
    display: none; position: fixed; z-index: 10000; left: 0; top: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); animation: fadeIn 0.3s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-content {
    background: white; margin: 40px auto; border-radius: 16px; width: 95%; max-width: 1200px;
    max-height: 85vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideUp 0.3s;
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center; padding: 20px 28px;
    border-bottom: 2px solid var(--border);
}
.modal-header h3 { color: var(--dark); font-size: 22px; }
.close-btn {
    background: none; border: none; font-size: 32px; color: var(--gray); cursor: pointer;
    width: 44px; height: 44px; border-radius: 50%; transition: all 0.3s;
    display: flex; align-items: center; justify-content: center;
}
.close-btn:hover { background: #f3f4f6; color: var(--danger); }
.modal-body { padding: 28px; }
.modal-body img { max-width: 100%; border-radius: 8px; }
.modal-body pre {
    background: #1e293b; color: #e2e8f0; padding: 24px; border-radius: 8px;
    overflow-x: auto; font-family: 'Courier New', monospace; font-size: 15px; line-height: 1.6;
}

/* Rename Modal */
.rename-form { display: flex; gap: 12px; margin-top: 20px; }
.rename-form input {
    flex: 1; padding: 14px 18px; border: 2px solid var(--border); border-radius: var(--radius);
    font-family: 'Play', sans-serif; font-size: 16px; outline: none;
}
.rename-form input:focus { border-color: var(--primary); }
.rename-form .btn { background: var(--primary); color: white; border-color: var(--primary); font-size: 16px; padding: 14px 24px; }
.rename-form .btn:hover { background: #2563eb; }

/* Admin Panel */
.admin-container {
    max-width: 1400px; margin: 0 auto; padding: 20px;
}
.admin-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--spacing);
    background: white; padding: 14px 24px; border-radius: var(--radius); box-shadow: var(--shadow);
    min-height: 60px;
}
.admin-header h1 { color: var(--primary); font-size: 28px; }

/* Back button */
.back-btn {
    display: inline-flex; align-items: center; padding: 8px 18px;
    color: var(--primary); text-decoration: none; border: 2px solid var(--primary);
    border-radius: var(--radius); font-weight: bold; font-size: 14px; transition: all 0.3s;
    line-height: 1.4;
}
.back-btn:hover { background: var(--primary); color: white; }

.admin-grid {
    display: grid; grid-template-columns: 1fr 2fr; gap: var(--spacing);
}
.admin-card {
    background: white; border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 24px; overflow: hidden;
}
.admin-card:first-child { /* Users Management */ }
.admin-card:last-child { /* Action Logs - bigger */ }
.admin-card h2 {
    font-size: 22px; color: var(--dark); margin-bottom: 20px; padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

/* User creation form */
.user-create-form {
    display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px;
}
.user-create-form input[type="text"],
.user-create-form input[type="password"] {
    padding: 10px 14px; border: 2px solid var(--border); border-radius: var(--radius);
    font-family: 'Play', sans-serif; font-size: 15px; width: 100%; outline: none;
}
.user-create-form input:focus { border-color: var(--primary); }
.user-create-form .form-row {
    display: flex; gap: 8px; align-items: center;
}
.user-create-form label {
    display: flex; align-items: center; gap: 6px; font-size: 15px; color: var(--gray); white-space: nowrap;
}
.user-create-form input[type="checkbox"] { width: 18px; height: 18px; padding: 0; }

/* Tables */
.data-table {
    width: 100%; border-collapse: collapse; margin-top: 12px;
}
.data-table th {
    text-align: left; padding: 12px; background: #f8fafc; color: var(--gray);
    font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid var(--border);
}
.data-table td {
    padding: 12px; border-bottom: 1px solid var(--border); font-size: 16px;
}
.data-table tr:hover { background: #f9fafb; }
.data-table .badge {
    display: inline-block; padding: 4px 12px; border-radius: 12px; font-size: 14px; font-weight: bold;
}
.badge-admin { background: #dbeafe; color: #1e40af; }
.badge-user { background: #f3f4f6; color: #374151; }

/* Logs */
.logs-container { max-height: 600px; overflow-y: auto; }
.log-entry {
    padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 15px;
    display: grid; grid-template-columns: 170px 100px 130px 1fr; gap: 10px; align-items: center;
}
.log-entry:hover { background: #f9fafb; }
.log-time { color: var(--gray); font-size: 14px; }
.log-user { font-weight: bold; color: var(--primary); font-size: 15px; }
.log-action {
    display: inline-block; padding: 3px 10px; border-radius: 4px; font-size: 13px;
    font-weight: bold; text-transform: uppercase; text-align: center;
}
.action-create { background: #d1fae5; color: #065f46; }
.action-upload { background: #dbeafe; color: #1e40af; }
.action-download { background: #e0e7ff; color: #3730a3; }
.action-view { background: #fef3c7; color: #92400e; }
.action-rename { background: #fed7aa; color: #9a3412; }
.action-delete { background: #fecaca; color: #991b1b; }
.action-move { background: #e0e7ff; color: #3730a3; }

.log-path { color: var(--dark); font-family: 'Courier New', monospace; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Pagination */
.pagination {
    display: flex; gap: 6px; margin-top: 16px; justify-content: center; flex-wrap: wrap;
}
.pagination button {
    padding: 10px 16px; border: 1px solid var(--border); background: white; border-radius: 4px;
    cursor: pointer; font-family: 'Play', sans-serif; font-size: 16px; transition: all 0.3s;
}
.pagination button:hover { background: var(--primary); color: white; border-color: var(--primary); }
.pagination button:disabled { background: var(--primary); color: white; border-color: var(--primary); }

/* Responsive */
@media (max-width: 768px) {
    .app-container { padding: 10px; }
    .admin-container { padding: 10px; }
    .header, .toolbar, .footer { border-radius: 12px; padding: 12px; }
    .header { flex-direction: column; }
    .header-left { justify-content: center; }
    .welcome-text { position: static; transform: none; }
    .file-header, .file-item { padding: 8px 12px; }
    .col-size { width: 70px; }
    .col-actions { width: 280px; }
    .admin-grid { grid-template-columns: 1fr; }
    .log-entry { grid-template-columns: 1fr; gap: 4px; }
    .scroll-top { right: 10px; bottom: 100px; }
}
