@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --secondary: #ec4899;
  --background: #0f172a;
  --surface: rgba(30, 41, 59, 0.7);
  --surface-solid: #1e293b;
  --surface-border: rgba(255, 255, 255, 0.1);
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --danger: #ef4444;
  --success: #10b981;
  --sidebar-width: 260px;
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--background);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  background-image: 
    radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%), 
    radial-gradient(at 50% 0%, hsla(225,39%,30%,0.3) 0, transparent 50%), 
    radial-gradient(at 100% 0%, hsla(339,49%,30%,0.3) 0, transparent 50%);
  background-attachment: fixed;
}

.glass-panel {
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--surface-border);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.p-6 { padding: 1.5rem; border-radius: 16px; }
.p-0 { padding: 0; border-radius: 16px; overflow: hidden; }

/* Auth View */
.container { min-height: 100vh; width: 100%; display: flex; align-items: center; justify-content: center; }
.auth-card { padding: 3rem; border-radius: 20px; width: 100%; max-width: 420px; text-align: center; }
.auth-tabs { display: flex; margin-bottom: 2rem; border-bottom: 1px solid var(--surface-border); }
.auth-tab { flex: 1; padding: 0.75rem; cursor: pointer; color: var(--text-muted); font-weight: 500; }
.auth-tab.active { color: var(--text); border-bottom: 2px solid var(--primary); }

/* App Layout */
#app-layout { display: flex; width: 100%; height: 100vh; overflow: hidden; }

/* Sidebar */
.sidebar { width: var(--sidebar-width); display: flex; flex-direction: column; border-right: 1px solid var(--surface-border); border-radius: 0; }
.sidebar-header { padding: 1.5rem; font-size: 1.25rem; font-weight: 700; border-bottom: 1px solid var(--surface-border); }
.sidebar-nav { flex: 1; padding: 1.5rem 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.nav-item { padding: 0.75rem 1rem; border-radius: 8px; cursor: pointer; color: var(--text-muted); font-weight: 500; display: flex; align-items: center; gap: 0.75rem; transition: all 0.2s; }
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.nav-item.active { background: var(--primary); color: white; }

.sidebar-footer { padding: 1.5rem 1rem; border-top: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: space-between; }
.user-info { display: flex; align-items: center; gap: 0.75rem; overflow: hidden; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--secondary)); display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.user-details { display: flex; flex-direction: column; overflow: hidden; }
.user-name { font-weight: 600; font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-badge { font-size: 0.65rem; background: rgba(255,255,255,0.2); padding: 2px 6px; border-radius: 4px; display: inline-block; width: max-content; margin-top: 2px; }
.footer-actions { display: flex; gap: 0.5rem; }

/* Main Content */
.main-content { flex: 1; padding: 2rem 3rem; overflow-y: auto; }
.section-header { margin-bottom: 2rem; }
.section-header h2 { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.5rem; }
.section-header p { color: var(--text-muted); }

/* Forms & Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 0.5rem 1rem; border-radius: 8px; font-weight: 500; cursor: pointer; border: none; font-size: 0.875rem; transition: 0.2s; gap: 0.5rem; }
.btn-icon { padding: 0.5rem; background: transparent; color: var(--text-muted); border: 1px solid transparent; }
.btn-icon:hover { color: var(--text); background: rgba(255,255,255,0.1); border-radius: 8px; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--surface-border); }
.btn-outline:hover { background: rgba(255, 255, 255, 0.05); }

.input { width: 100%; padding: 0.75rem 1rem; background: rgba(15, 23, 42, 0.5); border: 1px solid var(--surface-border); border-radius: 8px; color: var(--text); font-family: inherit; margin-bottom: 1rem; }
.input:focus { outline: none; border-color: var(--primary); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }

/* Upload Area */
.upload-area { border: 2px dashed var(--surface-border); border-radius: 16px; padding: 4rem 2rem; text-align: center; cursor: pointer; transition: 0.3s; margin-bottom: 2rem; background: rgba(30, 41, 59, 0.3); }
.upload-area:hover, .upload-area.dragover { border-color: var(--primary); background: rgba(99, 102, 241, 0.05); }
.upload-area input[type="file"] { display: none; }
.upload-icon { font-size: 3.5rem; margin-bottom: 1rem; color: var(--primary); opacity: 0.8; }

/* Tables */
.table-container { overflow-x: auto; width: 100%; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 1rem 1.5rem; border-bottom: 1px solid var(--surface-border); font-size: 0.875rem; }
th { font-weight: 600; color: var(--text-muted); background: rgba(0,0,0,0.2); }
tr { transition: background 0.2s; }
tr:hover { background: rgba(255, 255, 255, 0.03); }

/* File Explorer */
.breadcrumb { display: flex; gap: 0.5rem; align-items: center; background: rgba(0,0,0,0.2); padding: 0.5rem 1rem; border-radius: 8px; margin-top: 1rem; }
.crumb { cursor: pointer; color: var(--text-muted); transition: 0.2s; font-size: 0.875rem; }
.crumb:hover { color: var(--primary); }
.crumb::after { content: '>'; margin-left: 0.5rem; color: rgba(255,255,255,0.2); }
.crumb:last-child::after { display: none; }
.crumb:last-child { color: var(--text); font-weight: 500; cursor: default; }

.explorer-item { cursor: pointer; user-select: none; }
.item-icon { color: var(--primary); font-size: 1.25rem; margin-right: 1rem; vertical-align: middle; }
.item-name { font-weight: 500; vertical-align: middle; }

.search-bar { display: flex; gap: 0.5rem; }
.search-input { margin: 0; padding: 0.5rem 1rem; width: 180px; }

/* Utilities */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.error-msg { color: var(--danger); margin-bottom: 1rem; font-size: 0.875rem; }
.success-msg { color: var(--success); margin-bottom: 1rem; font-size: 0.875rem; }

/* Key Item */
.key-item { background: rgba(0,0,0,0.2); border: 1px solid var(--surface-border); padding: 1rem; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; }

/* Modal */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(15, 23, 42, 0.8); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; visibility: hidden; transition: 0.3s; }
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-content { width: 90%; max-width: 420px; padding: 2rem; transform: scale(0.95); transition: 0.3s; }
.modal-overlay.active .modal-content { transform: scale(1); }
.modal-title { font-size: 1.25rem; font-weight: 600; margin-bottom: 1rem; }
.modal-body { margin-bottom: 1.5rem; color: var(--text-muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 1rem; }

/* Loader */
.loader { border: 3px solid rgba(255, 255, 255, 0.1); border-radius: 50%; border-top: 3px solid var(--primary); width: 24px; height: 24px; animation: spin 1s linear infinite; margin: 0 auto; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Context Menu */
.context-menu {
  position: absolute;
  z-index: 2000;
  width: 180px;
  border-radius: 8px;
  padding: 0.5rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}
.context-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-radius: 6px;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: 0.2s;
}
.context-item:hover {
  background: var(--primary);
  color: white;
}
