/* ═══════════════════════════════════════════════════════════════════════════
   Data Manager – Admin Panel CSS
   ═══════════════════════════════════════════════════════════════════════════ */

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

:root {
  --sidebar-width: 260px;
  --sidebar-bg: #0f1117;
  --sidebar-border: #1e2230;
  --sidebar-text: #8892a4;
  --sidebar-active-bg: rgba(99, 102, 241, 0.15);
  --sidebar-active-text: #818cf8;
  --sidebar-active-border: #6366f1;
  --topbar-bg: #13151e;
  --topbar-border: #1e2230;
  --body-bg: #0a0c12;
  --card-bg: #13151e;
  --card-border: #1e2230;
  --card-hover: #181c27;
  --text-primary: #e2e8f0;
  --text-secondary: #8892a4;
  --text-muted: #4b5568;
  --accent: #6366f1;
  --accent-hover: #4f52d4;
  --accent-glow: rgba(99, 102, 241, 0.3);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.1);
  --folder-color: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --transition: 0.2s ease;
}

/* ── Light / Day Mode ────────────────────────────────────────────────────── */
:root.light-mode {
  --sidebar-bg: #ffffff;
  --sidebar-border: #e5e7eb;
  --sidebar-text: #6b7280;
  --sidebar-active-bg: rgba(99, 102, 241, 0.1);
  --sidebar-active-text: #4f46e5;
  --sidebar-active-border: #6366f1;
  --topbar-bg: #ffffff;
  --topbar-border: #e5e7eb;
  --body-bg: #f3f4f6;
  --card-bg: #ffffff;
  --card-border: #e5e7eb;
  --card-hover: #f9fafb;
  --text-primary: #111827;
  --text-secondary: #4b5568;
  --text-muted: #9ca3af;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.2);
  --success: #059669;
  --success-bg: rgba(5, 150, 105, 0.08);
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.08);
  --warning: #d97706;
  --warning-bg: rgba(217, 119, 6, 0.08);
  --info: #2563eb;
  --info-bg: rgba(37, 99, 235, 0.08);
  --folder-color: #d97706;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

/* Smooth theme transition */
body,
.admin-sidebar,
.admin-topbar,
.admin-content,
.card,
.btn,
.theme-switch,
.alert,
.modal-content,
.table {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

/* ── Theme Toggle Button ─────────────────────────────────────────────────── */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 2px;
  outline: none;
  flex-shrink: 0;
}

.theme-toggle-btn .theme-icon {
  font-size: 13px;
  transition: color 0.2s ease;
}

#themeSunIcon {
  color: #f59e0b;
}

#themeMoonIcon {
  color: #818cf8;
}

/* Track (the pill) */
.toggle-track {
  position: relative;
  width: 42px;
  height: 22px;
  background: var(--sidebar-border);
  border-radius: 11px;
  border: 1px solid var(--card-border);
  transition: background 0.25s ease, border-color 0.25s ease;
  flex-shrink: 0;
}

/* Thumb (the sliding dot) */
.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #818cf8;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s ease;
}

/* Light mode overrides */
:root.light-mode .toggle-track {
  background: #dbeafe;
  border-color: #93c5fd;
}

:root.light-mode .toggle-thumb {
  background: #f59e0b;
}

.theme-toggle-btn:hover .toggle-track {
  border-color: var(--accent);
}

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

html,
body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--body-bg);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
.admin-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.sidebar-logo-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.sidebar-logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 12px 8px 6px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 2px;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.sidebar-nav a.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  border-left-color: var(--sidebar-active-border);
}

.sidebar-nav a i {
  width: 18px;
  text-align: center;
  font-size: 14px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-footer form button {
  width: 100%;
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.sidebar-footer form button:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
}

/* ── Main content ─────────────────────────────────────────────────────────── */
.admin-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.admin-topbar {
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.topbar-avatar {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

/* ── Page content ─────────────────────────────────────────────────────────── */
.admin-content {
  padding: 28px;
  flex: 1;
}

/* ── Alerts / Flash messages ─────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.alert-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.alert-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.alert-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.alert-info {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid rgba(59, 130, 246, 0.25);
}

/* ── Breadcrumb ───────────────────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

.breadcrumb a:hover {
  color: #a5b4fc;
}

.breadcrumb span {
  color: var(--text-muted);
}

.breadcrumb .bc-current {
  color: var(--text-primary);
  font-weight: 500;
}

/* ── Toolbar ──────────────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.toolbar-left {
  font-size: 13px;
  color: var(--text-secondary);
}

.toolbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid var(--card-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
  background: rgba(16, 185, 129, 0.25);
}

.btn-info {
  background: rgba(59, 130, 246, 0.15);
  color: var(--info);
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.btn-info:hover {
  background: rgba(59, 130, 246, 0.25);
}


.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}


/* ── File Manager Grid ────────────────────────────────────────────────────── */
.fm-table-wrap {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

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

.fm-table thead th {
  background: rgba(255, 255, 255, 0.03);
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--card-border);
}

.fm-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background var(--transition);
}

.fm-table tbody tr:last-child {
  border-bottom: none;
}

.fm-table tbody tr:hover {
  background: var(--card-hover);
}

.fm-table td {
  padding: 12px 16px;
  vertical-align: middle;
  font-size: 13.5px;
  color: var(--text-secondary);
}

.fm-name-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.fm-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.fm-icon-folder {
  background: rgba(245, 158, 11, 0.15);
  color: var(--folder-color);
}

.fm-icon-file {
  background: rgba(99, 102, 241, 0.12);
}

.fm-name-text {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 14px;
}

.fm-name-link {
  text-decoration: none;
  color: var(--text-primary);
  transition: color var(--transition);
}

.fm-name-link:hover {
  color: var(--accent);
}

.fm-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.fm-badge-folder {
  background: rgba(245, 158, 11, 0.12);
  color: var(--folder-color);
}

.fm-actions {
  display: flex;
  gap: 6px;
}

/* ── Empty state ──────────────────────────────────────────────────────────── */
.fm-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.fm-empty i {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
  opacity: 0.4;
}

.fm-empty p {
  font-size: 15px;
}

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.open {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-box {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  animation: scaleIn 0.25s ease;
}

@keyframes scaleIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  transition: color var(--transition);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 20px 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--card-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Form elements ────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: var(--body-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ── Upload drop zone ─────────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--card-border);
  border-radius: var(--radius-sm);
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-muted);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--sidebar-active-bg);
  color: var(--accent);
}

.drop-zone i {
  font-size: 28px;
  margin-bottom: 8px;
  display: block;
}

.drop-zone p {
  font-size: 13px;
}

.drop-zone input {
  display: none;
}

/* ── Login page ───────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: var(--body-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.06) 0%, transparent 50%);
}

.login-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px var(--accent-glow);
}

.login-logo h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.login-logo p {
  font-size: 13px;
  color: var(--text-muted);
}

.login-btn {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 16px var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.login-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.error-text {
  color: var(--danger);
  font-size: 12.5px;
  margin-top: 4px;
}

/* ── Stats bar ────────────────────────────────────────────────────────────── */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.stat-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }

  .admin-sidebar.open {
    transform: translateX(0);
  }

  .admin-main {
    margin-left: 0;
  }

  .admin-content {
    padding: 16px;
  }

  .fm-table thead th:nth-child(3),
  .fm-table tbody td:nth-child(3),
  .fm-table thead th:nth-child(4),
  .fm-table tbody td:nth-child(4) {
    display: none;
  }
}