/* ── Web Cabinet Overrides ─────────────────────────────────────────────────
   Loaded AFTER miniapp/css/app.css — desktop adaptation + shim button styles.
   ──────────────────────────────────────────────────────────────────────── */

/* ── Override TG theme fallbacks for standalone web ── */
:root {
  --bg:         #17212b;
  --secondary:  #232e3c;
  --text:       #f5f5f5;
  --hint:       #708499;
  --link:       #5288c1;
  --accent:     #5288c1;
  --accent-txt: #ffffff;
  --danger:     #ec3942;
  --separator:  rgba(255,255,255,0.05);
}

/* ── Web header (replaces Telegram header) ── */
.web-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--secondary);
  border-bottom: 1px solid var(--separator);
  min-height: 52px;
}

.web-header-logo {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.2px;
}

/* ── Back Button shim ── */
.web-back-btn {
  position: fixed;
  top: 10px;
  left: 12px;
  z-index: 1100;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--secondary);
  color: var(--accent);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s, background 0.15s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.web-back-btn:hover {
  background: var(--accent);
  color: var(--accent-txt);
}

/* ── Main Button shim ── */
.web-main-btn {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 56px;
  border: none;
  background: var(--accent);
  color: var(--accent-txt);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.web-main-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.web-main-btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

/* ── Login screen ── */
.web-login {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 24px;
  text-align: center;
}

.web-login-logo {
  margin-bottom: 20px;
  opacity: 0.9;
}

.web-login-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.web-login-subtitle {
  font-size: 14px;
  color: var(--hint);
  margin-bottom: 24px;
}

/* ── Login tabs ── */
.web-login-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  background: var(--secondary);
  border-radius: var(--r-md);
  padding: 3px;
  width: 100%;
  max-width: 320px;
}

.web-login-tab {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--hint);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: calc(var(--r-md) - 2px);
  transition: all 0.2s;
}

.web-login-tab.active {
  background: var(--accent);
  color: var(--accent-txt);
}

.web-login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.web-login-link-btn {
  background: none;
  border: none;
  color: var(--link);
  font-size: 14px;
  cursor: pointer;
  padding: 8px;
  margin-top: 4px;
}

.web-login-link-btn:hover {
  text-decoration: underline;
}

.web-login-hint {
  font-size: 14px;
  color: var(--hint);
  margin-bottom: 20px;
  max-width: 320px;
  line-height: 1.5;
}

.web-login-input-wrap {
  width: 100%;
  max-width: 320px;
  margin-bottom: 16px;
}

.web-login-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--secondary);
  border: 1px solid var(--separator);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
}

.web-login-input:focus {
  border-color: var(--accent);
}

.web-login-input::placeholder {
  color: var(--hint);
}

.web-login-btn {
  width: 100%;
  max-width: 320px;
  padding: 14px;
  background: var(--accent);
  color: var(--accent-txt);
  border: none;
  border-radius: var(--r-md);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  margin-bottom: 16px;
}

.web-login-btn:hover {
  opacity: 0.85;
}

.web-login-bot-link {
  font-size: 14px;
  color: var(--link);
  text-decoration: none;
  margin-top: 24px;
}

.web-login-bot-link:hover {
  text-decoration: underline;
}

/* ── Guest access block (1-hour bootstrap to reach Telegram) ── */
.web-login-guest {
  margin-top: 28px;
  padding: 20px;
  background: var(--secondary);
  border: 1px solid var(--separator);
  border-radius: var(--r-md);
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.web-login-guest-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.web-login-guest-hint {
  font-size: 13px;
  color: var(--hint);
  margin-bottom: 14px;
  line-height: 1.45;
}

.web-login-btn-secondary {
  background: transparent;
  color: var(--link);
  border: 1px solid var(--link);
  margin-bottom: 0;
}

.web-login-btn-secondary:hover {
  background: var(--link);
  color: var(--accent-txt);
  opacity: 1;
}

.web-login-guest-result {
  margin-top: 14px;
}

.web-login-guest-result .web-login-input-wrap {
  margin-bottom: 10px;
}

.web-login-inline-link {
  color: var(--link);
  text-decoration: underline;
}

/* ── Desktop adaptation (screens > 768px) ── */
@media (min-width: 768px) {
  body {
    background:
      radial-gradient(ellipse at 50% 0%, rgba(82,136,193,0.08) 0%, transparent 60%),
      #0e1621;
  }

  #app {
    max-width: 480px;
    margin: 24px auto;
    min-height: calc(100vh - 48px);
    border-radius: 16px;
    overflow: hidden;
    box-shadow:
      0 0 0 1px rgba(255,255,255,0.06),
      0 8px 40px rgba(0,0,0,0.4);
    position: relative;
  }

  .web-back-btn {
    position: fixed;
    top: 34px;
    left: calc(50% - 228px);
  }

  .web-main-btn {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 0 0 16px 16px;
  }

  .web-login {
    min-height: calc(100vh - 48px);
  }
}

/* ── Large desktop (> 1200px) — wider spacing ── */
@media (min-width: 1200px) {
  #app {
    margin-top: 40px;
    margin-bottom: 40px;
    min-height: calc(100vh - 80px);
  }
}

/* ── Small mobile fix ── */
@media (max-width: 380px) {
  .web-login-title { font-size: 22px; }
  .web-login-hint { font-size: 13px; }
}

/* ── Logout button ── */
.btn-logout {
  display: block;
  width: 100%;
  margin-top: 24px;
  padding: 14px;
  background: transparent;
  border: 1px solid var(--separator);
  border-radius: var(--r-md);
  color: var(--hint);
  font-size: 15px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.btn-logout:hover {
  color: var(--danger);
  border-color: var(--danger);
}

/* ── Web footer (optional branding) ── */
.web-footer {
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: var(--hint);
  opacity: 0.6;
}
