/* ============================================================
   BASE
   ============================================================ */
html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.app-wrapper {
  position: relative;
  min-height: 100vh;
  padding: 1rem;
}

.app-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 5rem 0 3rem;
}

.app-title {
  color: var(--color-text);
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 2rem;
  text-align: center;
  letter-spacing: -0.01em;
}

.input-block,
.button-block,
.result-block {
  width: 100%;
}

.button-block {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
}

.result-block {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
}

/* ============================================================
   THEME TOGGLE (top-right corner)
   ============================================================ */
.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  line-height: 1;
  box-shadow: 0 2px 10px var(--color-shadow);
  transition: transform 0.15s ease, border-color 0.15s ease, background-color 0.3s ease;
}

.theme-toggle:hover {
  border-color: var(--color-primary);
  transform: scale(1.06);
}


/* ============================================================
   GITHUB BUTON (top-left corner)
   ============================================================ */
.github-button {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1000;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  line-height: 1;
  box-shadow: 0 2px 10px var(--color-shadow);
  transition: transform 0.15s ease, border-color 0.15s ease, background-color 0.3s ease;
}

.github-button:hover {
  border-color: var(--color-primary);
  transform: scale(1.06);
}

/* ============================================================
   TEXT FIELD + ERROR BANNER
   ============================================================ */
.text-field {
  width: 100%;
}

.error-banner {
  background: var(--color-error-bg);
  color: var(--color-error-text);
  border: 1px solid var(--color-error-border);
  border-radius: 0.5rem;
  padding: 0.55rem 0.85rem;
  margin-bottom: 0.6rem;
  font-size: 0.9rem;
  line-height: 1.35;
}

.text-field__input {
  width: 100%;
  background: var(--color-input-bg) !important;
  color: var(--color-text) !important;
  border: 1px solid var(--color-border) !important;
  border-radius: 0.5rem !important;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease;
}

.text-field__input:focus {
  border-color: var(--color-input-focus) !important;
  box-shadow: 0 0 0 0.2rem var(--color-primary-soft) !important;
  outline: none;
}

.text-field__input::placeholder {
  color: var(--color-text-muted);
  opacity: 1;
}

/* ============================================================
   SUBMIT BUTTON
   ============================================================ */
.submit-btn {
  background: var(--color-primary);
  color: var(--color-primary-text);
  border: 1px solid var(--color-primary);
  border-radius: 0.5rem;
  padding: 0.6rem 2.5rem;
  font-size: 1rem;
  font-weight: 500;
  min-width: 170px;
  min-height: 44px;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}

.submit-btn:hover:not(:disabled) {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.submit-btn:active:not(:disabled) {
  background: var(--color-primary-active);
  border-color: var(--color-primary-active);
  transform: scale(0.98);
}

.submit-btn:disabled {
  background: var(--color-btn-disabled);
  border-color: var(--color-btn-disabled);
  cursor: not-allowed;
}

/* ============================================================
   RESULT CONTAINER (QR + short link)
   ============================================================ */
.result-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 6px 20px var(--color-shadow);
  min-width: 260px;
  max-width: 100%;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.result-container__qr {
  background: var(--color-qr-bg);   /* always white behind QR */
  padding: 0.75rem;
  border-radius: 0.75rem;
  line-height: 0;
}

.qr-image {
  display: block;
  width: 200px;
  height: 200px;
  max-width: 100%;
}

.result-container__link {
  color: var(--color-link);
  text-decoration: underline;
  text-underline-offset: 3px;
  word-break: break-all;
  text-align: center;
  font-size: 1rem;
  transition: color 0.2s ease;
}

.result-container__link:hover {
  color: var(--color-link-hover);
}

/* ============================================================
   TRANSITIONS
   ============================================================ */

/* Fade + collapse for the error banner */
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.22s ease,
              max-height 0.25s ease,
              margin-bottom 0.25s ease,
              padding-top 0.25s ease,
              padding-bottom 0.25s ease;
  overflow: hidden;
}
.fade-enter-from,
.fade-leave-to {
  opacity: 0;
  max-height: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
}
.fade-enter-to,
.fade-leave-from {
  opacity: 1;
  max-height: 120px;
}

/* Smooth slide-in / slide-out for the result container */
.slide-fade-enter-active,
.slide-fade-leave-active {
  transition: opacity 0.35s ease,
              transform 0.35s ease,
              max-height 0.35s ease,
              margin-top 0.35s ease,
              padding-top 0.35s ease,
              padding-bottom 0.35s ease;
  overflow: hidden;
}
.slide-fade-enter-from,
.slide-fade-leave-to {
  opacity: 0;
  transform: translateY(-12px);
  max-height: 0;
  margin-top: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
}
.slide-fade-enter-to,
.slide-fade-leave-from {
  opacity: 1;
  transform: translateY(0);
  max-height: 520px;
}

/* ============================================================
   MOBILE TWEAKS
   ============================================================ */
@media (max-width: 480px) {
  .app-main {
    padding-top: 4rem;
  }
  .app-title {
    font-size: 1.4rem;
  }
  .qr-image {
    width: 160px;
    height: 160px;
  }
  .submit-btn {
    width: 100%;
  }
}