:root {
  --bg-primary: #050505;
  --bg-card: rgba(18, 18, 18, 0.92);
  --border-color: rgba(255, 255, 255, 0.14);
  --accent-color: #e50914;
  --accent-glow: rgba(229, 9, 20, 0.45);
  --success-color: #7ee08f;
  --trial-color: #f59e0b;
  --danger-color: #e50914;
  --text-main: #f7f7f7;
  --text-muted: #a9a9a9;
  --input-bg: rgba(255, 255, 255, 0.12);
  --card-radius: 8px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background:
    radial-gradient(circle at 80% 15%, rgba(229, 9, 20, 0.22), transparent 34%),
    linear-gradient(115deg, #050505 0%, #101010 48%, #050505 100%);
  color: var(--text-main);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  position: relative;
  padding: 40px 0;
}

.glass-bg {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 1100px;
  height: 1100px;
  background: radial-gradient(circle, rgba(229, 9, 20, 0.18) 0%, rgba(229, 9, 20, 0.08) 44%, transparent 70%);
  z-index: 1;
  pointer-events: none;
}

.app-container {
  width: 100%;
  max-width: 1300px;
  padding: 0 24px;
  z-index: 2;
}

/* Header */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 32px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  font-family: 'Outfit', sans-serif;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 4px;
  background: linear-gradient(135deg, #ffffff 0%, #ff8a8f 44%, #e50914 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.badge {
  font-size: 9px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.admin-badge {
  background: rgba(229, 9, 20, 0.16);
  color: #ff8a8f;
  border: 1px solid rgba(229, 9, 20, 0.34);
}

.admin-tabs {
  display: flex;
  gap: 8px;
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.nav-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.03);
}

.nav-tab.active {
  color: #fff;
  background: rgba(229, 9, 20, 0.16);
  border: 1px solid rgba(229, 9, 20, 0.34);
}

.logout-btn {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: var(--danger-color);
}

/* Stats Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.stat-icon {
  font-size: 24px;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
}

.stat-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  font-family: 'Outfit', sans-serif;
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* Specific Stat colors */
.text-trial { color: var(--trial-color); }
.text-yearly { color: #ff8a8f; }
.text-lifetime { color: #e50914; }
.text-expired { color: var(--text-muted); }

/* Dashboard Cards */
.dashboard-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  padding: 32px;
}

.card-filters-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
  flex-wrap: wrap;
  gap: 16px;
}

.card-title {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.filters-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.filters-actions input {
  padding: 10px 16px;
  width: 250px;
  font-size: 13px;
  border-radius: 8px;
}

.filters-actions select {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  outline: none;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.filters-actions select:focus {
  border-color: var(--accent-color);
}

.icon-action-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: var(--transition);
}

.icon-action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Tables styling */
.table-scroll-container {
  overflow-x: auto;
  width: 100%;
}

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

.admin-table th {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 1px;
  padding: 14px 16px;
  border-bottom: 2px solid var(--border-color);
}

.admin-table td {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  color: #e5e7eb;
}

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

.table-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px !important;
  font-style: italic;
}

/* Badges for status inside table */
.status-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-active-lifetime {
  background: rgba(229, 9, 20, 0.16);
  color: #ff8a8f;
  border: 1px solid rgba(229, 9, 20, 0.34);
}

.status-active-yearly {
  background: rgba(229, 9, 20, 0.12);
  color: #ff8a8f;
  border: 1px solid rgba(229, 9, 20, 0.28);
}

.status-trial {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.status-expired {
  background: rgba(156, 163, 175, 0.08);
  color: #9ca3af;
  border: 1px solid rgba(156, 163, 175, 0.2);
}

.status-playlist {
  background: rgba(126, 224, 143, 0.1);
  color: #7ee08f;
  border: 1px solid rgba(126, 224, 143, 0.24);
}

/* Action button links */
.action-btn-group {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.table-action-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: #e5e7eb;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
}

.table-action-btn:hover {
  background: rgba(229, 9, 20, 0.14);
  border-color: rgba(229, 9, 20, 0.34);
  color: #ff8a8f;
}

.table-action-btn.delete-btn:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

/* LOGIN WALL PANEL */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 70vh;
  z-index: 2;
  width: 100%;
}

.login-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  padding: 40px;
  width: 100%;
  max-width: 440px;
  text-align: center;
}

.subtitle {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 8px 0 24px;
}

.input-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
  text-align: left;
}

label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

input, select {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 14px;
  color: #fff;
  outline: none;
  transition: var(--transition);
  width: 100%;
}

input:focus, select:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.disabled-input {
  opacity: 0.65;
  cursor: not-allowed;
  background: rgba(0, 0, 0, 0.3);
}

.submit-btn {
  background: #e50914;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 10px;
  width: 100%;
  box-shadow: 0 4px 15px rgba(229, 9, 20, 0.28);
}

.submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(229, 9, 20, 0.48);
}

.submit-btn:active {
  transform: translateY(0);
}

.danger-btn {
  background: #5d1116;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.danger-btn:hover {
  box-shadow: 0 4px 15px rgba(229, 9, 20, 0.36);
  transform: translateY(-1px);
}

.shadow-btn:hover {
  transform: translateY(-1px);
}

.error-text {
  color: var(--danger-color);
  font-size: 12px;
  margin-top: 16px;
  font-weight: 500;
}

/* Modals styling */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #171717;
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  width: 90%;
  max-width: 500px;
  padding: 32px;
  position: relative;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  transform: translateY(20px);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.show .modal-content {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
}

.modal-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  color: #fff;
}

.close-modal-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  transition: var(--transition);
}

.close-modal-btn:hover {
  color: #fff;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 28px;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}

.cancel-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.cancel-btn:hover {
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
}

/* Modal specific views */
.modal-body-spinner {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-style: italic;
}

/* Tab button inside modal */
.tabs-row {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 4px;
  border: 1px solid var(--border-color);
}

.tab-btn {
  flex-grow: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 10px 0;
  font-size: 13px;
  font-weight: 500;
  border-radius: 7px;
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn:hover {
  color: #fff;
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Diagnostic details row */
.modal-body-detail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 13px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.detail-label {
  color: var(--text-muted);
  font-weight: 600;
}

.detail-value {
  color: #e5e7eb;
}

.detail-message-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  border-radius: 8px;
  color: #fff;
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-all;
}

.code-terminal {
  background: #05060b;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  color: #7ee08f;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  width: 100%;
  max-height: 250px;
  overflow-y: auto;
}

.help-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

.hidden {
  display: none !important;
}

/* Toast alert notification */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #171717;
  border: 1px solid rgba(229, 9, 20, 0.35);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  color: #f7f7f7;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  transition: opacity 0.3s ease, bottom 0.3s ease;
  pointer-events: none;
  opacity: 0;
}

.toast.show {
  opacity: 1;
}

.toast.toast-error {
  background: #451a03;
  border-color: rgba(249, 115, 22, 0.3);
  color: #ffedd5;
}

.toast.toast-success {
  background: #022c22;
  border-color: rgba(16, 185, 129, 0.3);
  color: #d1fae5;
}

/* Responsive queries */
@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 800px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .card-filters-bar {
    flex-direction: column;
    align-items: flex-start;
  }
  .filters-actions {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }
  .filters-actions input, .filters-actions select {
    width: 100%;
  }
}
