/* ===== Base ===== */
body {
  background-color: #0d1117;
  color: #c9d1d9;
}

/* ===== Login Page ===== */
.login-page {
  background: radial-gradient(ellipse at top, #161b22 0%, #0d1117 70%);
}

.login-logo-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #238636, #1f6feb);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #fff;
}

.login-page .card {
  background-color: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
}

/* ===== Navbar ===== */
.nav-main {
  background: linear-gradient(180deg, #161b22 0%, #0d1117 100%);
  border-bottom: 1px solid #21262d;
  padding: 0.5rem 0;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: #f0f6fc !important;
  margin-right: 1.5rem;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #238636, #1f6feb);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  color: #fff;
  box-shadow: 0 2px 8px rgba(31, 111, 235, 0.3);
}

/* Tabs de navegacion */
.nav-tabs-custom .nav-link {
  color: #8b949e !important;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  margin: 0 2px;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  position: relative;
}

.nav-tabs-custom .nav-link:hover {
  color: #c9d1d9 !important;
  background-color: #21262d;
}

.nav-tabs-custom .nav-link.active {
  color: #f0f6fc !important;
  background-color: #1f6feb;
  border-color: #1f6feb;
  box-shadow: 0 2px 8px rgba(31, 111, 235, 0.35);
}

.nav-tabs-custom .nav-link.active i {
  color: #f0f6fc;
}

/* Avatar y usuario */
.avatar-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #21262d, #30363d);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: #8b949e;
  border: 1px solid #30363d;
  transition: all 0.2s;
}

.nav-user-link {
  color: #8b949e !important;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  font-size: 0.88rem;
  transition: all 0.2s;
}

.nav-user-link:hover {
  color: #c9d1d9 !important;
  background-color: #21262d;
}

.nav-user-link.active {
  color: #f0f6fc !important;
  background-color: rgba(31, 111, 235, 0.15);
  border: 1px solid rgba(31, 111, 235, 0.3);
}

.nav-user-link.active .avatar-circle {
  background: linear-gradient(135deg, #238636, #1f6feb);
  color: #fff;
  border-color: transparent;
}

/* Boton salir */
.btn-logout {
  color: #8b949e;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  transition: all 0.2s;
}

.btn-logout:hover {
  color: #f85149;
  border-color: #f85149;
  background-color: rgba(248, 81, 73, 0.1);
}

/* Legacy compat */
.nav-link {
  color: #8b949e !important;
  transition: color 0.2s;
}

.nav-link:hover {
  color: #c9d1d9 !important;
}

/* ===== Cards ===== */
.card {
  background-color: #161b22;
  border: 1px solid #21262d;
  border-radius: 10px;
}

.card-header {
  background-color: #161b22;
  border-color: #21262d;
}

.card-footer {
  background-color: #161b22;
  border-color: #21262d;
}

/* ===== Forms ===== */
.form-control,
.form-select {
  background-color: #0d1117;
  border-color: #30363d;
  color: #c9d1d9;
}

.form-control:focus,
.form-select:focus {
  background-color: #0d1117;
  border-color: #1f6feb;
  color: #c9d1d9;
  box-shadow: 0 0 0 0.2rem rgba(31, 111, 235, 0.2);
}

.form-control::placeholder {
  color: #484f58;
}

.input-group-text {
  background-color: #21262d;
  border-color: #30363d;
  color: #8b949e;
}

/* ===== Tables ===== */
.table {
  --bs-table-bg: #161b22;
  --bs-table-color: #c9d1d9;
  --bs-table-hover-bg: #1c2128;
  --bs-table-hover-color: #c9d1d9;
  --bs-table-border-color: #21262d;
  border-color: #21262d;
}

.table thead th {
  background-color: #0d1117;
  color: #8b949e;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
  border-bottom: 2px solid #21262d;
}

.table td {
  font-size: 0.85rem;
  white-space: nowrap;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  border-color: #21262d;
  padding: 0.5rem 0.75rem;
}

.table td.cell-value:hover {
  white-space: normal;
  overflow: visible;
  background-color: #1c2128;
  color: #58a6ff;
  cursor: pointer;
  position: relative;
  z-index: 2;
}

.results-table {
  max-height: 75vh;
  overflow: auto;
}

/* Tabla usa todo el ancho disponible */
.results-table .table {
  width: 100%;
  table-layout: auto;
}

/* ===== Buttons ===== */
.btn-primary {
  background-color: #238636;
  border-color: #238636;
}

.btn-primary:hover {
  background-color: #2ea043;
  border-color: #2ea043;
}

.btn-outline-light {
  border-color: #30363d;
  color: #c9d1d9;
}

.btn-outline-light:hover {
  background-color: #21262d;
  border-color: #30363d;
  color: #fff;
}

.btn-outline-primary {
  border-color: #1f6feb;
  color: #58a6ff;
}

.btn-outline-primary:hover {
  background-color: #1f6feb;
  border-color: #1f6feb;
  color: #fff;
}

.btn-outline-secondary {
  border-color: #30363d;
  color: #8b949e;
}

.btn-outline-secondary:hover {
  background-color: #21262d;
  border-color: #30363d;
  color: #c9d1d9;
}

/* ===== Copy feedback ===== */
.copy-row-btn.copied {
  color: #3fb950 !important;
  border-color: #238636 !important;
}

/* ===== Badges ===== */
.badge {
  font-weight: 500;
}

.bg-primary {
  background-color: #1f6feb !important;
}

.bg-purple {
  background-color: #8957e5 !important;
  color: #fff;
}

/* ===== Alerts ===== */
.alert-danger {
  background-color: #3d1f28;
  border-color: #6e3630;
  color: #f85149;
}

.alert-success {
  background-color: #1b3a2d;
  border-color: #26553d;
  color: #3fb950;
}

/* ===== Pagination ===== */
.page-link {
  background-color: #0d1117;
  border-color: #30363d;
  color: #58a6ff;
}

.page-link:hover {
  background-color: #161b22;
  border-color: #30363d;
  color: #79c0ff;
}

.page-item.active .page-link {
  background-color: #1f6feb;
  border-color: #1f6feb;
}

.page-item.disabled .page-link {
  background-color: #0d1117;
  border-color: #21262d;
  color: #484f58;
}

/* ===== Modal ===== */
.modal-content {
  background-color: #161b22;
  border: 1px solid #30363d;
}

.modal-header,
.modal-footer {
  border-color: #21262d;
}

/* ===== Footer ===== */
footer {
  border-color: #21262d !important;
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
}

.copy-toast {
  background: #238636;
  color: white;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 0.9rem;
  display: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.3s ease;
}

.copy-toast.show {
  display: block;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #0d1117;
}

::-webkit-scrollbar-thumb {
  background: #30363d;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #484f58;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .table td, .table th {
    font-size: 0.75rem;
  }
}
