/* ==========================================================================
   AlicePush — Light & Airy Design System (inspired by alice.yandex.ru)
   Theme: Snow White, Minimalist Charcoal, & Signature Alice Violet (#7A55FF)
   ========================================================================== */

:root {
  /* Colors */
  --bg-page: #f8f9fd;
  --bg-card: #ffffff;
  --bg-card-subtle: #fbfbfe;
  --bg-input: #f4f5f9;
  --bg-input-focus: #ffffff;
  
  /* Alice Signature Purple */
  --alice-purple: #7a55ff;
  --alice-purple-hover: #673df6;
  --alice-purple-light: #f2eeff;
  --alice-purple-border: #ded5ff;
  --alice-gradient: linear-gradient(135deg, #7a55ff 0%, #9065ff 100%);
  --alice-shadow: 0 4px 20px rgba(122, 85, 255, 0.28);
  
  /* Text */
  --text-main: #19191d;
  --text-secondary: #575762;
  --text-muted: #8b8b98;
  
  /* Functional */
  --success: #00b341;
  --success-light: #edfcf2;
  --success-border: #bbf3ce;
  --danger: #ff3b30;
  --danger-light: #fff1f0;
  --danger-border: #ffd2cf;
  
  /* Borders & Shadows */
  --border-subtle: rgba(0, 0, 0, 0.07);
  --border-card: rgba(0, 0, 0, 0.08);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 9999px;
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.08);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'YS Text', 'YS Geo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-page);
  background-image: radial-gradient(circle at 50% 0%, #ede7ff 0%, #f8f9fd 45%);
  background-repeat: no-repeat;
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 36px 18px;
}

.app-container {
  width: 100%;
  max-width: 660px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo-orb {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--alice-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(122, 85, 255, 0.35);
  flex-shrink: 0;
}

.logo-orb svg {
  width: 20px;
  height: 20px;
  fill: #ffffff;
}

.logo-text h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text-main);
  line-height: 1.15;
}

.badge-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.2px;
}

.oauth-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
  transition: all 0.2s ease;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  flex-shrink: 0;
}

.oauth-badge.configured .status-dot {
  background: var(--success);
}

.oauth-badge.unconfigured .status-dot {
  background: var(--danger);
}

/* Main Card */
.main-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: all 0.25s ease;
}

/* Step Sections */
.step-section {
  padding: 32px 32px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.step-section:last-child {
  border-bottom: none;
}

.step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--alice-purple-light);
  color: var(--alice-purple);
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.step-header h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-main);
}

.step-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 22px;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

input[type="text"],
input[type="password"],
.custom-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid #e2e2ea;
  border-radius: var(--radius-md);
  color: var(--text-main);
  padding: 12px 16px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
.custom-select:focus {
  border-color: var(--alice-purple);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px rgba(122, 85, 255, 0.15);
}

.custom-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23707076' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 600;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  user-select: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Alice Purple Button */
.btn-primary {
  background: var(--alice-purple);
  color: #ffffff;
  padding: 12px 24px;
  font-size: 14px;
  box-shadow: 0 2px 10px rgba(122, 85, 255, 0.25);
}

.btn-primary:hover:not(:disabled) {
  background: var(--alice-purple-hover);
  box-shadow: var(--alice-shadow);
  transform: translateY(-1px);
}

/* Secondary Button */
.btn-secondary {
  background: #f0f0f5;
  color: var(--text-main);
  padding: 12px 20px;
  font-size: 14px;
}

.btn-secondary:hover:not(:disabled) {
  background: #e5e5ec;
}

/* Giant Yandex ID Button */
.btn-yandex {
  background: #ffffff;
  color: #19191d;
  border: 1px solid #dedee6;
  font-size: 15px;
  font-weight: 600;
  padding: 15px 28px;
  border-radius: var(--radius-pill);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.btn-yandex:hover:not(:disabled) {
  background: #fbfbfe;
  border-color: #c7c7d4;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

/* Success / Trigger Push Button */
.btn-success {
  background: var(--alice-purple);
  color: #ffffff;
  padding: 14px 24px;
  font-size: 14px;
  box-shadow: 0 4px 16px rgba(122, 85, 255, 0.3);
}

.btn-success:hover:not(:disabled) {
  background: var(--alice-purple-hover);
  box-shadow: 0 6px 24px rgba(122, 85, 255, 0.45);
  transform: translateY(-1px);
}

/* Danger Button */
.btn-danger {
  background: var(--danger-light);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  padding: 6px 14px;
  font-size: 12px;
}

.btn-danger:hover:not(:disabled) {
  background: #ffe3e1;
}

.btn-giant {
  width: 100%;
  font-size: 15px;
  font-weight: 700;
  padding: 16px 24px;
  letter-spacing: 0.3px;
  border-radius: var(--radius-pill);
}

.btn-large {
  padding: 14px 22px;
  font-size: 14px;
}

.btn-small {
  font-size: 12px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
}

.btn-icon-only {
  background: #f0f0f5;
  border: 1px solid #e0e0e6;
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-icon-only:hover {
  background: #e5e5ec;
}

/* 1. GATEKEEPER SCREEN */
.gate-header {
  text-align: center;
  padding: 12px 10px 24px 10px;
}

.gate-orb-container {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.gate-alice-orb {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--alice-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 30px rgba(122, 85, 255, 0.35);
  position: relative;
}

.gate-alice-orb svg {
  width: 36px;
  height: 36px;
  fill: #ffffff;
}

.gate-header h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text-main);
  margin-bottom: 8px;
}

.gate-actions {
  max-width: 400px;
  margin: 0 auto;
}

/* 2. AUTHENTICATED AREA */
.account-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-pill);
  padding: 8px 18px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.account-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar-badge {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--alice-purple-light);
  color: var(--alice-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
}

.user-name-text {
  font-weight: 600;
  color: var(--text-main);
  font-size: 14px;
}

/* Tab Switcher (Segmented Control) */
.tab-switcher {
  display: flex;
  background: #edeef3;
  border-radius: var(--radius-pill);
  padding: 4px;
  margin-bottom: 20px;
  gap: 4px;
}

.tab-btn {
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  white-space: nowrap;
}

.tab-btn.active {
  background: #ffffff;
  color: var(--text-main);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tab-btn:hover:not(.active) {
  color: var(--text-main);
}

@media (max-width: 640px) {
  .tab-switcher {
    flex-direction: column;
    border-radius: var(--radius-md);
    padding: 6px;
  }
  .tab-btn {
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    white-space: normal;
  }
}

/* Two Buttons Grid for Direct Mode */
.two-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 20px;
}

@media (max-width: 540px) {
  .two-buttons-grid {
    grid-template-columns: 1fr;
  }
}

/* Active Card / Banner */
.active-session-banner {
  background: var(--alice-purple-light);
  border: 1px solid var(--alice-purple-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-top: 18px;
}

.session-info-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.session-info-badge .label {
  font-size: 13px;
  font-weight: 600;
  color: var(--alice-purple);
}

.session-id-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  background: #ffffff;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--alice-purple-border);
}

.session-note {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

/* Cookies Box */
.cookies-box {
  background: #fafafc;
  border: 1px solid #e8e8ee;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 20px;
}

.cookies-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge-tag {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: #edeef3;
  color: var(--text-secondary);
}

.badge-tag.ok {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.btn-text {
  background: none;
  border: none;
  color: var(--alice-purple);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-text:hover {
  color: var(--alice-purple-hover);
}

.custom-cookies-form {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cookies-actions-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  background: #edeef3;
  color: #242429;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #d4d5dc;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
}

.field-hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* Household and Scenario Controls */
.household-selector-wrapper, .select-row {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
}

/* Variant Header Banners */
.variant-banner {
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 24px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.variant-banner-auto {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.variant-banner-manual {
  background: #fffbeb;
  border-color: #fde68a;
}

.variant-banner-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  margin-bottom: 8px;
}

.variant-banner-auto .variant-banner-badge {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.variant-banner-manual .variant-banner-badge {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
}

.variant-banner-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.variant-banner-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
}

/* Guide Box */
.guide-box {
  background: #f7f6fc;
  border: 1px solid #e6e3f2;
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin-bottom: 22px;
}

.guide-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--alice-purple);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.guide-steps {
  padding-left: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.guide-steps li {
  margin-bottom: 6px;
}

.guide-steps li:last-child {
  margin-bottom: 0;
}

.guide-steps strong {
  color: var(--text-main);
}

.session-id-pill {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: #edeef3;
  border: 1px solid #dedee6;
  color: var(--alice-purple);
  padding: 2px 8px;
  border-radius: 6px;
}

/* Results */
.result-box {
  margin-top: 18px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  animation: fadeInSlide 0.25s ease;
}

.result-box.success {
  background: var(--success-light);
  border: 1px solid var(--success-border);
  color: #06762b;
}

.result-box.error {
  background: var(--danger-light);
  border: 1px solid var(--danger-border);
  color: #c92a2a;
}

/* Modal */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-content {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
}

.modal-content h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}

.input-readonly {
  background: #ececf2 !important;
  color: var(--text-secondary) !important;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

/* Footer */
.app-footer {
  margin-top: 28px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.app-footer a {
  color: var(--alice-purple);
  text-decoration: none;
}

.app-footer a:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

@keyframes fadeInSlide {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
