/* DNS25 Admin Panel - iOS Style Design System */

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

:root {
  /* iOS Light mode colors */
  --ios-bg: #F2F2F7;
  --ios-surface: #FFFFFF;
  --ios-surface-2: #F9F9FB;
  --ios-elevated: #FFFFFF;
  --ios-separator: rgba(60, 60, 67, 0.12);
  --ios-separator-opaque: #C6C6C8;
  --ios-text: #000000;
  --ios-text-secondary: #3C3C43;
  --ios-text-tertiary: rgba(60, 60, 67, 0.6);
  --ios-text-quaternary: rgba(60, 60, 67, 0.3);
  --ios-blue: #007AFF;
  --ios-blue-pressed: #0066D6;
  --ios-green: #34C759;
  --ios-red: #FF3B30;
  --ios-orange: #FF9500;
  --ios-yellow: #FFCC00;
  --ios-purple: #5856D6;
  --ios-pink: #FF2D55;
  --ios-teal: #5AC8FA;
  --ios-indigo: #5856D6;

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.6);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);

  /* Spacing scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 28px;

  /* Typography */
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Inter', 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', ui-monospace, 'Menlo', 'Monaco', monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ios-bg: #000000;
    --ios-surface: #1C1C1E;
    --ios-surface-2: #2C2C2E;
    --ios-elevated: #2C2C2E;
    --ios-separator: rgba(84, 84, 88, 0.6);
    --ios-separator-opaque: #38383A;
    --ios-text: #FFFFFF;
    --ios-text-secondary: #EBEBF5;
    --ios-text-tertiary: rgba(235, 235, 245, 0.6);
    --ios-text-quaternary: rgba(235, 235, 245, 0.3);
    --ios-blue: #0A84FF;
    --ios-green: #30D158;
    --ios-red: #FF453A;
    --ios-orange: #FF9F0A;
    --ios-yellow: #FFD60A;
    --ios-purple: #5E5CE6;
    --glass-bg: rgba(28, 28, 30, 0.72);
    --glass-border: rgba(84, 84, 88, 0.4);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  }
}

html, body {
  font-family: var(--font);
  background: var(--ios-bg);
  color: var(--ios-text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  letter-spacing: -0.011em;
}

button { font-family: inherit; }

/* =================== LOGIN =================== */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-md);
  background:
    radial-gradient(ellipse at top, rgba(10, 132, 255, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at bottom, rgba(94, 92, 230, 0.15) 0%, transparent 50%),
    var(--ios-bg);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--glass-bg);
  backdrop-filter: blur(40px) saturate(1.8);
  -webkit-backdrop-filter: blur(40px) saturate(1.8);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-2xl);
  padding: var(--space-xl) var(--space-xl) var(--space-lg);
  box-shadow: var(--glass-shadow);
  text-align: center;
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.login-icon {
  margin: 0 auto var(--space-md);
  filter: drop-shadow(0 4px 12px rgba(10, 132, 255, 0.3));
}
.login-card h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.023em;
  margin-bottom: var(--space-xs);
}
.login-subtitle {
  font-size: 15px;
  color: var(--ios-text-secondary);
  margin-bottom: var(--space-xl);
  font-weight: 400;
}
.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  text-align: left;
}
.input-group input {
  width: 100%;
  padding: 14px 16px;
  background: var(--ios-surface-2);
  border: 1px solid var(--ios-separator);
  border-radius: var(--radius-md);
  color: var(--ios-text);
  font-size: 17px;
  font-family: var(--font);
  transition: all 0.2s ease;
}
.input-group input:focus {
  outline: none;
  border-color: var(--ios-blue);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}
.btn-primary {
  width: 100%;
  padding: 15px;
  background: var(--ios-blue);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  transition: all 0.15s ease;
}
.btn-primary:hover { background: var(--ios-blue-pressed); }
.btn-primary:active { transform: scale(0.98); }
.login-hint {
  font-size: 13px;
  color: var(--ios-text-tertiary);
  margin-top: var(--space-lg);
  line-height: 1.4;
}

/* =================== DASHBOARD LAYOUT =================== */
.dashboard { min-height: 100vh; }

.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  border-bottom: 1px solid var(--ios-separator);
}
.top-bar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px var(--space-lg);
  max-width: 1400px;
  margin: 0 auto;
}
.top-bar-left { display: flex; align-items: center; gap: var(--space-md); }
.top-bar-right { display: flex; align-items: center; gap: var(--space-sm); }
.top-bar-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--ios-blue);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.icon-btn:hover { background: var(--ios-surface-2); }
.user-chip {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 4px 12px 4px 4px;
  background: var(--ios-surface-2);
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
}
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ios-blue), var(--ios-purple));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
}

/* =================== SIDEBAR =================== */
.layout {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-lg);
  gap: var(--space-lg);
}
.sidebar {
  width: 240px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  align-self: flex-start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.sidebar nav {
  background: var(--ios-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-sm);
  border: 1px solid var(--ios-separator);
}
.nav-section + .nav-section { margin-top: var(--space-md); }
.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--ios-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 12px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: var(--ios-text);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: all 0.15s ease;
}
.nav-item:hover { background: var(--ios-surface-2); }
.nav-item.active {
  background: var(--ios-blue);
  color: white;
}
.nav-item.active svg { color: white; }

/* =================== CONTENT =================== */
.content { flex: 1; min-width: 0; }
.section { display: none; animation: fadeIn 0.3s ease; }
.section.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Stats grid */
.card-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}
.stat-card {
  background: var(--ios-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid var(--ios-separator);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--ios-blue);
}
.stat-card.green::before { background: var(--ios-green); }
.stat-card.orange::before { background: var(--ios-orange); }
.stat-card.purple::before { background: var(--ios-purple); }
.stat-card.red::before { background: var(--ios-red); }
.stat-card .label {
  font-size: 13px;
  color: var(--ios-text-secondary);
  font-weight: 500;
  margin-bottom: 4px;
}
.stat-card .value {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ios-text);
  font-variant-numeric: tabular-nums;
}
.stat-card .trend {
  font-size: 12px;
  color: var(--ios-text-tertiary);
  margin-top: 4px;
}

/* Cards */
.card {
  background: var(--ios-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--ios-separator);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--ios-separator);
}
.card-header h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.btn-ghost {
  padding: 6px 12px;
  background: transparent;
  border: none;
  color: var(--ios-blue);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.btn-ghost:hover { background: var(--ios-surface-2); }

/* Tables */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th {
  text-align: left;
  padding: 12px var(--space-lg);
  font-weight: 600;
  color: var(--ios-text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--ios-separator);
  background: var(--ios-surface-2);
  position: sticky;
  top: 0;
}
td {
  padding: 14px var(--space-lg);
  border-bottom: 1px solid var(--ios-separator);
  color: var(--ios-text);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--ios-surface-2); }
td code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--ios-surface-2);
  padding: 3px 8px;
  border-radius: 6px;
  color: var(--ios-text-secondary);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.badge.success { background: rgba(52, 199, 89, 0.15); color: var(--ios-green); }
.badge.warning { background: rgba(255, 149, 0, 0.15); color: var(--ios-orange); }
.badge.danger { background: rgba(255, 59, 48, 0.15); color: var(--ios-red); }
.badge.info { background: rgba(0, 122, 255, 0.15); color: var(--ios-blue); }
.badge.muted { background: var(--ios-surface-2); color: var(--ios-text-tertiary); }
.badge.purple { background: rgba(88, 86, 214, 0.15); color: var(--ios-purple); }

/* Action buttons in table */
.btn-sm {
  padding: 6px 12px;
  background: var(--ios-surface-2);
  border: 1px solid var(--ios-separator);
  color: var(--ios-text);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  margin-right: 4px;
}
.btn-sm:hover { background: var(--ios-separator); }
.btn-sm.success { color: var(--ios-green); border-color: var(--ios-green); }
.btn-sm.danger { color: var(--ios-red); border-color: var(--ios-red); }

/* Search box */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--ios-surface-2);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  width: 320px;
}
.search-box svg { color: var(--ios-text-tertiary); flex-shrink: 0; }
.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--ios-text);
  font-size: 15px;
  padding: 0 8px;
  width: 100%;
  font-family: var(--font);
}

/* Pagination */
.pagination {
  display: flex;
  gap: 4px;
  padding: var(--space-md) var(--space-lg);
  justify-content: center;
  border-top: 1px solid var(--ios-separator);
}
.pagination button {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  background: transparent;
  border: 1px solid var(--ios-separator);
  color: var(--ios-blue);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}
.pagination button:hover { background: var(--ios-surface-2); }
.pagination button.active {
  background: var(--ios-blue);
  color: white;
  border-color: var(--ios-blue);
}

/* Settings list */
.settings-list {
  padding: var(--space-sm) var(--space-lg);
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--ios-separator);
  gap: var(--space-md);
}
.setting-row:last-child { border-bottom: none; }
.setting-row .key-info {
  flex-shrink: 0;
}
.setting-row .key {
  font-size: 15px;
  font-weight: 500;
  color: var(--ios-text);
  font-family: var(--font-mono);
}
.setting-row .updated {
  font-size: 12px;
  color: var(--ios-text-tertiary);
  margin-top: 2px;
}
.setting-row input {
  flex: 1;
  max-width: 400px;
  padding: 8px 12px;
  background: var(--ios-surface-2);
  border: 1px solid var(--ios-separator);
  border-radius: var(--radius-sm);
  color: var(--ios-text);
  font-size: 14px;
  font-family: var(--font-mono);
  outline: none;
  transition: border-color 0.15s;
}
.setting-row input:focus {
  border-color: var(--ios-blue);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

/* Activity list */
.activity-list {
  padding: var(--space-sm) var(--space-lg);
}
.activity-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 10px 0;
  border-bottom: 1px solid var(--ios-separator);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ios-surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.activity-text {
  flex: 1;
  font-size: 14px;
}
.activity-time {
  font-size: 12px;
  color: var(--ios-text-tertiary);
}

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ios-text);
  box-shadow: var(--glass-shadow);
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  min-width: 240px;
}
.toast.success { border-left: 3px solid var(--ios-green); }
.toast.error { border-left: 3px solid var(--ios-red); }
.toast.info { border-left: 3px solid var(--ios-blue); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(20px); }
}
.toast.removing { animation: toastOut 0.3s ease forwards; }

/* Responsive */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    background: var(--ios-surface);
    padding: var(--space-lg);
    border-right: 1px solid var(--ios-separator);
    max-height: none;
  }
  .sidebar.open { transform: translateX(0); }
  .layout { padding: var(--space-md); gap: 0; flex-direction: column; }
  .search-box { width: 100%; }
  .top-bar-content { padding: 12px var(--space-md); }
  .card-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 500px) {
  .card-row { grid-template-columns: 1fr; }
  .user-chip span { display: none; }
}

/* Scrollbar iOS style */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--ios-separator-opaque);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--ios-text-tertiary); }
