:root {
  --bg-primary: #080c14;
  --bg-card: #0f172a;
  --bg-card-glow: rgba(15, 23, 42, 0.8);
  --border-card: #1e293b;
  --border-highlight: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --buy-green: #00e676;
  --buy-glow: rgba(0, 230, 118, 0.25);
  --sell-red: #ff1744;
  --sell-glow: rgba(255, 23, 68, 0.25);
  
  --nifty-blue: #38bdf8;
  --sensex-purple: #c084fc;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* App Header */
.app-header {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-card);
  padding: 0.9rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  box-shadow: 0 0 12px rgba(2, 132, 199, 0.4);
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* Connection Status Badge */
.connection-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  transition: all 0.3s ease;
}

.badge-connected {
  background: rgba(0, 230, 118, 0.12);
  color: var(--buy-green);
  border: 1px solid rgba(0, 230, 118, 0.3);
}

.badge-connecting {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-disconnected {
  background: rgba(255, 23, 68, 0.12);
  color: var(--sell-red);
  border: 1px solid rgba(255, 23, 68, 0.3);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pulseAnim 1.8s infinite;
}

@keyframes pulseAnim {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.7; }
}

/* Container */
.container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 1.25rem 1rem;
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
  flex: 1;
}

/* Gatekeeper Screen */
#gatekeeperScreen {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gate-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 2.25rem 1.75rem;
  text-align: center;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.7);
}

.gate-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 1.25rem;
  background: linear-gradient(135deg, #38bdf8, #2563eb);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.85rem;
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.35);
}

.gate-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.gate-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
  line-height: 1.4;
}

.gate-input {
  width: 100%;
  padding: 1rem;
  background: #090e1a;
  border: 2px solid var(--border-card);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
  outline: none;
  transition: all 0.2s;
}

.gate-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.2);
}

.btn-gate {
  width: 100%;
  padding: 1.05rem;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.btn-gate:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
}

.gate-error {
  margin-top: 1rem;
  padding: 0.75rem;
  background: rgba(255, 23, 68, 0.15);
  border: 1px solid var(--sell-red);
  color: #ff6b81;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  display: none;
}

/* Push Notification Banner */
.push-banner {
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.35), rgba(15, 23, 42, 0.8));
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  animation: fadeIn 0.4s ease;
}

.btn-push {
  background: #2563eb;
  color: white;
  border: none;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.btn-push:hover {
  background: #1d4ed8;
}

/* User Profile & Control Toolbar */
.user-bar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.user-bar-identity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.user-details {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 140px;
}

.user-name-line {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.user-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
}

.user-key-badge {
  font-size: 0.7rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  color: var(--text-muted);
}

.user-subtext {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.btn-disconnect {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #f87171;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-disconnect:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ff4d6d;
}

.user-bar-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  flex-wrap: wrap;
}

.btn-sound-action {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-sound-action:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

/* Signal Cards Feed */
.feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.feed-title {
  font-size: 0.92rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.signal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.4rem;
  margin-bottom: 1.25rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  transition: transform 0.2s ease, border-color 0.2s ease;
  animation: cardDropIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.signal-card.new-pulse {
  animation: cardDropIn 0.35s cubic-bezier(0.16, 1, 0.3, 1), alertGlow 2.5s ease-out;
}

@keyframes cardDropIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes alertGlow {
  0% { box-shadow: 0 0 35px var(--buy-glow); border-color: var(--buy-green); }
  100% { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); border-color: var(--border-card); }
}

/* Card Header */
.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.action-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.pill-buy {
  background: rgba(0, 230, 118, 0.15);
  color: var(--buy-green);
  border: 1.5px solid var(--buy-green);
  box-shadow: 0 0 12px var(--buy-glow);
}

.pill-sell {
  background: rgba(255, 23, 68, 0.15);
  color: var(--sell-red);
  border: 1.5px solid var(--sell-red);
  box-shadow: 0 0 12px var(--sell-glow);
}

.instrument-badge {
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.12);
  color: var(--nifty-blue);
  border: 1px solid rgba(56, 189, 248, 0.3);
  letter-spacing: 0.04em;
}

.instrument-badge.sensex {
  background: rgba(192, 132, 252, 0.12);
  color: var(--sensex-purple);
  border-color: rgba(192, 132, 252, 0.3);
}

.instrument-badge.banknifty {
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.3);
}

/* Strike Price Hero & Entry Badge */
.hero-wrapper {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.15rem;
}

.strike-hero {
  font-size: clamp(1.6rem, 5vw, 2.15rem);
  font-weight: 900;
  letter-spacing: -0.01em;
  color: var(--text-main);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  line-height: 1.1;
}

.entry-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  background: rgba(14, 165, 233, 0.15);
  border: 1.5px solid rgba(56, 189, 248, 0.45);
  color: #38bdf8;
  font-weight: 800;
  font-size: 0.95rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.2);
}

.entry-badge.sell-entry {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.45);
  color: #fb7185;
  box-shadow: 0 0 14px rgba(244, 63, 94, 0.2);
}

/* 3-Column Targets & Stoploss Bento Grid */
.metrics-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  background: #090e1a;
  padding: 0.95rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 1rem;
}

.metric-item {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.metric-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}

.metric-value {
  font-size: clamp(1.05rem, 3.5vw, 1.3rem);
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.val-tp1 {
  color: var(--buy-green);
}

.val-tp2 {
  color: #06b6d4;
}

.val-sl {
  color: var(--sell-red);
}

/* Trader Commentary Callout Box */
.signal-message-card {
  background: rgba(56, 189, 248, 0.06);
  border-left: 3.5px solid #38bdf8;
  border-radius: 0 8px 8px 0;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #e2e8f0;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.signal-message-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 0.05rem;
}

.signal-message-text {
  flex: 1;
  word-break: break-word;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Empty Standby State */
.standby-state {
  text-align: center;
  padding: 4rem 1.5rem;
  background: var(--bg-card);
  border: 1px dashed var(--border-card);
  border-radius: var(--radius-lg);
}

.radar-circle {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  margin: 0 auto 1.5rem;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.2) 0%, transparent 70%);
  border: 2px solid rgba(56, 189, 248, 0.4);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: radarPulse 2s infinite ease-out;
}

@keyframes radarPulse {
  0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.5); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 20px rgba(56, 189, 248, 0); }
  100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Client Tabs (Today vs Past Alerts) */
.client-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  background: rgba(15, 23, 42, 0.7);
  padding: 0.35rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
}

.client-tab-btn {
  flex: 1;
  padding: 0.75rem 0.85rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.client-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.client-tab-btn.active {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: white;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.tab-badge {
  background: rgba(0, 0, 0, 0.35);
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 800;
}

/* History Table in Past Alerts Tab */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
  background: var(--bg-card);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.history-table th {
  background: #090e1a;
  color: var(--text-dim);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-card);
  white-space: nowrap;
}

.history-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-main);
  white-space: nowrap;
}

.history-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.card-time-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* iOS Safari Install Banner */
.ios-install-banner {
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.5), rgba(15, 23, 42, 0.95));
  border: 1.5px solid rgba(56, 189, 248, 0.45);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.45);
  animation: fadeIn 0.4s ease;
}

.ios-banner-content {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  position: relative;
}

.ios-banner-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
  line-height: 1.2;
}

.ios-banner-text {
  flex: 1;
}

.ios-banner-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: #38bdf8;
  margin-bottom: 0.25rem;
  letter-spacing: 0.01em;
}

.ios-banner-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.ios-share-box {
  display: inline-block;
  font-size: 1rem;
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.1);
  padding: 0 0.35rem;
  border-radius: 4px;
  line-height: 1.2;
}

.ios-banner-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0 0.2rem;
  line-height: 1;
}

.ios-banner-close:hover {
  color: var(--text-main);
}

.btn-push-action {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.32rem 0.65rem;
  border-radius: 9999px;
  border: 1px solid rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-push-action.active {
  border-color: rgba(0, 230, 118, 0.4);
  background: rgba(0, 230, 118, 0.15);
  color: var(--buy-green);
}

.btn-push-action:hover {
  transform: scale(1.02);
}

/* Mobile & Tablet Responsive Polish */
@media (max-width: 600px) {
  .container {
    padding: 0.85rem 0.65rem;
  }

  .user-bar {
    padding: 0.75rem 0.85rem;
    gap: 0.6rem;
  }

  .signal-card {
    padding: 1.15rem 1rem;
    border-radius: var(--radius-md);
  }

  .card-top {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .hero-wrapper {
    margin-bottom: 0.85rem;
  }

  .strike-hero {
    font-size: 1.65rem;
  }

  .entry-badge {
    font-size: 0.88rem;
    padding: 0.35rem 0.7rem;
  }

  .metrics-grid-3 {
    padding: 0.75rem 0.65rem;
    gap: 0.4rem;
  }

  .metric-label {
    font-size: 0.62rem;
  }

  .metric-value {
    font-size: 1.05rem;
  }

  .signal-message-card {
    padding: 0.65rem 0.8rem;
    font-size: 0.8rem;
  }

  .history-table th,
  .history-table td {
    padding: 0.65rem 0.75rem;
    font-size: 0.78rem;
  }
}

@media (max-width: 380px) {
  .user-bar-identity {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .btn-disconnect {
    align-self: flex-end;
  }

  .user-bar-controls {
    flex-wrap: wrap;
  }

  .metrics-grid-3 {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }
}

