/* ==========================================================================
   TSP ADMIN PANEL - STYLES (INDUSTRIAL DARK & GOLD THEME)
   ========================================================================== */

:root {
  --admin-sidebar-w: 260px;
  --admin-bg: #0B0C10;
  --admin-surface: #14161D;
  --admin-surface-light: #1E212B;
  --admin-border: rgba(255, 255, 255, 0.08);
  --admin-border-focus: rgba(212, 175, 55, 0.4);
  --admin-text: #F1F3F5;
  --admin-text-muted: #8E95A5;
  --admin-gold: #D4AF37;
  --admin-gold-hover: #F3C644;
  --admin-accent: #3B82F6;
  --admin-success: #10B981;
  --admin-warning: #F59E0B;
  --admin-danger: #EF4444;
}

[data-theme="light"] {
  --admin-bg: #F1F5F9;
  --admin-surface: #FFFFFF;
  --admin-surface-light: #F8FAFC;
  --admin-border: #E2E8F0;
  --admin-border-focus: rgba(212, 175, 55, 0.6);
  --admin-text: #1E293B;
  --admin-text-muted: #64748B;
  --admin-gold: #D97706;
  --admin-gold-hover: #B45309;
}

[data-theme="light"] .admin-sidebar {
  background: #FFFFFF;
  border-right-color: #E2E8F0;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .admin-nav-header {
  color: #94A3B8;
}

[data-theme="light"] .admin-nav-item {
  color: #475569;
}

[data-theme="light"] .admin-nav-item:hover {
  color: #0F172A;
  background: #F1F5F9;
}

[data-theme="light"] .admin-nav-item.active {
  color: #FFFFFF;
  background: var(--admin-gold);
  font-weight: 700;
}

[data-theme="light"] .admin-nav-item.active i {
  color: #FFFFFF;
}

[data-theme="light"] .admin-user-footer {
  border-top-color: #E2E8F0;
}

[data-theme="light"] .admin-user-name {
  color: #0F172A;
}

[data-theme="light"] .admin-brand-title {
  color: #0F172A;
}

[data-theme="light"] .admin-header {
  background: #FFFFFF;
  border-bottom-color: #E2E8F0;
}

[data-theme="light"] .admin-header-title {
  color: #0F172A;
}

[data-theme="light"] .admin-card {
  background: #FFFFFF;
  border-color: #E2E8F0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

[data-theme="light"] .admin-card-title {
  color: #0F172A;
}

[data-theme="light"] .admin-metric-card {
  background: #FFFFFF;
  border-color: #E2E8F0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

[data-theme="light"] .admin-metric-info .value {
  color: #0F172A;
}

[data-theme="light"] .admin-table th {
  background: #F8FAFC;
  color: #64748B;
  border-bottom-color: #E2E8F0;
}

[data-theme="light"] .admin-table td {
  border-bottom-color: #E2E8F0;
  color: #1E293B;
}

[data-theme="light"] .admin-table tbody tr:hover {
  background: #F8FAFC;
}

[data-theme="light"] .admin-modal {
  background: #FFFFFF;
  border-color: #CBD5E1;
}

[data-theme="light"] .admin-modal-title {
  color: #0F172A;
}

[data-theme="light"] .admin-form-control {
  background: #F8FAFC;
  border-color: #CBD5E1;
  color: #0F172A;
}

[data-theme="light"] .admin-btn-outline {
  background: linear-gradient(180deg, #FFFFFF 0%, #F1F5F9 100%);
  border-color: #CBD5E1;
  color: #334155;
  box-shadow: 0 3px 0 #94A3B8, 0 4px 8px rgba(0, 0, 0, 0.05), inset 0 1px 0 #FFFFFF;
}

[data-theme="light"] .admin-btn-outline:hover {
  background: #FFFFFF;
  border-color: #94A3B8;
  color: #0F172A;
  transform: translateY(-1.5px);
  box-shadow: 0 4.5px 0 #94A3B8, 0 6px 12px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .admin-btn-outline:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #94A3B8, 0 2px 4px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .admin-btn-gold {
  background: linear-gradient(180deg, #FBBF24 0%, #F59E0B 60%, #D97706 100%);
  color: #291001;
  text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.55),
               0 1.5px 0 rgba(255, 251, 235, 0.85);
  box-shadow: 0 3px 0 #78350F, 0 5px 12px rgba(180, 83, 9, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

[data-theme="light"] .admin-btn-gold i,
[data-theme="light"] .admin-btn-gold svg {
  color: #291001;
  filter: drop-shadow(0 -1px 0.5px rgba(0, 0, 0, 0.45)) drop-shadow(0 1.5px 0 rgba(255, 251, 235, 0.8));
}

[data-theme="light"] .admin-btn-gold:hover {
  background: linear-gradient(180deg, #FCD34D 0%, #F59E0B 60%, #D97706 100%);
  color: #1F0B00;
  text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.6),
               0 1.5px 0 #FFFFFF;
  transform: translateY(-1.5px);
  box-shadow: 0 4.5px 0 #78350F, 0 8px 16px rgba(217, 119, 6, 0.35);
}

[data-theme="light"] .admin-btn-gold:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #78350F, 0 2px 4px rgba(0, 0, 0, 0.25);
}

.admin-layout {
  display: flex;
  min-height: 100vh;
  background-color: var(--admin-bg);
  background-image: var(--bg-texture);
  background-repeat: repeat;
  background-attachment: fixed;
  color: var(--admin-text);
  font-family: var(--font-body);
}

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

.admin-brand {
  padding: 1.5rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--admin-border);
}

.admin-brand img {
  height: 36px;
}

.admin-brand-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  color: #FFF;
  letter-spacing: 0.5px;
}

.admin-brand-badge {
  font-size: 0.65rem;
  background: var(--admin-gold);
  color: #000;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-weight: 800;
  margin-left: 0.35rem;
}

.admin-nav {
  flex: 1;
  padding: 1.25rem 0.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.admin-nav-header {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--admin-text-muted);
  font-weight: 700;
  padding: 0.75rem 0.75rem 0.35rem;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 0.85rem;
  color: var(--admin-text-muted);
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.admin-nav-item i {
  width: 18px;
  text-align: center;
  font-size: 1rem;
}

.admin-nav-item:hover {
  color: #FFFFFF !important;
  background: var(--admin-surface-light);
}

.admin-nav-item:hover i {
  color: var(--admin-gold) !important;
}

[data-theme="light"] .admin-nav-item:hover {
  color: #0F172A !important;
  background: #F1F5F9;
}

[data-theme="light"] .admin-nav-item:hover i {
  color: var(--admin-gold) !important;
}

.admin-nav-item.active {
  color: #0E0F12 !important;
  background: var(--admin-gold);
  font-weight: 700;
}

.admin-nav-item.active i {
  color: #0E0F12 !important;
}

[data-theme="light"] .admin-nav-item.active {
  color: #FFFFFF !important;
  background: var(--admin-gold);
  font-weight: 700;
}

[data-theme="light"] .admin-nav-item.active i {
  color: #FFFFFF !important;
}

.admin-nav-badge {
  margin-left: auto;
  font-size: 0.7rem;
  background: var(--admin-danger);
  color: #FFF;
  padding: 0.15rem 0.45rem;
  border-radius: 10px;
  font-weight: 700;
}

.admin-user-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow: hidden;
}

.admin-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--admin-gold);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
}

.admin-user-details {
  display: flex;
  flex-direction: column;
}

.admin-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #FFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-user-role {
  font-size: 0.72rem;
  color: var(--admin-text-muted);
}

/* Contenido Principal */
.admin-main {
  flex: 1;
  margin-left: var(--admin-sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-header {
  height: 68px;
  background: var(--admin-surface);
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 90;
}

.admin-header-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: #FFF;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-body {
  padding: 2rem;
  flex: 1;
}

/* Flash alerts */
.admin-alert {
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.92rem;
}

.admin-alert-success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34D399;
}

.admin-alert-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #F87171;
}

/* Metrics Cards */
.admin-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.admin-metric-card {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.admin-metric-card:hover {
  transform: translateY(-2px);
  border-color: var(--admin-border-focus);
}

.admin-metric-icon {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.icon-gold { background: rgba(212, 175, 55, 0.15); color: var(--admin-gold); }
.icon-blue { background: rgba(59, 130, 246, 0.15); color: var(--admin-accent); }
.icon-green { background: rgba(16, 185, 129, 0.15); color: var(--admin-success); }
.icon-red { background: rgba(239, 68, 68, 0.15); color: var(--admin-danger); }
.icon-amber { background: rgba(245, 158, 11, 0.15); color: var(--admin-warning); }

.admin-metric-info .label {
  font-size: 0.78rem;
  color: var(--admin-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.admin-metric-info .value {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: #FFF;
  margin-top: 0.2rem;
}

/* Cards & Tables */
.admin-card {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.admin-card-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: #FFF;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-table-wrapper {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--admin-border);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.admin-table th {
  background: var(--admin-surface-light);
  padding: 0.85rem 1rem;
  color: var(--admin-text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--admin-border);
}

.admin-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--admin-border);
  color: var(--admin-text);
  vertical-align: middle;
}

.admin-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.admin-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: #34D399; }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #FBBF24; }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: #F87171; }
.badge-info { background: rgba(59, 130, 246, 0.15); color: #60A5FA; }
.badge-neutral { background: rgba(255, 255, 255, 0.1); color: var(--admin-text-muted); }

/* Form Controls */
.admin-form-group {
  margin-bottom: 1.25rem;
}

.admin-form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--admin-text-muted);
  margin-bottom: 0.4rem;
}

.admin-form-control {
  width: 100%;
  background: var(--admin-surface-light);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: #FFF;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.admin-form-control:focus {
  outline: none;
  border-color: var(--admin-gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}

.admin-form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

/* Botones 3D Administrativos con Letra Hundida Profunda */
.admin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  border: none;
  transition: transform 0.12s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.12s cubic-bezier(0.4, 0, 0.2, 1),
              background 0.2s ease,
              color 0.2s ease,
              text-shadow 0.2s ease;
  text-decoration: none;
  user-select: none;
  position: relative;
  outline: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.admin-btn i,
.admin-btn svg {
  transition: filter 0.2s ease, color 0.2s ease;
}

.admin-btn:focus-visible {
  outline: 2px solid var(--admin-gold);
  outline-offset: 2px;
}

.admin-btn:disabled,
.admin-btn.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  transform: none !important;
  box-shadow: none !important;
}

.admin-btn-gold {
  background: linear-gradient(180deg, #E6C24B 0%, #D4AF37 60%, #BA951D 100%);
  color: #4A3200;
  text-shadow: 0 -1px 0 #1C1100,
               0 1px 0 #FFF066;
  box-shadow: 0 3px 0 #7A600B,
              0 4px 0 #3D2B00,
              0 5px 12px rgba(0, 0, 0, 0.3),
              inset 0 1.5px 1px rgba(255, 253, 210, 0.65),
              inset 0 -1.5px 1px rgba(122, 96, 11, 0.4);
}

.admin-btn-gold i,
.admin-btn-gold svg {
  color: #3D2800;
  filter: drop-shadow(0 1px 0 #FFF066);
}

.admin-btn-gold:hover {
  background: linear-gradient(180deg, #F3D261 0%, #E2BE45 60%, #C9A427 100%);
  color: #3D2800;
  text-shadow: 0 -1px 0 #140C00,
               0 1px 0 #FFF588;
  transform: translateY(-1.5px);
  box-shadow: 0 4.5px 0 #7A600B,
              0 5.5px 0 #3D2B00,
              0 8px 16px rgba(212, 175, 55, 0.35),
              inset 0 1.5px 1px rgba(255, 254, 225, 0.75);
}

.admin-btn-gold:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #7A600B, 0 2px 4px rgba(0, 0, 0, 0.35);
}

.admin-btn-outline {
  background: linear-gradient(180deg, #1D202A 0%, #14161D 100%);
  border: 1px solid var(--admin-border);
  color: var(--admin-text);
  box-shadow: 0 3px 0 #07080B, 0 4px 10px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.admin-btn-outline:hover {
  background: linear-gradient(180deg, #272B38 0%, #1A1D27 100%);
  border-color: rgba(255, 255, 255, 0.2);
  color: #FFF;
  transform: translateY(-1.5px);
  box-shadow: 0 4.5px 0 #07080B, 0 6px 12px rgba(0, 0, 0, 0.4);
}

.admin-btn-outline:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #07080B, 0 2px 4px rgba(0, 0, 0, 0.3);
}

.admin-btn-danger {
  background: linear-gradient(180deg, #F87171 0%, #EF4444 60%, #DC2626 100%);
  color: #2D0404;
  text-shadow: 0 1px 0 rgba(255, 200, 200, 0.55);
  box-shadow: 0 3px 0 #991B1B, 0 5px 12px rgba(239, 68, 68, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.admin-btn-danger i,
.admin-btn-danger svg {
  color: #2D0404;
  filter: none;
}

.admin-btn-danger:hover {
  background: linear-gradient(180deg, #FA8A8A 0%, #F15454 60%, #E11D48 100%);
  color: #1F0202;
  text-shadow: 0 1px 0 rgba(255, 215, 215, 0.65);
  transform: translateY(-1.5px);
  box-shadow: 0 4.5px 0 #991B1B, 0 8px 16px rgba(239, 68, 68, 0.35);
}

.admin-btn-danger:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #991B1B, 0 2px 4px rgba(0, 0, 0, 0.35);
}

.admin-btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  border-radius: 6px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
}

.admin-btn-gold.admin-btn-sm {
  box-shadow: 0 2px 0 #7A600B, 0 3px 6px rgba(0, 0, 0, 0.25);
}
.admin-btn-gold.admin-btn-sm:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 0 #7A600B, 0 5px 10px rgba(212, 175, 55, 0.3);
}
.admin-btn-gold.admin-btn-sm:active {
  transform: translateY(1.5px);
  box-shadow: 0 1px 0 #7A600B, 0 2px 3px rgba(0, 0, 0, 0.25);
}

.admin-btn-danger.admin-btn-sm {
  box-shadow: 0 2px 0 #991B1B, 0 3px 6px rgba(239, 68, 68, 0.2);
}
.admin-btn-danger.admin-btn-sm:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 0 #991B1B, 0 5px 10px rgba(239, 68, 68, 0.3);
}
.admin-btn-danger.admin-btn-sm:active {
  transform: translateY(1.5px);
  box-shadow: 0 1px 0 #991B1B, 0 2px 3px rgba(0, 0, 0, 0.2);
}

/* Modales */
.admin-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
}

.admin-modal-overlay.active {
  display: flex;
}

.admin-modal {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.admin-modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-modal-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: #FFF;
}

.admin-modal-close {
  background: none;
  border: none;
  color: var(--admin-text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.admin-modal-close:hover {
  color: #FFF;
}

.admin-modal-body {
  padding: 1.5rem;
}

.admin-modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--admin-border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

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

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

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