/* ═══════════════════════════════════════════════════
   FLUTTER AUTH SHOWCASE — single-screen layout
   prefix: mas-
═══════════════════════════════════════════════════ */

/* ─── Lock the page to viewport ── */

.mas-body {
  overflow: hidden !important;
  height: 100vh !important;
  background: #FFF8DC !important;
}

/* ─── Full-screen split layout ── */

.mas-page {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ══════════════════════════════════════════
   LEFT PANEL — phone stage
═══════════════════════════════════════════ */

.mas-panel-left {
  width: 580px;
  flex-shrink: 0;
  order: 2;
  background: linear-gradient(160deg, #FFF5E0 0%, #FFE8A0 50%, #FFD96020 100%);
  border-left: 1px solid rgba(255, 165, 0, 0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px 24px;
  position: relative;
  overflow: hidden;
}

/* Grid background */
.mas-panel-left::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(200, 120, 0, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(200, 120, 0, 0.14) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}

/* Ambient glow behind phone */
.mas-panel-left::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  height: 400px;
  background: radial-gradient(ellipse, rgba(255, 165, 0, 0.12), transparent 65%);
  filter: blur(20px);
  pointer-events: none;
}

/* Live badge */
.mas-live-badge {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
  border: 1px solid rgba(34, 197, 94, 0.3);
  padding: 6px 16px;
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mas-live-dot {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
  animation: masPulse 1.6s ease-in-out infinite;
}

@keyframes masPulse {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  70%  { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* ─── Phone frame ── */

.mas-phone-wrap {
  position: relative;
  z-index: 2;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.mas-phone-body {
  height: clamp(660px, calc(100vh - 80px), 980px);
  width: auto;
  aspect-ratio: 9 / 20;
  max-width: 460px;
  min-width: 297px;
  background: linear-gradient(160deg, #2c2520, #1a1510, #221d18);
  border-radius: 46px;
  border: 2px solid rgba(255, 165, 0, 0.2);
  position: relative;
  box-shadow:
    0 40px 100px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35);
}

/* Glass gloss */
.mas-phone-body::after {
  content: '';
  position: absolute;
  top: 0;
  left: 12%;
  width: 28%;
  height: 45%;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.07), transparent 60%);
  border-radius: 38px 38px 0 0;
  pointer-events: none;
}

/* Side buttons */
.mas-phone-btn {
  position: absolute;
  background: linear-gradient(180deg, #2e2822, #1e1a16);
  border-radius: 2px;
}

.mas-vol-up   { left: -3px; top: 18%; width: 3px; height: 6%; }
.mas-vol-down { left: -3px; top: 27%; width: 3px; height: 6%; }
.mas-power    { right: -3px; top: 22%; width: 3px; height: 9%; }

/* Dynamic island */
.mas-phone-island {
  position: absolute;
  top: 1.8%;
  left: 50%;
  transform: translateX(-50%);
  width: 33%;
  height: 4%;
  min-height: 24px;
  background: #0a0800;
  border-radius: 16px;
  z-index: 10;
}

/* Screen */
.mas-phone-screen {
  position: absolute;
  inset: 10px;
  border-radius: 36px;
  overflow: hidden;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.mas-phone-screen iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Loading overlay */
.mas-loading-overlay {
  position: absolute;
  inset: 0;
  border-radius: 36px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: opacity 0.5s ease;
}

.mas-loading-overlay.mas-loaded {
  opacity: 0;
  pointer-events: none;
}

.mas-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 165, 0, 0.15);
  border-top-color: #FFA500;
  border-radius: 50%;
  animation: masSpinner 0.75s linear infinite;
}

@keyframes masSpinner {
  to { transform: rotate(360deg); }
}

/* Phone ambient shadow */
.mas-phone-glow {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  height: 50px;
  background: rgba(255, 140, 0, 0.22);
  border-radius: 50%;
  filter: blur(24px);
}

/* Open full screen link */
.mas-open-fs {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.6);
  color: #7a4a00;
  border: 1px solid rgba(255, 165, 0, 0.25);
  padding: 8px 20px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.25s ease;
  backdrop-filter: blur(8px);
}

.mas-open-fs:hover {
  background: rgba(255, 255, 255, 0.85);
  color: #4d2e00;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(180, 120, 0, 0.15);
}

/* ══════════════════════════════════════════
   RIGHT PANEL — info + README
═══════════════════════════════════════════ */

.mas-panel-right {
  flex: 1;
  min-width: 0;
  order: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 28px 52px 28px 48px;
  background: linear-gradient(135deg, #FFFBEF 0%, #FFF8DC 50%, #FFF5D6 100%);
  overflow: hidden;
}

/* ─── Top bar: back + GitHub ── */

.mas-right-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.mas-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #a05a00;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  padding: 6px 0;
}

.mas-back:hover {
  color: #6b3e00;
  transform: translateX(-3px);
}

.mas-gh-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(20, 14, 0, 0.85);
  color: #e8d5a0;
  border: 1px solid rgba(255, 165, 0, 0.18);
  padding: 8px 20px;
  border-radius: 50px;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.25s ease;
}

.mas-gh-btn:hover {
  background: #0d0a00;
  color: #FFD700;
  border-color: rgba(255, 215, 0, 0.35);
  transform: translateY(-1px);
}

/* ─── App identity ── */

.mas-app-identity {
  flex-shrink: 0;
}

.mas-app-title {
  font-size: 2.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, #3d2800 0%, #7a5200 55%, #c87800 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 12px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.mas-app-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.mas-chip {
  background: rgba(255, 255, 255, 0.75);
  color: #6b3e00;
  border: 1px solid rgba(255, 165, 0, 0.25);
  padding: 5px 14px;
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.mas-app-desc {
  font-size: 0.9rem;
  color: rgba(60, 38, 0, 0.6);
  line-height: 1.6;
  margin: 0;
  max-width: 600px;
}

/* ─── Demo credentials ── */

.mas-creds-row {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.mas-cred {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  flex: 1;
  min-width: 0;
}

.mas-cred-admin {
  background: rgba(255, 165, 0, 0.07);
  border: 1px solid rgba(255, 165, 0, 0.2);
}

.mas-cred-user {
  background: rgba(99, 102, 241, 0.05);
  border: 1px solid rgba(99, 102, 241, 0.18);
}

.mas-cred-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.85rem;
}

.mas-cred-admin .mas-cred-icon {
  background: rgba(255, 165, 0, 0.12);
  color: #b36a00;
  border: 1px solid rgba(255, 165, 0, 0.2);
}

.mas-cred-user .mas-cred-icon {
  background: rgba(99, 102, 241, 0.1);
  color: #4f46e5;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.mas-cred-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
}

.mas-cred-role {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.mas-cred-admin .mas-cred-role { color: #b36a00; }
.mas-cred-user  .mas-cred-role { color: #4f46e5; }

.mas-cred-body code {
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 0.8rem;
  color: #3d2800;
  font-weight: 600;
}

.mas-cred-note {
  font-size: 0.7rem;
  color: rgba(60, 38, 0, 0.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── README scrollable card ── */

.mas-readme-card {
  flex: 1;
  min-height: 0; /* crucial: allows flex child to scroll */
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 165, 0, 0.22);
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    0 2px 16px rgba(180, 120, 0, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
}

.mas-readme-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 20px;
  background: rgba(255, 165, 0, 0.06);
  border-bottom: 1px solid rgba(255, 165, 0, 0.14);
  flex-shrink: 0;
}

.mas-readme-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #3d2800;
}

.mas-readme-card-title i { color: #b36a00; }

.mas-readme-packages {
  font-size: 0.72rem;
  color: rgba(60, 38, 0, 0.4);
  font-family: 'Fira Code', monospace;
  letter-spacing: 0.02em;
}

/* Scrollable area */
.mas-readme-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Custom scrollbar */
.mas-readme-scroll::-webkit-scrollbar       { width: 5px; }
.mas-readme-scroll::-webkit-scrollbar-track { background: transparent; }
.mas-readme-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 165, 0, 0.3);
  border-radius: 4px;
}
.mas-readme-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 165, 0, 0.5);
}

/* ─── README sections ── */

.mas-readme-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mas-readme-section h3 {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #b36a00;
  margin: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 165, 0, 0.14);
}

.mas-rm-note {
  font-size: 0.83rem;
  color: rgba(60, 38, 0, 0.6);
  line-height: 1.6;
  margin: 0;
  text-align: left !important;
}

.mas-rm-note strong { color: #3d2800; }

.mas-rm-note code {
  font-family: 'Fira Code', monospace;
  font-size: 0.8rem;
  color: #b35a00;
  background: rgba(255, 165, 0, 0.1);
  padding: 1px 6px;
  border-radius: 4px;
}

/* Architecture layers (compact) */
.mas-layers {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 165, 0, 0.2);
}

.mas-layer {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 165, 0, 0.12);
}

.mas-layer:last-child { border-bottom: none; }

.mas-l-presentation { background: rgba(255, 200, 80, 0.08); }
.mas-l-data         { background: rgba(255, 165, 0, 0.1); }
.mas-l-domain       { background: rgba(255, 140, 0, 0.14); }

.mas-layer-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: #3d2800;
  min-width: 90px;
}

.mas-layer-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mas-layer-chips span {
  background: rgba(255, 255, 255, 0.7);
  color: #6b3e00;
  border: 1px solid rgba(255, 165, 0, 0.18);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}

.mas-layer-sep {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(180, 120, 0, 0.35);
  font-size: 0.65rem;
  padding: 2px 0;
  background: rgba(255, 165, 0, 0.04);
  border-bottom: 1px solid rgba(255, 165, 0, 0.08);
}

/* Code block */
.mas-code-block {
  background: #12100a;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 165, 0, 0.1);
}

.mas-code-dots {
  display: flex;
  gap: 5px;
  padding: 10px 14px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mas-code-dots span {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.mas-code-dots span:nth-child(1) { background: #ff5f57; }
.mas-code-dots span:nth-child(2) { background: #ffbd2e; }
.mas-code-dots span:nth-child(3) { background: #28c840; }

.mas-code-block pre {
  margin: 0;
  padding: 12px 16px;
  overflow-x: auto;
}

.mas-code-block code {
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 0.76rem;
  color: rgba(255, 225, 140, 0.85);
  line-height: 1.7;
  white-space: pre;
}

/* Design decisions */
.mas-decisions {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 165, 0, 0.15);
}

.mas-decision {
  display: flex;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 165, 0, 0.1);
  background: rgba(255, 255, 255, 0.5);
  transition: background 0.2s ease;
}

.mas-decision:last-child { border-bottom: none; }

.mas-decision:hover {
  background: rgba(255, 255, 255, 0.8);
}

.mas-d-q {
  font-size: 0.78rem;
  font-weight: 700;
  color: #3d2800;
  min-width: 175px;
  flex-shrink: 0;
  padding-top: 1px;
}

.mas-d-q code {
  font-size: 0.75rem;
  color: #b35a00;
  background: rgba(255, 165, 0, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: 'Fira Code', monospace;
}

.mas-d-a {
  font-size: 0.78rem;
  color: rgba(60, 38, 0, 0.6);
  line-height: 1.55;
}

.mas-d-a code {
  font-size: 0.75rem;
  color: #b35a00;
  background: rgba(255, 165, 0, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: 'Fira Code', monospace;
}

/* ══════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════ */

@media (max-width: 1200px) {
  .mas-panel-left  { width: 500px; }
  .mas-panel-right { padding: 24px 36px; }
  .mas-app-title   { font-size: 2rem; }
  /* Let aspect-ratio handle width automatically — no width override */
}

@media (max-width: 960px) {
  .mas-body { overflow: auto !important; height: auto !important; }

  .mas-page {
    flex-direction: column;
    height: auto;
  }

  /* In mobile stacked view: info on top (order 1), phone below (order 2) */
  .mas-panel-right {
    order: 1;
    height: auto;
    overflow: visible;
    padding: 28px 20px 20px;
  }

  .mas-panel-left {
    order: 2;
    width: 100%;
    height: auto;
    min-height: 600px;
    border-left: none;
    border-top: 1px solid rgba(255, 165, 0, 0.18);
    padding: 24px 24px 32px;
    gap: 16px;
  }

  .mas-phone-wrap {
    flex: 1;
    min-height: 0;
    width: 100%;
  }

  /* Switch to width-driven sizing in stacked view so the phone fills the space */
  .mas-phone-body {
    height: auto;
    width: clamp(260px, 55vw, 320px);
    max-width: 320px;
    min-width: 260px;
  }

  .mas-readme-card {
    height: 420px;
    flex: none;
  }

  .mas-app-title { font-size: 1.9rem; }
  .mas-app-desc  { font-size: 0.85rem; }
}

@media (max-width: 600px) {
  .mas-panel-left     { min-height: 520px; padding: 16px 16px 24px; }
  .mas-panel-right    { padding: 20px 16px 16px; }
  .mas-app-title      { font-size: 1.55rem; }
  .mas-readme-packages { display: none; }
  .mas-readme-card    { height: 360px; }
  .mas-app-tags       { gap: 6px; }
  .mas-chip           { font-size: 0.72rem; padding: 4px 11px; }
  .mas-phone-body     { width: clamp(240px, 70vw, 290px); }
}
