/* ============================================
   WiFi QuickPass — Style Sheet
   ============================================ */

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

:root {
  --bg:         #222831;
  --surface:    #393E46;
  --teal:       #00ADB5;
  --teal-dark:  #009299;
  --text:       #EEEEEE;
  --text-muted: rgba(238,238,238,0.55);
  --text-dim:   rgba(238,238,238,0.30);
  --border:     rgba(238,238,238,0.07);
  --radius-xl:  1.5rem;
  --radius-md:  1rem;
  --shadow-teal: 0 0 24px rgba(0,173,181,0.25);
  --transition: 0.3s ease;
}

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
  overflow-x: hidden;
}

/* ---- Decorative Blobs ---- */
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}
.blob-top-left {
  width: 520px; height: 520px;
  top: -15%; left: -15%;
  background: var(--teal);
  opacity: 0.08;
  animation: pulse-blob 8s ease-in-out infinite alternate;
}
.blob-bottom-right {
  width: 480px; height: 480px;
  bottom: -15%; right: -15%;
  background: var(--surface);
  opacity: 0.45;
  animation: pulse-blob 10s ease-in-out infinite alternate-reverse;
}
@keyframes pulse-blob {
  from { transform: scale(1); }
  to   { transform: scale(1.12); }
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(-5rem);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  background: rgba(0,173,181,0.92);
  color: #fff;
  pointer-events: none;
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s ease;
  white-space: nowrap;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.toast.error {
  background: rgba(220,38,38,0.92);
}
.toast-icon {
  display: flex;
  align-items: center;
}

/* ---- App Wrapper ---- */
.app-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

/* ---- Card ---- */
.card {
  width: 100%;
  background: rgba(57,62,70,0.82);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 2rem;
  padding: 2rem;
  box-shadow: 0 24px 64px rgba(0,0,0,0.35);
}

/* ---- Card Header ---- */
.card-header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 2rem;
}
.header-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  background: var(--teal);
  border-radius: 1rem;
  color: var(--text);
  box-shadow: var(--shadow-teal);
  flex-shrink: 0;
}
.header-text h1 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
}
.header-text p {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

/* ---- Form Section ---- */
.form-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.field-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  padding-left: 0.25rem;
}
.field-input {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1rem 1.25rem;
  color: var(--text);
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.15);
}
.field-input::placeholder { color: var(--text-dim); }
.field-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0,173,181,0.15), inset 0 2px 8px rgba(0,0,0,0.15);
}

/* Password Row */
.password-row {
  display: flex;
  gap: 0.75rem;
}
.password-field {
  color: var(--teal) !important;
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 1rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em;
  cursor: default;
}
.btn-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), transform var(--transition);
}
.btn-icon:hover {
  border-color: rgba(0,173,181,0.5);
  color: var(--teal);
}
.btn-icon:active { transform: scale(0.93); }
.btn-icon svg {
  transition: transform 0.5s ease;
}
.btn-icon:hover svg {
  transform: rotate(180deg);
}

/* Primary Button */
.btn-primary {
  width: 100%;
  margin-top: 0.5rem;
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%);
  color: var(--text);
  border: none;
  border-radius: var(--radius-xl);
  padding: 1rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 8px 24px rgba(0,173,181,0.25);
  letter-spacing: 0.01em;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }

/* ---- QR Panel ---- */
.qr-panel {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.6s cubic-bezier(0.4,0,0.2,1), opacity 0.4s ease;
}
.qr-panel.visible {
  max-height: 900px;
  opacity: 1;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 1.75rem 0;
}

/* QR Box */
.qr-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.qr-box {
  background: #fff;
  padding: 1rem;
  border-radius: 1.5rem;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25), 0 0 0 1px rgba(255,255,255,0.05);
  transition: transform 0.5s cubic-bezier(0.34,1.56,0.64,1), filter 0.3s ease;
}
.qr-box.animating {
  transform: scale(0.92);
  filter: blur(4px);
}
.qr-box img {
  display: block;
  border-radius: 0.75rem;
  width: 192px;
  height: 192px;
}
.qr-hint {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Info Cards */
.info-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.info-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.info-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.info-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}
.info-value.mono {
  font-family: 'JetBrains Mono', monospace;
  color: var(--teal);
  font-size: 0.85rem;
}

/* ---- Printer Panel ---- */
.printer-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  margin-top: 1rem;
}
.printer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.printer-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.bt-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  transition: background var(--transition), color var(--transition);
}
.bt-icon-wrap.disconnected {
  background: rgba(238,238,238,0.08);
  color: var(--text-muted);
}
.bt-icon-wrap.connected {
  background: rgba(0,173,181,0.18);
  color: var(--teal);
}
.printer-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: rgba(238,238,238,0.9);
}
.status-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: background var(--transition), box-shadow var(--transition);
}
.status-dot.disconnected { background: #f87171; }
.status-dot.connected {
  background: #4ade80;
  box-shadow: 0 0 8px rgba(74,222,128,0.6);
  animation: blink-dot 2s ease-in-out infinite;
}
@keyframes blink-dot {
  0%,100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.status-text {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Printer Action Buttons */
.printer-actions {
  display: flex;
  gap: 0.75rem;
}
.btn-connect {
  flex: 1;
  background: var(--surface);
  border: none;
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  padding: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background var(--transition), transform var(--transition), opacity var(--transition);
}
.btn-connect:hover { background: rgba(57,62,70,0.7); }
.btn-connect:active { transform: scale(0.95); }
.btn-connect:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-disconnect {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(220,38,38,0.08);
  border: none;
  border-radius: var(--radius-md);
  color: #f87171;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
.btn-disconnect:hover { background: rgba(220,38,38,0.18); }
.btn-disconnect:active { transform: scale(0.93); }

.btn-print {
  flex: 1;
  background: var(--teal);
  border: none;
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  padding: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background var(--transition), opacity var(--transition), transform var(--transition);
  box-shadow: 0 6px 18px rgba(0,173,181,0.22);
}
.btn-print:hover { background: var(--teal-dark); }
.btn-print:active { transform: scale(0.95); }
.btn-print:disabled { opacity: 0.6; cursor: not-allowed; }

/* Spin Animation */
.spin { animation: spin 0.8s linear infinite; }
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ---- Footer ---- */
.app-footer {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  text-align: center;
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
  .card { padding: 1.5rem; border-radius: 1.5rem; }
  .qr-box img { width: 160px; height: 160px; }
  .info-cards { grid-template-columns: 1fr; }
}
