/* ===== Loading Spinner ===== */
.loader {
  width: 40px;
  height: 40px;
  border: 3px solid #30363d;
  border-top-color: #22c55e;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Cards ===== */
.card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 20px;
  transition: border-color 0.2s;
}

/* ===== Buttons ===== */
.btn-primary {
  background: #22c55e;
  color: #0d1117;
  font-weight: 600;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
}
.btn-primary:hover {
  background: #16a34a;
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: #21262d;
  color: #e6edf3;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 14px;
  border: 1px solid #30363d;
  transition: all 0.2s;
  cursor: pointer;
}
.btn-secondary:hover {
  background: #30363d;
}

.btn-danger {
  background: rgba(248, 113, 113, 0.1);
  color: #f87171;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 14px;
  border: 1px solid rgba(248, 113, 113, 0.3);
  transition: all 0.2s;
  cursor: pointer;
}
.btn-danger:hover {
  background: rgba(248, 113, 113, 0.2);
}

/* ===== Input Fields ===== */
.input-field {
  background: #0d1117;
  border: 1px solid #30363d;
  color: #e6edf3;
  padding: 9px 12px;
  border-radius: 8px;
  outline: none;
  font-size: 14px;
  transition: border-color 0.2s;
}
.input-field:focus {
  border-color: #22c55e;
}
.input-field::placeholder {
  color: #484f58;
}
select.input-field {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236e7681' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
select.input-field option {
  background: #161b22;
  color: #e6edf3;
}

/* ===== Toggle Switch ===== */
.toggle {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
}
.toggle input { display: none; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #30363d;
  border-radius: 22px;
  transition: 0.3s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}
.toggle input:checked + .toggle-slider {
  background: #22c55e;
}
.toggle input:checked + .toggle-slider::before {
  transform: translateX(16px);
}

/* ===== DNS Record Type Badges ===== */
.type-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 5px;
  letter-spacing: 0.5px;
  display: inline-block;
  text-transform: uppercase;
}
.type-a      { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.type-aaaa   { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.type-cname  { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.type-mx     { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.type-txt    { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.type-ns     { background: rgba(6, 182, 212, 0.15);  color: #22d3ee; }
.type-caa    { background: rgba(236, 72, 153, 0.15); color: #f472b6; }
.type-srv    { background: rgba(244, 114, 182, 0.15); color: #f472b6; }

/* ===== Status Badges ===== */
.badge {
  font-size: 12px;
  padding: 3px 12px;
  border-radius: 9999px;
  font-weight: 500;
  display: inline-block;
}
.badge-green {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}
.badge-amber {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}
.badge-red {
  background: rgba(248, 113, 113, 0.15);
  color: #f87171;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease-out;
}
.modal-content {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ===== Toast Notifications ===== */
.toast {
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  animation: slideInRight 0.3s ease-out;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  min-width: 240px;
}
.toast-success { background: #16a34a; color: white; }
.toast-error   { background: #dc2626; color: white; }
.toast-info    { background: #2563eb; color: white; }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== Nav Links ===== */
.nav-link {
  color: #8b949e;
}
.nav-link:hover {
  color: #e6edf3;
  background: rgba(255, 255, 255, 0.05);
}
.nav-link.active {
  color: #ffffff;
  background: rgba(34, 197, 94, 0.1);
}

/* ===== Custom 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;
}

/* ===== Stat Cards ===== */
.stat-card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 16px 20px;
}

/* ===== Zone Card Hover ===== */
.zone-card {
  transition: all 0.2s;
}
.zone-card:hover {
  border-color: rgba(34, 197, 94, 0.4);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.1);
}

/* ===== Table ===== */
.dns-table tr {
  transition: background 0.15s;
}
.dns-table tr:hover {
  background: rgba(33, 38, 45, 0.5);
}

/* ===== Email Account Row ===== */
.email-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 5px;
  letter-spacing: 0.5px;
  display: inline-block;
}
.email-badge-account {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}
.email-badge-forwarder {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
}

/* ===== Quota Bar ===== */
.quota-bar {
  width: 100%;
  height: 6px;
  background: #21262d;
  border-radius: 3px;
  overflow: hidden;
}
.quota-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}
.quota-bar-fill.low { background: #22c55e; }
.quota-bar-fill.mid { background: #f59e0b; }
.quota-bar-fill.high { background: #ef4444; }

/* ===== Tab Buttons ===== */
.tab-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  color: #8b949e;
  cursor: pointer;
  transition: all 0.2s;
  background: none;
  border: 1px solid transparent;
}
.tab-btn:hover { color: #e6edf3; background: rgba(255,255,255,0.05); }
.tab-btn.active {
  color: #e6edf3;
  background: #21262d;
  border-color: #30363d;
}

/* ===== Nameserver Tag ===== */
.ns-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 8px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: #22c55e;
}
.ns-tag button {
  margin-left: auto;
  color: #484f58;
  transition: color 0.15s;
  cursor: pointer;
  background: none;
  border: none;
  font-size: 12px;
}
.ns-tag button:hover {
  color: #e6edf3;
}

/* ===== Hide scrollbar for tab overflow ===== */
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* ===== Responsive: Mobile ===== */
@media (max-width: 639px) {
  .card {
    padding: 12px;
    border-radius: 10px;
  }
  .modal-overlay {
    padding: 12px;
    align-items: flex-end;
  }
  .modal-content {
    padding: 20px;
    border-radius: 14px 14px 0 0;
    max-height: 85vh;
  }
  .toast {
    min-width: auto;
    max-width: calc(100vw - 32px);
    font-size: 13px;
    padding: 10px 16px;
  }
  .ns-tag {
    font-size: 11px;
    padding: 6px 10px;
    width: 100%;
  }
  .ns-tag span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }
  .type-badge {
    font-size: 10px;
    padding: 2px 7px;
  }
  .badge {
    font-size: 11px;
    padding: 2px 9px;
  }
  .btn-primary, .btn-secondary, .btn-danger {
    padding: 8px 14px;
    font-size: 13px;
  }
  .input-field {
    padding: 8px 10px;
    font-size: 13px;
  }
  .dns-table td {
    font-size: 12px;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .dns-table th {
    font-size: 10px;
  }
  /* Make font-mono content break on mobile */
  td.mono-break {
    word-break: break-all;
    white-space: normal;
  }
}

/* Touch targets: larger tap area on touch devices */
@media (pointer: coarse) {
  .toggle {
    width: 44px;
    height: 26px;
  }
  .toggle-slider::before {
    height: 20px;
    width: 20px;
  }
  .toggle input:checked + .toggle-slider::before {
    transform: translateX(18px);
  }
  button[title="Edit"],
  button[title="Delete"] {
    padding: 8px;
  }
}
