/* NekoPass LK — Browser-adapted miniapp style */
:root {
  --bg: #1e1e2d;
  --bg-card: #2c2c3e;
  --text: #ffffff;
  --text-hint: #aaaaaa;
  --accent: #3388ff;
  --accent-hover: #2a6fd3;
  --danger: #ff4444;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', 'Helvetica Neue', Helvetica, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== App container ===== */
.app {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.back-link {
  font-size: 14px;
  color: var(--accent);
  transition: opacity .2s;
}
.back-link:hover { opacity: .8; text-decoration: none; }

.logout-btn {
  background: none;
  border: 1px solid rgba(255,255,255,.15);
  color: var(--text-hint);
  font-size: 13px;
  padding: 6px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: background .2s, color .2s;
}
.logout-btn:hover { background: rgba(255,255,255,.08); color: var(--text); }

h2 {
  text-align: center;
  margin-bottom: 20px;
  font-size: 22px;
  font-weight: 700;
}

/* ===== Splash screen ===== */
#splash-screen {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg-card) 100%);
  z-index: 9999;
  opacity: 1;
  visibility: visible;
  transition: opacity .6s ease, visibility .6s ease;
}
#splash-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-content {
  text-align: center;
  animation: splashFadeIn .8s ease-in-out;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.splash-logo {
  width: 100px;
  height: 100px;
  animation: logoFloat 2s ease-in-out infinite;
  filter: drop-shadow(0 4px 12px rgba(51,136,255,.3));
  object-fit: contain;
}
.splash-text { font-size: 20px; font-weight: 600; opacity: .9; letter-spacing: .5px; }
.splash-loader {
  width: 36px; height: 36px;
  border: 3px solid rgba(51,136,255,.2);
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes splashFadeIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes logoFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ===== Auth pages ===== */
.auth-container {
  max-width: 400px;
  margin: 40px auto 0;
  text-align: center;
}
.auth-logo {
  width: 80px;
  height: 80px;
  margin-bottom: 20px;
  filter: drop-shadow(0 4px 12px rgba(51,136,255,.3));
}
.auth-container h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 28px;
}

.error-msg {
  background: rgba(255,68,68,.12);
  border: 1px solid rgba(255,68,68,.3);
  color: #ff6b6b;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 16px;
  text-align: center;
}

form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}
.form-group label {
  font-size: 13px;
  color: var(--text-hint);
  font-weight: 500;
}
.form-group input {
  padding: 13px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12);
  background: var(--bg-card);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
  box-shadow: inset 0 2px 5px rgba(0,0,0,.2);
}
.form-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(51,136,255,.4);
}
.form-group input::placeholder { color: #555; }

.btn-primary {
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  background-color: var(--accent);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  transition: background .2s, transform .15s;
  box-shadow: 0 2px 8px rgba(51,136,255,.3);
  text-align: center;
}
.btn-primary:hover { background-color: var(--accent-hover); }
.btn-primary:active { transform: scale(.97); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
  color: var(--text-hint);
  font-size: 13px;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,.1);
}

.tg-login-wrap {
  display: flex;
  justify-content: center;
  min-height: 40px;
}

.auth-switch {
  margin-top: 24px;
  font-size: 14px;
  color: var(--text-hint);
}

/* ===== Dashboard ===== */
.dashboard { max-width: 640px; margin: auto; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-bottom: 20px;
}

.stat-card {
  background-color: var(--bg-card);
  padding: 15px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background .2s, transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,.2);
}
.stat-card:hover { background: rgba(44,44,62,.8); }
.stat-card:active { transform: scale(.97); box-shadow: 0 1px 3px rgba(0,0,0,.25); }

.stat-info { display: flex; flex-direction: column; }
.label { font-size: 14px; color: var(--text); opacity: .8; }
.value { font-size: 16px; font-weight: bold; min-width: 50px; }
.stat-action { font-size: 24px; color: var(--accent); font-weight: bold; opacity: .9; }

.stat-card.highlight {
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(51,136,255,.15) 100%);
  border: 1px solid rgba(51,136,255,.3);
  position: relative;
}
.stat-card.highlight::after {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 60px;
  background: linear-gradient(90deg, transparent 0%, rgba(51,136,255,.08) 100%);
  border-radius: 0 var(--radius) var(--radius) 0;
  pointer-events: none;
}

.stat-card.full-width { grid-column: span 2; }

.stat-card.vpn-actions {
  display: flex;
  flex-direction: row;
  gap: 12px;
  padding: 12px;
  cursor: default;
}
.stat-card.vpn-actions:hover { background: var(--bg-card); }
.stat-card.vpn-actions:active { transform: none; box-shadow: 0 2px 5px rgba(0,0,0,.2); }

.action-button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 10px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
  background: var(--bg-card);
  color: var(--text);
  text-decoration: none;
}
.action-button:hover { text-decoration: none; background: rgba(44,44,62,.6); }
.action-button:active { transform: scale(.95); }
.action-button.primary { border-color: rgba(51,136,255,.3); }
.action-button.secondary { border-color: rgba(255,107,107,.3); }
.action-icon { font-size: 20px; line-height: 1; }
.action-text { font-size: 13px; font-weight: 500; text-align: center; line-height: 1.2; }

/* ===== Referral card ===== */
.referral-card {
  flex-direction: column;
  align-items: stretch !important;
  cursor: default !important;
  gap: 14px;
}
.referral-card:hover { background: var(--bg-card) !important; }
.referral-card:active { transform: none !important; }

.referral-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.referral-percent {
  background: rgba(51,136,255,.15);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
}
.referral-stats {
  display: flex;
  justify-content: space-around;
  gap: 8px;
}
.ref-stat { text-align: center; }
.ref-stat-value { display: block; font-size: 18px; font-weight: 700; color: var(--accent); }
.ref-stat-label { font-size: 12px; color: var(--text-hint); }

.ref-link-wrap {
  display: flex;
  gap: 8px;
}
.ref-link-wrap input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.1);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}
.copy-btn {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background .2s;
}
.copy-btn:hover { background: var(--accent-hover); }

/* ===== Info card ===== */
.info-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  cursor: default !important;
}
.info-card:hover { background: var(--bg-card) !important; }
.info-card:active { transform: none !important; }

.info-section { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.info-section-label { font-size: 13px; font-weight: 500; opacity: .8; }
.info-divider { width: 100%; height: 1px; background: rgba(255,255,255,.1); }

.info-links { display: flex; justify-content: space-around; gap: 8px; }
.info-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px;
  color: var(--text);
  border-radius: 8px;
  transition: background .2s ease;
  flex: 1;
}
.info-link:hover { background: rgba(255,255,255,.05); text-decoration: none; }
.info-link-icon { font-size: 20px; line-height: 1; }
.info-link-text { font-size: 12px; text-align: center; opacity: .9; }

.servers-status-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  border-radius: var(--radius);
  max-width: 100%;
}
.server-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  transition: background .3s ease;
}
.server-item.online { color: #4caf50; }
.server-item.offline { color: #f44336; }
.server-item:hover { background: rgba(255,255,255,.08); }
.server-name { font-weight: 600; }
.server-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background-color: currentColor;
  animation: pulse 1s infinite ease-in-out;
  flex-shrink: 0;
}
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.5); opacity: .5; } }

/* ===== VPN list ===== */
.vpn-list { display: flex; flex-direction: column; gap: 12px; }

.vpn-card {
  background-color: var(--bg-card);
  padding: 16px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.vpn-card:hover { background: rgba(44,44,62,.8); }
.vpn-card:active { transform: scale(.98); box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.vpn-info { flex: 1; }
.vpn-name { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.vpn-meta { font-size: 13px; color: var(--text-hint); display: flex; gap: 12px; flex-wrap: wrap; }
.vpn-arrow { font-size: 24px; color: var(--accent); font-weight: bold; opacity: .9; }

.vpn-detail { animation: slideIn .3s ease; }

.detail-header {
  background-color: var(--bg-card);
  padding: 20px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.detail-title { font-size: 18px; font-weight: bold; word-break: break-word; line-height: 1.4; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.detail-item {
  background-color: var(--bg-card);
  padding: 12px;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
.detail-label { font-size: 12px; color: var(--text-hint); margin-bottom: 4px; }
.detail-value { font-size: 15px; font-weight: 600; }
.detail-value.warn { color: var(--danger); }

.detail-actions { display: flex; flex-direction: column; gap: 10px; }
.action-btn {
  display: block;
  padding: 14px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
  text-decoration: none;
}
.action-btn:hover { text-decoration: none; }
.action-btn:active { transform: scale(.97); }
.btn-action-primary { background-color: var(--accent); color: white; }
.btn-action-secondary { background-color: var(--bg-card); color: var(--text); border: 1px solid rgba(255,255,255,.15); }

@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ===== Empty state ===== */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-hint); }
.empty-state-icon { font-size: 64px; margin-bottom: 20px; }
.empty-state-text { font-size: 18px; margin-bottom: 10px; }
.empty-state-hint { font-size: 14px; opacity: .7; }

/* ===== Skeleton ===== */
.skeleton {
  display: inline-block;
  height: 16px;
  width: 60px;
  background: linear-gradient(90deg, rgba(255,255,255,.1) 25%, rgba(255,255,255,.2) 50%, rgba(255,255,255,.1) 75%);
  background-size: 200% 100%;
  border-radius: 4px;
  animation: shimmer 1.3s infinite;
}
.skeleton-card {
  background: linear-gradient(90deg, rgba(255,255,255,.1) 25%, rgba(255,255,255,.2) 50%, rgba(255,255,255,.1) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius);
  animation: shimmer 1.3s infinite;
  height: 80px;
  margin-bottom: 12px;
}
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* ===== Responsive ===== */
@media (max-width: 480px) {
  .app { padding: 16px; }
  .stats-grid { gap: 10px; }
  .stat-card { padding: 12px; }
  .referral-stats { flex-direction: column; gap: 12px; }
  .ref-link-wrap { flex-direction: column; }
}
