/* ═══════════════════════════════════════════════════════════════
   SecureVault – Main Stylesheet
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset & base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0f172a;
  --surface:     #1e293b;
  --surface2:    #263244;
  --border:      #334155;
  --text:        #e2e8f0;
  --text-muted:  #94a3b8;
  --text-faint:  #64748b;
  --primary:     #3b82f6;
  --primary-h:   #2563eb;
  --danger:      #ef4444;
  --danger-h:    #dc2626;
  --success:     #10b981;
  --warning:     #f59e0b;
  --radius:      10px;
  --shadow:      0 4px 24px rgba(0,0,0,.35);
  --transition:  .18s ease;
  --sidebar-w:   220px;
  --navbar-h:    56px;
}

html { font-size: 15px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Utility ──────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ══════════════════════════════════════════════════════════════
   AUTH PAGE
══════════════════════════════════════════════════════════════ */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background: radial-gradient(ellipse at 60% 40%, #1e3a5f 0%, #0f172a 70%);
}

.auth-container { width: 100%; max-width: 420px; }

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow);
}

.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.auth-title {
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: .25rem;
  color: var(--text);
}

.auth-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: .9rem;
  margin-bottom: 1.75rem;
}

/* ══════════════════════════════════════════════════════════════
   FORMS
══════════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 1.2rem; }
.form-group label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: .4rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-control {
  width: 100%;
  padding: .65rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: .95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.25);
}
.form-control::placeholder { color: var(--text-faint); }

.password-wrapper { position: relative; }
.password-wrapper .form-control { padding-right: 2.8rem; }
.toggle-password {
  position: absolute;
  right: .75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
}
.toggle-password:hover { color: var(--text); }

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}
.form-row .form-group { flex: 1; min-width: 160px; margin-bottom: 0; }
.form-group-btn { flex: 0 0 auto; }

/* ══════════════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .6rem 1.2rem;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover  { background: var(--primary-h); }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover   { background: var(--danger-h); }
.btn-outline  { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover  { background: var(--surface2); border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-full { width: 100%; justify-content: center; padding: .75rem; font-size: 1rem; }

/* ══════════════════════════════════════════════════════════════
   ALERTS
══════════════════════════════════════════════════════════════ */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-size: .9rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}
.alert-error   { background: rgba(239,68,68,.15);  border: 1px solid rgba(239,68,68,.35);  color: #fca5a5; }
.alert-success { background: rgba(16,185,129,.15); border: 1px solid rgba(16,185,129,.35); color: #6ee7b7; }
.alert-warning { background: rgba(245,158,11,.15); border: 1px solid rgba(245,158,11,.35); color: #fde68a; }

/* ══════════════════════════════════════════════════════════════
   TOP NAVBAR
══════════════════════════════════════════════════════════════ */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--navbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  z-index: 100;
  box-shadow: 0 1px 8px rgba(0,0,0,.3);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-shrink: 0;
}
.brand-icon { width: 28px; height: 28px; }
.brand-name { font-size: 1.1rem; font-weight: 700; color: var(--text); }

.navbar-title { font-weight: 600; font-size: 1rem; flex: 1; }

.navbar-search { flex: 1; max-width: 480px; }
.search-box {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: .4rem 1rem;
  transition: border-color var(--transition);
}
.search-box:focus-within { border-color: var(--primary); }
.search-box svg { color: var(--text-faint); flex-shrink: 0; }
.search-box input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: .9rem;
  width: 100%;
}
.search-box input::placeholder { color: var(--text-faint); }

.navbar-user {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-left: auto;
  flex-shrink: 0;
}
.user-badge {
  font-size: .85rem;
  color: var(--text-muted);
  padding: .25rem .6rem;
  background: var(--surface2);
  border-radius: 20px;
  border: 1px solid var(--border);
}
.user-badge.admin { border-color: var(--warning); color: var(--warning); }

/* ══════════════════════════════════════════════════════════════
   DASHBOARD LAYOUT
══════════════════════════════════════════════════════════════ */
.dashboard-page { padding-top: var(--navbar-h); }

.layout {
  display: flex;
  min-height: calc(100vh - var(--navbar-h));
}

/* ── Sidebar ──────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0;
  flex-shrink: 0;
  position: sticky;
  top: var(--navbar-h);
  height: calc(100vh - var(--navbar-h));
  overflow-y: auto;
}

.sidebar-section { padding: .25rem 0 1rem; }
.sidebar-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-faint);
  padding: 0 1.25rem .5rem;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem 1.25rem;
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
  border-radius: 0;
}
.sidebar-item:hover,
.sidebar-item.active {
  background: var(--surface2);
  color: var(--text);
  text-decoration: none;
}
.sidebar-item.active { color: var(--primary); }

/* ── Main content ─────────────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: 1.5rem 2rem;
  overflow-x: hidden;
}

/* ── Breadcrumb ───────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .25rem;
  margin-bottom: 1.25rem;
  font-size: .85rem;
}
.breadcrumb-item { color: var(--text-muted); transition: color var(--transition); }
.breadcrumb-item:hover { color: var(--primary); text-decoration: none; }
.breadcrumb-sep { color: var(--text-faint); }

/* ── Toolbar ──────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.toolbar-title { font-size: 1.25rem; font-weight: 700; }
.toolbar-actions { display: flex; gap: .75rem; }

/* ── File grid ────────────────────────────────────────────────── */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.file-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  position: relative;
  cursor: default;
}
.file-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(59,130,246,.15);
  transform: translateY(-2px);
}

.file-card-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  flex: 1;
}
.file-card-link:hover { text-decoration: none; }

.file-card-inner {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  flex: 1;
}

.file-icon {
  font-size: 2.4rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 52px;
}
.folder-icon svg { filter: drop-shadow(0 2px 6px rgba(245,158,11,.4)); }

/* File type colors */
.icon-pdf    { color: #ef4444; }
.icon-word   { color: #3b82f6; }
.icon-excel  { color: #10b981; }
.icon-ppt    { color: #f97316; }
.icon-txt    { color: #94a3b8; }
.icon-img    { color: #8b5cf6; }
.icon-zip    { color: #f59e0b; }
.icon-audio  { color: #ec4899; }
.icon-video  { color: #06b6d4; }
.icon-generic{ color: #64748b; }

.file-name {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.file-meta {
  font-size: .75rem;
  color: var(--text-muted);
}
.file-uploader {
  font-size: .7rem;
  color: var(--text-faint);
}

.file-actions {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
  margin-top: .25rem;
  opacity: 0;
  transition: opacity var(--transition);
}
.file-card:hover .file-actions { opacity: 1; }

.action-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .2rem .4rem;
  font-size: .8rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: background var(--transition), border-color var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.action-btn:hover { background: var(--primary); border-color: var(--primary); color: #fff; text-decoration: none; }
.action-btn.danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ── Empty state ──────────────────────────────────────────────── */
.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 4rem 2rem;
  color: var(--text-faint);
  text-align: center;
}
.empty-state svg { opacity: .3; }
.empty-state p { font-size: 1rem; }
.empty-state div { display: flex; gap: .75rem; }

/* ══════════════════════════════════════════════════════════════
   MODALS
══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}
.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}
.modal-sm { max-width: 420px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem 0;
}
.modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: .25rem;
  border-radius: 6px;
  transition: background var(--transition);
}
.modal-close:hover { background: var(--surface2); color: var(--text); }

.modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
}

/* ── Drop zone ────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  margin-bottom: 1rem;
}
.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(59,130,246,.06);
}
.drop-zone svg { margin-bottom: .75rem; color: var(--text-faint); }
.drop-zone p { margin-bottom: .25rem; }
.drop-hint { font-size: .8rem; color: var(--text-faint); }
.link-label {
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
}

/* Upload queue */
#upload-queue { display: flex; flex-direction: column; gap: .5rem; }
.upload-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem .75rem;
  background: var(--bg);
  border-radius: 8px;
  font-size: .85rem;
}
.upload-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item-size { color: var(--text-muted); flex-shrink: 0; }
.upload-item-status { flex-shrink: 0; font-size: 1rem; }

/* Progress bar */
.progress-bar-wrap {
  height: 6px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: .5rem;
}
.progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  width: 0%;
  transition: width .2s ease;
}
#progress-text { font-size: .85rem; color: var(--text-muted); text-align: center; }

/* ══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
══════════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .85rem 1.25rem;
  border-radius: 10px;
  font-size: .9rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  z-index: 300;
  max-width: 320px;
  animation: slideUp .25s ease;
}
.toast[hidden] { display: none; }
.toast.success { border-color: var(--success); }
.toast.error   { border-color: var(--danger); }

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ══════════════════════════════════════════════════════════════
   MANAGE USERS PAGE
══════════════════════════════════════════════════════════════ */
.manage-users-page {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  margin-bottom: 1.75rem;
}
.card h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}

/* Table */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.data-table th {
  text-align: left;
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
}
.data-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }
.current-user td { background: rgba(59,130,246,.06); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .15rem .55rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.badge-blue { border-color: var(--primary); color: var(--primary); background: rgba(59,130,246,.1); }
.badge-gold { border-color: var(--warning); color: var(--warning); background: rgba(245,158,11,.1); }
.badge-gray { border-color: var(--border); color: var(--text-muted); }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { padding: 1rem; }
  .navbar-search { display: none; }
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .toolbar { flex-direction: column; align-items: flex-start; gap: .75rem; }
  .manage-users-page { margin: 1rem auto; }
}

@media (max-width: 480px) {
  .form-row { flex-direction: column; }
  .navbar { padding: 0 1rem; }
  .brand-name { display: none; }
}
