/* FileRepo Admin Panel — estilos globales */

:root {
  --sidebar-width: 240px;
  --brand-color: #0d6efd;
}

body {
  min-height: 100vh;
  background-color: #f8f9fa;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: #212529;
  color: #adb5bd;
  display: flex;
  flex-direction: column;
  padding-top: 0;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1rem;
  background: #fff;
  text-decoration: none;
  border-bottom: 1px solid #dee2e6;
}

.sidebar-logo {
  height: 44px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
}

.sidebar .brand span.badge {
  font-size: 0.65rem;
  vertical-align: middle;
}

.sidebar .nav {
  flex: 1;
  padding: 1rem 0;
}

.sidebar .nav-link {
  color: #adb5bd;
  padding: 0.55rem 1.25rem;
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.sidebar .nav-link svg {
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.85rem;
}

.main-content {
  flex: 1;
  overflow-x: auto;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid #dee2e6;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-content {
  padding: 2rem 1.5rem;
  flex: 1;
}

/* ── Tarjetas stats ───────────────────────────────────────────────────────── */
.stat-card {
  border-radius: 12px;
  border: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  transition: transform 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-card .card-body {
  padding: 1.5rem;
}

.stat-card .stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.stat-card .stat-label {
  font-size: 0.85rem;
  color: #6c757d;
  margin-top: 0.25rem;
}

/* ── Tablas ───────────────────────────────────────────────────────────────── */
.table-container {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  overflow: hidden;
}

.table-container .table {
  margin-bottom: 0;
}

.table thead th {
  background: #f8f9fa;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #6c757d;
  border-bottom: 2px solid #dee2e6;
  white-space: nowrap;
}

.table td {
  vertical-align: middle;
}

.url-cell {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Chips de tipos de fichero ─────────────────────────────────────────────── */
.type-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.type-chip {
  background: #e9ecef;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.78rem;
  cursor: default;
}

/* ── Formulario chips de tipos ────────────────────────────────────────────── */
.chips-input-container {
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 6px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  cursor: text;
  background: #fff;
  transition: border-color 0.15s;
}

.chips-input-container:focus-within {
  border-color: var(--brand-color);
  box-shadow: 0 0 0 0.25rem rgba(13,110,253,0.25);
}

.chips-input-container .chip {
  background: #0d6efd;
  color: #fff;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chips-input-container .chip .remove-chip {
  cursor: pointer;
  opacity: 0.8;
  line-height: 1;
}

.chips-input-container .chip .remove-chip:hover {
  opacity: 1;
}

.chips-input-container input {
  border: none;
  outline: none;
  flex: 1;
  min-width: 80px;
  font-size: 0.9rem;
  padding: 2px 0;
}

/* ── API key display ──────────────────────────────────────────────────────── */
.apikey-display {
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.85rem;
  background: #f1f3f5;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 0.75rem;
  word-break: break-all;
  letter-spacing: 0.02em;
}

/* ── Loading spinner ──────────────────────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* ── Paginación ───────────────────────────────────────────────────────────── */
.pagination-info {
  font-size: 0.85rem;
  color: #6c757d;
}

/* ── Login page ───────────────────────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  border: none;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-card .card-body {
  padding: 2.5rem;
}

.login-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.login-brand h1 {
  font-size: 1.75rem;
  font-weight: 800;
  color: #212529;
  margin-bottom: 0.25rem;
}

.login-brand p {
  color: #6c757d;
  font-size: 0.9rem;
}

/* ── Imagen preview ───────────────────────────────────────────────────────── */
.preview-img {
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: 8px;
}

/* ── Badge de estado ──────────────────────────────────────────────────────── */
.badge-active {
  background-color: #198754;
}

.badge-inactive {
  background-color: #6c757d;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    width: 64px;
    min-width: 64px;
  }

  .sidebar .nav-link span,
  .sidebar .brand span,
  .sidebar-footer {
    display: none;
  }

  .sidebar .brand {
    justify-content: center;
    padding: 0.5rem;
  }

  .sidebar-logo {
    height: 32px;
  }

  .sidebar .nav-link {
    justify-content: center;
    padding: 0.75rem;
  }
}
