/* ========================================================
   BOOKIFY ARCHIVE — MODALS & OVERLAYS
   Detail paper grow sheet, Apple Pay checkout & Auth modal
   ======================================================== */

.modal-overlay,
.auth-modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 20, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  padding: 20px;
}

.modal-overlay.active,
.auth-modal.active {
  opacity: 1;
  pointer-events: auto;
}

/* Close button universal */
.detail-close-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 4px;
  transition: background 0.2s;
}

.detail-close-btn:hover {
  background: rgba(20, 20, 20, 0.08);
}

/* Detail Sheet (Paper Grow Reveal) */
.detail-sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--sheet);
  overflow-y: auto;
  overflow-x: hidden;
  display: none;
  opacity: 0;
  clip-path: inset(50% 50% 50% 50% round 3px);
  box-shadow: 0 0 80px rgba(0,0,0,0.3);
}

.detail-sheet.active {
  display: block;
  opacity: 1;
}

.detail-container {
  max-width: 1240px;
  margin: 0 auto;
  min-height: 100%;
  padding: 44px 36px 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
}

.detail-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(20, 20, 20, 0.15);
}

.detail-grid {
  display: grid;
  grid-template-columns: 474px 1fr;
  gap: 64px;
  margin-top: 36px;
  align-items: start;
}

.detail-poster-wrap {
  width: 100%;
  max-width: 474px;
  aspect-ratio: 474 / 900;
  box-shadow: 0 24px 60px -15px rgba(20, 16, 10, 0.45);
  border-radius: 3px;
  overflow: hidden;
  background: #141414;
}

.detail-poster-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
}

.detail-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.detail-title {
  font-family: var(--display);
  font-size: clamp(34px, 4.4vw, 56px);
  line-height: 1.05;
  color: var(--cobalt);
  margin: 0;
}

.detail-meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.meta-tag {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid var(--rule);
  border-radius: 2px;
}

.meta-tag.accent-tag {
  background: var(--cobalt);
  border-color: var(--cobalt);
  color: #FFFFFF;
}

.meta-tag.free-tag {
  background: var(--green);
  border-color: var(--green);
  color: #FFFFFF;
}

.detail-synopsis {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.6;
  color: #2D2B28;
  max-width: 640px;
}

.detail-actions-row {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 12px;
}

.detail-action-btn {
  height: 48px;
  padding: 0 28px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s var(--ease);
  text-decoration: none;
}

.detail-action-btn.buy-action {
  background: var(--cobalt);
  color: #FFFFFF;
  box-shadow: 0 6px 20px rgba(27, 59, 168, 0.35);
}

.detail-action-btn.buy-action:hover {
  background: #122870;
  transform: translateY(-2px);
}

.detail-action-btn.free-action {
  background: var(--green);
  color: #FFFFFF;
  box-shadow: 0 6px 20px rgba(35, 110, 68, 0.35);
}

.detail-action-btn.free-action:hover {
  background: #174E30;
  transform: translateY(-2px);
}

.detail-action-btn.read-action {
  background: #FFFFFF;
  color: var(--ink);
  border: 1px solid var(--rule);
}

.detail-action-btn.read-action:hover {
  background: var(--ink);
  color: #FFFFFF;
}

@media (max-width: 900px) {
  .detail-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .detail-poster-wrap {
    max-width: 300px;
    margin: 0 auto;
  }
}

/* Apple Pay Checkout Modal */
.buy-modal-card {
  background: #FFFFFF;
  width: min(440px, 100%);
  border-radius: 16px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  text-align: center;
  animation: modalSlideUp 0.3s var(--ease);
}

.apple-pay-btn {
  height: 48px;
  background: #000000;
  color: #FFFFFF;
  border: none;
  border-radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}

.apple-pay-btn:hover {
  transform: scale(1.02);
}

/* ========================================================
   USER AUTHENTICATION MODAL (SIGN IN / SIGN UP)
   ======================================================== */
.auth-card {
  background: var(--sheet);
  width: min(440px, calc(100vw - 32px));
  border-radius: 12px;
  border: 1px solid rgba(20, 20, 20, 0.1);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35), 0 4px 16px rgba(0, 0, 0, 0.08);
  padding: 32px 32px 28px;
  display: flex;
  flex-direction: column;
  position: relative;
  animation: modalSlideUp 0.3s var(--ease);
}

.auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(20, 20, 20, 0.08);
  margin-bottom: 16px;
}

.auth-brand {
  display: flex;
  align-items: center;
}

.auth-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(20, 20, 20, 0.14);
  background: transparent;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s var(--ease);
}

.auth-close-btn:hover {
  background: rgba(20, 20, 20, 0.08);
  border-color: var(--ink);
  transform: rotate(90deg);
}

.auth-tabs {
  display: flex;
  gap: 28px;
  border-bottom: 1px solid rgba(20, 20, 20, 0.12);
  margin-bottom: 22px;
  background: transparent;
}

.auth-tab-btn {
  background: none;
  border: none;
  padding: 0 0 10px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
}

.auth-tab-btn:hover {
  color: var(--ink);
}

.auth-tab-btn.active {
  color: var(--cobalt);
  background: transparent;
  border-bottom: none;
}

.auth-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--cobalt);
  border-radius: 2px;
}

.auth-body {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-field-group,
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.auth-label,
.form-label {
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.auth-hint-link {
  font-size: 10.5px;
  color: var(--cobalt);
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.auth-hint-link:hover {
  opacity: 1;
  text-decoration: underline;
}

.auth-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-icon {
  position: absolute;
  left: 14px;
  color: var(--muted);
  opacity: 0.55;
  pointer-events: none;
}

.auth-input,
.form-input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 38px;
  border: 1px solid rgba(20, 20, 20, 0.18);
  border-radius: 6px;
  background: #FFFFFF;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 500;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  box-sizing: border-box;
}

/* Default padding when icon is absent */
.auth-input:not(.auth-input-wrapper .auth-input),
.form-input:not(.auth-input-wrapper .form-input) {
  padding: 0 14px;
}

.auth-input:focus,
.form-input:focus,
.auth-select:focus,
.form-select:focus {
  border-color: var(--cobalt);
  box-shadow: 0 0 0 3px rgba(27, 59, 168, 0.12);
}

.auth-select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-select,
.form-select {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(20, 20, 20, 0.18);
  border-radius: 6px;
  background: #FFFFFF;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  box-sizing: border-box;
}

.auth-submit-btn {
  height: 46px;
  background: var(--cobalt);
  color: #FFFFFF;
  border: 1px solid var(--cobalt);
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
  box-shadow: 0 4px 14px rgba(27, 59, 168, 0.25);
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.auth-submit-btn:hover {
  background: #122870;
  border-color: #122870;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(27, 59, 168, 0.35);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 2px;
}

.auth-divider-line {
  flex: 1;
  height: 1px;
  background: rgba(20, 20, 20, 0.12);
}

.auth-divider-text {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}

.auth-demo-btn {
  height: 42px;
  width: 100%;
  border: 1px solid rgba(27, 59, 168, 0.3);
  background: rgba(27, 59, 168, 0.05);
  border-radius: 6px;
  color: var(--cobalt);
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.auth-demo-btn:hover {
  background: rgba(27, 59, 168, 0.12);
  border-color: var(--cobalt);
  transform: translateY(-1px);
}

.auth-demo-badge {
  font-size: 9.5px;
  font-weight: 700;
  background: var(--cobalt);
  color: #FFFFFF;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.08em;
}



.auth-terms-note {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 4px;
}

.auth-terms-note a {
  color: var(--cobalt);
  text-decoration: none;
  font-weight: 500;
}

.auth-terms-note a:hover {
  text-decoration: underline;
}

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

