/* ============================================
   BackupStack — Admin Dashboard Styles
   Dark mode admin theme with modern aesthetics
   ============================================ */

/* ── Base ── */
:root {
  --bs-body-bg: #0f1117;
  --bs-body-color: #e1e4e8;
  --sidebar-width: 260px;
  --sidebar-bg: linear-gradient(180deg, #161b22 0%, #0d1117 100%);
  --card-bg: rgba(22, 27, 34, 0.8);
  --card-border: rgba(48, 54, 61, 0.6);
  --accent-gradient: linear-gradient(135deg, #7c3aed 0%, #2563eb 50%, #06b6d4 100%);
  --navbar-bg: rgba(13, 17, 23, 0.85);
  --hover-bg: rgba(56, 189, 248, 0.08);
  --transition-speed: 0.25s;
}

* {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
  overflow-x: hidden;
}

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

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-speed) ease;
}

.content-area {
  flex: 1;
  padding: 24px 28px;
}

/* ── Auth Layout Overrides ── */
.auth-wrapper {
  justify-content: center;
  align-items: center;
}

.auth-wrapper .main-content {
  margin-left: 0;
  flex: none;
  width: 100%;
  max-width: 450px;
  min-height: auto;
}

.auth-wrapper .content-area {
  padding: 16px;
}

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

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

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.sidebar-brand i {
  font-size: 1.5rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: #8b949e;
  font-size: 1.2rem;
  cursor: pointer;
}

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

.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-item .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: #8b949e;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all var(--transition-speed) ease;
}

.nav-item .nav-link:hover {
  color: #e1e4e8;
  background: var(--hover-bg);
  border-left-color: rgba(56, 189, 248, 0.3);
}

.nav-item .nav-link.active {
  color: #58a6ff;
  background: rgba(56, 189, 248, 0.1);
  border-left-color: #58a6ff;
}

.nav-item .nav-link i {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
}

.nav-divider {
  height: 1px;
  background: var(--card-border);
  margin: 12px 20px;
}

.nav-heading {
  padding: 8px 20px 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #484f58;
}

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

.sidebar-footer-content {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #484f58;
  font-size: 0.8rem;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1040;
  backdrop-filter: blur(4px);
}

/* ── Top Navbar ── */
.top-navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  background: var(--navbar-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  z-index: 1020;
}

.page-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0;
  color: #fff;
  letter-spacing: -0.01em;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Cards ── */
.glass-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  backdrop-filter: blur(12px);
  transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.glass-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.glass-card .card-header {
  background: rgba(22, 27, 34, 0.5);
  border-bottom: 1px solid var(--card-border);
  padding: 16px 20px;
  border-radius: 12px 12px 0 0;
}

.glass-card .card-body {
  padding: 20px;
}

.glass-card .card-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: #fff;
}

/* ── Stat Cards ── */
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  backdrop-filter: blur(12px);
  transition: all var(--transition-speed) ease;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  border-color: rgba(88, 166, 255, 0.3);
}

.stat-card-body {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.78rem;
  color: #8b949e;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

/* ── Profile Cards ── */
.profile-card {
  transition: all var(--transition-speed) ease;
}

.profile-card:hover {
  border-color: rgba(88, 166, 255, 0.4);
}

.profile-details {
  background: rgba(13, 17, 23, 0.4);
  border-radius: 8px;
  padding: 12px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.85rem;
}

.detail-row + .detail-row {
  border-top: 1px solid rgba(48, 54, 61, 0.4);
}

.detail-label {
  color: #8b949e;
}

.detail-value {
  color: #e1e4e8;
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 0.82rem;
}

/* ── Schedule List ── */
.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.schedule-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: rgba(13, 17, 23, 0.4);
  border-radius: 8px;
  border: 1px solid rgba(48, 54, 61, 0.3);
  transition: border-color var(--transition-speed) ease;
}

.schedule-item:hover {
  border-color: rgba(88, 166, 255, 0.3);
}

.schedule-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff;
}

.schedule-time {
  font-size: 0.82rem;
}

.schedule-next {
  font-size: 0.75rem;
}

/* ── Tables ── */
.table {
  --bs-table-bg: transparent;
  --bs-table-color: #e1e4e8;
  --bs-table-border-color: var(--card-border);
  --bs-table-hover-bg: var(--hover-bg);
  font-size: 0.88rem;
}

.table thead th {
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8b949e;
  border-bottom-width: 1px;
  padding: 12px 16px;
  white-space: nowrap;
}

.table tbody td {
  padding: 12px 16px;
  vertical-align: middle;
}

/* ── Badges ── */
.badge {
  font-weight: 500;
  font-size: 0.75rem;
  padding: 5px 10px;
  border-radius: 6px;
}

/* ── Connection Icon ── */
.connection-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  font-size: 2.5rem;
}

.connection-icon.connected {
  background: rgba(35, 134, 54, 0.15);
  color: #3fb950;
  border: 2px solid rgba(35, 134, 54, 0.3);
}

.connection-icon.disconnected {
  background: rgba(139, 148, 158, 0.1);
  color: #8b949e;
  border: 2px solid rgba(139, 148, 158, 0.2);
}

/* ── Log Viewer ── */
.log-viewer {
  background: #010409;
  color: #8b949e;
  padding: 16px 20px;
  margin: 0;
  border-radius: 0 0 12px 12px;
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 0.8rem;
  line-height: 1.7;
  max-height: 600px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ── Forms ── */
.form-control,
.form-select {
  background: rgba(13, 17, 23, 0.6);
  border-color: var(--card-border);
  color: #e1e4e8;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.9rem;
  transition: border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.form-control:focus,
.form-select:focus {
  background: rgba(13, 17, 23, 0.8);
  border-color: #58a6ff;
  color: #e1e4e8;
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

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

.form-label {
  font-size: 0.85rem;
  color: #c9d1d9;
  margin-bottom: 6px;
}

.form-text {
  font-size: 0.78rem;
  color: #6e7681;
}

.form-check-input {
  background-color: rgba(48, 54, 61, 0.6);
  border-color: var(--card-border);
}

.form-check-input:checked {
  background-color: #238636;
  border-color: #238636;
}

.form-check-input:focus {
  box-shadow: 0 0 0 3px rgba(35, 134, 54, 0.2);
}

/* ── Buttons ── */
.btn {
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: 8px;
  padding: 8px 16px;
  transition: all var(--transition-speed) ease;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  border: none;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
  transform: translateY(-1px);
}

.btn-outline-light {
  border-color: var(--card-border);
  color: #8b949e;
}

.btn-outline-light:hover {
  background: var(--hover-bg);
  border-color: rgba(88, 166, 255, 0.4);
  color: #e1e4e8;
}

.btn-success {
  background: #238636;
  border-color: #238636;
}

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

/* ── Flash Alerts ── */
.flash-alert {
  border-radius: 10px;
  font-size: 0.88rem;
  animation: slideIn 0.3s ease;
  border: none;
}

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

/* ── Nav Pills ── */
.nav-pills .nav-link {
  color: #8b949e;
  border-radius: 8px;
  font-size: 0.88rem;
  padding: 8px 16px;
}

.nav-pills .nav-link.active {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
}

/* ── Footer ── */
.app-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--card-border);
  text-align: center;
}

.footer-content {
  font-size: 0.8rem;
  color: #484f58;
}

/* ── Spinner Animation ── */
.spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ── Alerts ── */
.alert-success {
  background: rgba(35, 134, 54, 0.15);
  color: #3fb950;
}

.alert-danger {
  background: rgba(248, 81, 73, 0.15);
  color: #f85149;
}

.alert-warning {
  background: rgba(210, 153, 34, 0.15);
  color: #d29922;
}

.alert-info {
  background: rgba(56, 189, 248, 0.1);
  color: #58a6ff;
}

/* ── Pagination ── */
.pagination .page-link {
  background: var(--card-bg);
  border-color: var(--card-border);
  color: #8b949e;
}

.pagination .page-item.active .page-link {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  border-color: transparent;
}

.pagination .page-link:hover {
  background: var(--hover-bg);
  border-color: rgba(88, 166, 255, 0.4);
  color: #e1e4e8;
}

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

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

::-webkit-scrollbar-thumb {
  background: rgba(139, 148, 158, 0.3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 148, 158, 0.5);
}

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

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

  .sidebar.open + .sidebar-overlay {
    display: block;
  }

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

  .content-area {
    padding: 16px;
  }

  .top-navbar {
    padding: 12px 16px;
  }
}

@media (max-width: 575.98px) {
  .stat-card-body {
    padding: 16px;
  }

  .stat-value {
    font-size: 1.25rem;
  }
}

/* ── List Group ── */
.list-group-item {
  border-color: var(--card-border);
  color: #e1e4e8;
}

.list-group-item:hover {
  background: var(--hover-bg) !important;
}
