/* ═══════════════════════════════════════════════════════════════
   U-BETH ADMIN 2 — Design System & Bootstrap 5 Overrides
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  /* Brand — paleta oficial U-Beth (ver CHECKPOINT.md) */
  --brand-primary: #364A5C;
  --brand-orange: #DD8441;
  --brand-teal: #50B29D;
  --brand-purple: #8E44AD;
  --brand-green: #27AE60;
  --brand-red: #E74C3C;
  --brand-blue: #2980B9;

  /* Dark UI */
  --bg-page: #0F1117;
  --bg-sidebar: #161B27;
  --bg-card: #1E2433;
  --bg-card-hover: #252B3B;
  --bg-input: #252B3B;
  --border: #2D3548;
  --border-light: #3A4260;

  /* Text */
  --text-primary: #F0F2F7;
  --text-secondary: #8892A4;
  --text-hint: #5A6478;

  /* Accents */
  --accent: #DD8441;
  --accent-glow: rgba(221, 132, 65, 0.25);

  /* Semantic */
  --success: #27AE60;
  --warning: #F39C12;
  --error: #E74C3C;
  --info: #2980B9;

  /* Layout */
  --sidebar-width: 260px;
  --header-height: 68px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow-card: 0 4px 24px rgba(0,0,0,0.35);
  --shadow-hover: 0 8px 32px rgba(0,0,0,0.45);
}

/* Base resets & styles */
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-sidebar); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-hint); }

/* Sidebar Layout */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1000;
  transition: all 0.3s ease;
}

.main-area {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
}

/* Sidebar Components */
.sidebar-logo {
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}

.logo-img {
  height: 32px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.logo-sub {
  color: var(--text-secondary);
  font-size: 11px;
  display: block;
}

.env-badge {
  margin: 16px 24px;
  padding: 8px 12px;
  background: rgba(39, 174, 96, 0.1);
  border: 1px solid rgba(39, 174, 96, 0.2);
  border-radius: var(--radius-sm);
  color: var(--success);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.env-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.sidebar-nav {
  flex: 1;
  padding: 8px 16px;
  overflow-y: auto;
}

.nav-item-custom {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 4px;
  transition: all 0.2s ease;
  position: relative;
}

.nav-item-custom:hover {
  background-color: var(--bg-card-hover);
  color: var(--text-primary);
}

.nav-item-custom.active {
  background-color: rgba(230, 126, 34, 0.1);
  color: var(--accent);
  font-weight: 700;
}

.nav-item-custom.active::after {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  background-color: var(--accent);
  border-radius: 0 4px 4px 0;
}

.nav-icon-custom {
  margin-right: 12px;
  font-size: 20px;
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-custom {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--brand-purple));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

.footer-info {
  display: flex;
  flex-direction: column;
}

.footer-name {
  color: var(--text-primary);
  font-weight: 700;
  font-size: 13px;
}

.footer-role {
  color: var(--text-hint);
  font-size: 11px;
}

/* Main Content Components */
.header-area {
  height: var(--header-height);
  border-bottom: 1px solid var(--border);
  background-color: var(--bg-sidebar);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-title-section h1 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
}

.header-title-section p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 2px 0 0 0;
}

.page-content-custom {
  padding: 32px;
  flex: 1;
}

/* Material & Bootstrap overrides */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
  overflow: hidden;
}

.card-header {
  background-color: transparent;
  border-bottom: 1px solid var(--border);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.card-body {
  padding: 24px;
  color: var(--text-secondary);
}

/* Stats Grid & Cards */
.stat-card-custom {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-card);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
}

.stat-card-custom::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.stat-card-custom.orange::before { background: linear-gradient(90deg, var(--accent), #F39C12); }
.stat-card-custom.teal::before   { background: linear-gradient(90deg, var(--brand-teal), #2ECC71); }
.stat-card-custom.purple::before { background: linear-gradient(90deg, var(--brand-purple), #9B59B6); }
.stat-card-custom.blue::before   { background: linear-gradient(90deg, var(--brand-blue), #3498DB); }
.stat-card-custom.green::before  { background: linear-gradient(90deg, var(--success), #2ECC71); }
.stat-card-custom.red::before    { background: linear-gradient(90deg, var(--error), #E74C3C); }

.stat-card-custom:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border-light);
}

.stat-icon-custom {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 42px;
  opacity: 0.15;
  color: var(--text-secondary);
}

.stat-label-custom {
  font-size: 11px;
  color: var(--text-hint);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

.stat-value-custom {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.stat-sub-custom {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Badges */
.badge-custom {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.badge-success-custom { background: rgba(39,174,96,0.15); color: var(--success); }
.badge-warning-custom { background: rgba(243,156,18,0.15); color: var(--warning); }
.badge-error-custom   { background: rgba(231,76,60,0.15);  color: var(--error); }
.badge-info-custom    { background: rgba(41,128,185,0.15);  color: var(--info); }
.badge-purple-custom  { background: rgba(142,68,173,0.15);  color: var(--brand-purple); }
.badge-teal-custom    { background: rgba(26,188,156,0.15);  color: var(--brand-teal); }

/* Table overrides */
.table-custom {
  width: 100%;
  margin-bottom: 0;
  color: var(--text-secondary);
  border-collapse: collapse;
}

.table-custom thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-hint);
  border-bottom: 1px solid var(--border);
  background-color: transparent;
}

.table-custom tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  background-color: transparent;
  vertical-align: middle;
}

.table-custom tbody tr {
  transition: background 0.15s;
}

.table-custom tbody tr:hover {
  background-color: var(--bg-card-hover);
}

.table-custom tbody tr:last-child td {
  border-bottom: none;
}

.table-custom td.primary-cell {
  color: var(--text-primary);
  font-weight: 600;
}

/* Inputs & Form Controls */
.form-control, .form-select {
  background-color: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary) !important;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.form-control:focus, .form-select:focus {
  background-color: var(--bg-input);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  outline: none;
}

/* Search bar styling */
.search-bar-custom {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  max-width: 360px;
  width: 100%;
}

.search-bar-custom span {
  color: var(--text-secondary);
}

.search-bar-custom input {
  border: none;
  background: none;
  padding: 10px 0;
  width: 100%;
  color: var(--text-primary);
  outline: none;
}

/* Buttons */
.btn-primary-custom {
  background: linear-gradient(135deg, var(--accent) 0%, #D35400 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-primary-custom:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(230,126,34,0.4);
  color: #fff;
}

.btn-secondary-custom {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-secondary-custom:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--border-light);
  color: var(--text-primary);
}

.btn-icon-custom {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-icon-custom:hover {
  color: var(--text-primary);
  border-color: var(--border-light);
}

/* Filter chips */
.filter-row-custom {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-chip-custom {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.filter-chip-custom.active, .filter-chip-custom:hover {
  background-color: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Material-like Ripple effect */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: scale(0);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Responsive sidebar */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.active {
    transform: translateX(0);
  }
  .main-area {
    margin-left: 0;
  }
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0,0,0,0.5);
  z-index: 999;
}

.sidebar-overlay.active {
  display: block;
}

/* Hamburger toggle */
.menu-toggle {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 24px;
  cursor: pointer;
  display: none;
}

@media (max-width: 991.98px) {
  .menu-toggle {
    display: block;
  }
}
