@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* AMOLED True Black Palette */
  --bg:          #000000;
  --surface:     #050505;
  --surface-2:   #111111;
  --surface-hover: #181818;
  --border:      rgba(255,255,255,0.05);
  
  /* Neon Accents */
  --primary:     #7c3aed;
  --primary-2:   #a855f7;
  --accent:      #22d3ee;
  --success:     #10b981;
  --error:       #ef4444;
  
  /* Typography */
  --text:        #fdfdfd;
  --text-muted:  #a1a1aa;
  --text-dim:    #71717a;
  
  /* Geometry */
  --radius:      24px;
  --radius-sm:   16px;
  --nav-h:       72px;
  --transition:  0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbars ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 0px; } /* Hide completely for AMOLED minimal */

/* ── App Shell ────────────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

/* ── Top Bar ──────────────────────────────────────────────────────────────── */
.header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg);
  flex-shrink: 0;
  z-index: 10;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-logo i {
  font-size: 24px;
  color: var(--primary-2);
  filter: drop-shadow(0 0 8px rgba(168,85,247,0.4));
}
.header-logo span {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: all var(--transition);
}
.status-dot.online { 
  background: var(--success); 
  box-shadow: 0 0 12px var(--success); 
}

/* ── Tab Content ──────────────────────────────────────────────────────────── */
.content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.tab-page {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 16px 24px calc(var(--nav-h) + 40px); /* Space for floating nav */
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.98);
  transition: opacity 0.4s cubic-bezier(0.2,0.8,0.2,1), transform 0.4s cubic-bezier(0.2,0.8,0.2,1);
}
.tab-page.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* ── Floating Bottom Nav (iOS Island) ─────────────────────────────────────── */
.tab-bar {
  position: absolute;
  bottom: 24px; left: 24px; right: 24px;
  height: var(--nav-h);
  display: flex;
  background: rgba(15,15,15,0.7);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 36px;
  z-index: 20;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  padding: 0 8px;
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.tab-btn i { 
  font-size: 24px; 
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.tab-btn .tab-label { 
  font-size: 10px; 
  font-weight: 500; 
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: absolute;
  bottom: 8px;
}
.tab-btn.active { color: var(--text); }
.tab-btn.active i { 
  transform: translateY(-8px); 
  color: var(--primary-2);
  filter: drop-shadow(0 0 10px rgba(168,85,247,0.4));
}
.tab-btn.active .tab-label { 
  opacity: 1; 
  transform: translateY(0);
}

/* ── Minimal Section Titles ───────────────────────────────────────────────── */
.section-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
  color: var(--text);
}
.section-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 32px;
  line-height: 1.5;
}

/* ── Minimal Cards / Containers ───────────────────────────────────────────── */
.card {
  margin-bottom: 24px;
}
.card-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 16px;
}

/* ── Stat Grid (Home) ─────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}
.stat-value {
  font-size: 32px;
  font-weight: 300;
  letter-spacing: -1px;
}
.stat-label { font-size: 12px; color: var(--text-dim); font-weight: 500; }

/* ── Glowing Inputs ───────────────────────────────────────────────────────── */
.input-wrap {
  position: relative;
  margin-bottom: 24px;
}
.input-wrap i {
  position: absolute;
  left: 20px; top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: var(--text-dim);
  pointer-events: none;
  transition: color var(--transition);
}
input[type="text"], input[type="url"] {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  padding: 18px 20px 18px 52px;
  outline: none;
  transition: all var(--transition);
}
input[type="text"]:focus, input[type="url"]:focus {
  background: var(--surface);
  border-color: rgba(168,85,247,0.3);
  box-shadow: 0 0 20px rgba(168,85,247,0.1);
}
input:focus + i { color: var(--primary-2); filter: drop-shadow(0 0 8px rgba(168,85,247,0.4)); }
input::placeholder { color: var(--text-dim); }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--text-muted);
  margin-bottom: 24px;
  transition: all var(--transition);
}
.platform-badge i { font-size: 16px; }
.platform-badge.detected { 
  color: var(--accent); 
  background: rgba(34,211,238,0.05); 
  box-shadow: 0 0 16px rgba(34,211,238,0.1);
}

/* ── Ghost Buttons with Neon Hover ────────────────────────────────────────── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 18px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}
.btn i { font-size: 20px; }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-primary:hover {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 24px rgba(124,58,237,0.4);
}
.btn-primary:disabled { 
  opacity: 0.5; 
  cursor: not-allowed; 
  background: var(--surface-2); 
  box-shadow: none; 
}

.btn-success {
  background: rgba(16,185,129,0.1);
  color: var(--success);
}
.btn-success:hover {
  background: rgba(16,185,129,0.2);
  box-shadow: 0 0 24px rgba(16,185,129,0.2);
}

.btn-accent {
  background: rgba(34,211,238,0.1);
  color: var(--accent);
}
.btn-ghost {
  background: transparent;
  color: var(--text-dim);
}
.btn-ghost:hover { color: var(--text); }

.btn + .btn { margin-top: 12px; }

/* ── Loading Spinner ──────────────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary-2);
  border-radius: 50%;
  animation: spin 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Result & Error Cards ─────────────────────────────────────────────────── */
.result-card, .error-card {
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 24px;
  display: none;
  position: relative;
  overflow: hidden;
}
.result-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(16,185,129,0.5), transparent);
}
.result-card { background: var(--surface); }
.result-card.visible { display: block; animation: slideUp 0.4s cubic-bezier(0.2,0.8,0.2,1); }

.result-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600; color: var(--success); margin-bottom: 8px;
}
.result-title i { font-size: 18px; }
.result-name { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; word-break: break-all; }

.error-card { background: rgba(239,68,68,0.05); color: var(--error); border: 1px solid rgba(239,68,68,0.1); }
.error-card.visible { display: block; animation: shake 0.4s cubic-bezier(0.36,0.07,0.19,0.97) both; }

/* ── Upload Zone (Minimal) ────────────────────────────────────────────────── */
.upload-zone {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  background: var(--surface);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: rgba(168,85,247,0.5);
  background: rgba(168,85,247,0.05);
}
.upload-zone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.upload-icon { font-size: 48px; color: var(--text-dim); display: block; margin-bottom: 16px; transition: color var(--transition); }
.upload-zone:hover .upload-icon { color: var(--primary-2); filter: drop-shadow(0 0 12px rgba(168,85,247,0.3)); }
.upload-text { font-size: 15px; font-weight: 500; color: var(--text); }
.upload-sub { font-size: 13px; color: var(--text-dim); margin-top: 8px; }

.preview-img {
  width: 100%; max-height: 240px; object-fit: contain;
  border-radius: var(--radius); background: var(--surface);
  display: none; margin-bottom: 24px;
}
.preview-img.visible { display: block; animation: fadeScale 0.4s cubic-bezier(0.2,0.8,0.2,1); }

/* ── Pill Toggle ──────────────────────────────────────────────────────────── */
.toggle-group {
  display: flex;
  background: var(--surface);
  border-radius: 30px;
  padding: 4px;
  margin-bottom: 24px;
  position: relative;
}
.toggle-btn {
  flex: 1; padding: 12px; border: none; background: none;
  color: var(--text-dim); font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all var(--transition); z-index: 2;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.toggle-btn i { font-size: 18px; }
.toggle-btn.active { color: var(--text); }
.toggle-bg {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px);
  background: var(--surface-2); border-radius: 26px; transition: transform var(--transition); z-index: 1;
}
.toggle-group[data-state="telegram"] .toggle-bg { transform: translateX(100%); }

/* ── History List (Borderless) ────────────────────────────────────────────── */
.history-item {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 0; border-bottom: 1px solid var(--border);
  animation: slideUp 0.3s ease forwards; opacity: 0;
}
.history-item:last-child { border-bottom: none; }
.history-icon {
  width: 48px; height: 48px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; background: var(--surface); color: var(--text-dim); flex-shrink: 0;
}
.history-info { flex: 1; min-width: 0; }
.history-title {
  font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text);
}
.history-meta { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* ── Empty State ──────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 80px 20px; color: var(--text-dim); }
.empty-state i { font-size: 48px; margin-bottom: 16px; display: block; opacity: 0.5; }

/* ── Quick Actions Grid ───────────────────────────────────────────────────── */
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.quick-btn {
  background: var(--surface); border: none; border-radius: var(--radius);
  padding: 24px 20px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
  cursor: pointer; transition: all var(--transition); -webkit-tap-highlight-color: transparent;
  position: relative; overflow: hidden;
}
.quick-btn::after {
  content: ''; position: absolute; inset: 0; background: radial-gradient(circle at top right, rgba(168,85,247,0.15), transparent 60%); opacity: 0; transition: opacity var(--transition);
}
.quick-btn:hover { background: var(--surface-hover); }
.quick-btn:hover::after { opacity: 1; }
.quick-btn:active { transform: scale(0.96); }
.quick-btn i { font-size: 28px; color: var(--text-muted); transition: color var(--transition); }
.quick-btn:hover i { color: var(--primary-2); }
.quick-btn .qb-label { font-size: 15px; font-weight: 600; color: var(--text); }
.quick-btn .qb-sub { font-size: 12px; color: var(--text-dim); }

/* ── Uptime Row ───────────────────────────────────────────────────────────── */
.info-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 14px;
}
.info-row:last-child { border-bottom: none; }
.info-row .ir-label { color: var(--text-muted); }
.info-row .ir-value { font-weight: 500; color: var(--text); }

/* ── Animations ───────────────────────────────────────────────────────────── */
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeScale { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
@keyframes shake { 10%, 90% { transform: translate3d(-1px,0,0); } 20%, 80% { transform: translate3d(2px,0,0); } 30%, 50%, 70% { transform: translate3d(-4px,0,0); } 40%, 60% { transform: translate3d(4px,0,0); } }

/* ── Desktop adjustments ──────────────────────────────────────────────────── */
@media (min-width: 480px) { #app { border-left: 1px solid var(--border); border-right: 1px solid var(--border); } }
