/* assets/css/portal.css */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink:       #1e150a;
  --ink-mid:   #4a3520;
  --ink-light: #7a5c38;
  --gold:      #b8862a;
  --gold-lt:   #d4a84b;
  --parch:     #faf6ee;
  --parch2:    #f0e9d8;
  --parch3:    #e0d5c0;
  --white:     #ffffff;
  --red:       #c0392b;
  --red-lt:    #fdf0ee;
  --red-bd:    #f5c6c0;
  --green:     #1a6b3c;
  --green-lt:  #eaf5ee;
  --green-bd:  #b5ddc5;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #0f0a04;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--gold), var(--gold-lt), var(--gold));
  z-index: 100;
}

/* Bookshelf bg */
.bg-shelves {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; justify-content: flex-end;
  pointer-events: none; z-index: 0; opacity: 0.12;
}
.shelf-row { display: flex; align-items: flex-end; padding: 0 8px; gap: 3px; margin-bottom: 2px; }
.spine { border-radius: 1px 1px 0 0; flex-shrink: 0; }

/* Language toggle */
.lang-toggle {
  position: fixed; top: 16px; right: 16px; z-index: 200;
  display: flex;
  background: rgba(30,21,10,0.85);
  border: 1px solid var(--gold);
  border-radius: 20px; overflow: hidden;
  backdrop-filter: blur(4px);
}
.lang-btn {
  padding: 5px 14px; font-size: 12px; font-weight: 500;
  cursor: pointer; border: none; background: transparent;
  color: var(--gold-lt); letter-spacing: 0.06em;
  transition: background 0.2s, color 0.2s;
}
.lang-btn.active { background: var(--gold); color: var(--ink); }

/* Card */
.card {
  position: relative; z-index: 10;
  width: 100%; max-width: 420px;
  background: var(--parch); border-radius: 6px; overflow: hidden;
  box-shadow: 0 12px 48px rgba(0,0,0,0.6), 0 0 0 1px rgba(184,134,42,0.3);
}
.card-header {
  background: var(--ink); padding: 2rem 2rem 1.5rem;
  text-align: center; border-bottom: 3px solid var(--gold);
}
.logo-wrap {
  width: 60px; height: 60px; background: var(--gold); border-radius: 50%;
  margin: 0 auto 1rem;
  display: flex; align-items: center; justify-content: center;
}
.logo-wrap i { font-size: 28px; color: var(--ink); }
.lib-name { font-family: Georgia,'Times New Roman',serif; font-size: 20px; font-weight: 700; color: #f5e8c8; letter-spacing: 0.05em; margin-bottom: 4px; }
.lib-sub  { font-size: 11px; color: #a8906a; letter-spacing: 0.1em; text-transform: uppercase; }

/* Body */
.card-body { padding: 1.75rem 2rem; }

.wifi-badge {
  display: flex; align-items: center; gap: 10px;
  background: var(--parch2); border: 1px solid var(--parch3);
  border-radius: 6px; padding: 10px 14px; margin-bottom: 1.5rem;
}
.wifi-badge i { font-size: 20px; color: var(--gold); }
.wifi-badge strong { display: block; font-size: 14px; color: var(--ink); font-weight: 500; }
.wifi-badge span { font-size: 12px; color: var(--ink-light); }

/* Fields */
.field { margin-bottom: 1rem; }
.field label {
  display: block; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-mid); margin-bottom: 6px;
}
.field input {
  width: 100%; padding: 10px 14px; font-size: 14px;
  border: 1.5px solid var(--parch3); border-radius: 4px;
  background: var(--white); color: var(--ink);
  outline: none; font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,134,42,0.15); }
.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 44px; }
.eye-btn {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--ink-light); font-size: 18px; display: flex; align-items: center;
}

/* Terms */
.terms-row { display: flex; align-items: flex-start; gap: 10px; margin: 1.25rem 0 1.5rem; }
.terms-row input[type="checkbox"] { margin-top: 2px; width: 15px; height: 15px; accent-color: var(--gold); cursor: pointer; flex-shrink: 0; }
.terms-text { font-size: 12px; color: #5c4a2a; line-height: 1.6; }
.terms-text a { color: var(--gold); text-decoration: underline; cursor: pointer; font-weight: 500; }

/* Error */
.error-msg {
  display: none; font-size: 12px; color: var(--red);
  background: var(--red-lt); border: 1px solid var(--red-bd);
  border-radius: 4px; padding: 8px 12px; margin-bottom: 1rem;
  align-items: center; gap: 6px;
}
.error-msg.show { display: flex; }

/* Button */
.btn-login {
  width: 100%; padding: 12px;
  background: var(--ink); color: #f5e8c8;
  border: none; border-radius: 4px;
  font-size: 15px; font-weight: 500; cursor: pointer;
  font-family: Georgia, serif; letter-spacing: 0.05em;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background 0.15s, transform 0.1s;
}
.btn-login:hover { background: #2e1e0a; }
.btn-login:active { transform: scale(0.98); }
.btn-login:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* Footer */
.card-footer {
  background: var(--parch2); border-top: 1px solid var(--parch3);
  padding: 12px 2rem; text-align: center;
}
.card-footer p { font-size: 11px; color: #8a7255; line-height: 1.8; }

/* Success */
.success-screen { padding: 2.5rem 2rem; text-align: center; }
.success-icon {
  width: 64px; height: 64px; background: var(--gold); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 1.25rem;
}
.success-icon i { font-size: 30px; color: var(--white); }
.success-title { font-family: Georgia, serif; font-size: 22px; color: var(--ink); margin-bottom: 8px; }
.success-sub { font-size: 13px; color: var(--ink-light); line-height: 1.7; margin-bottom: 1.5rem; }
.session-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 1.25rem; }
.session-card { background: var(--parch2); border-radius: 4px; padding: 10px; text-align: center; }
.session-card i { font-size: 20px; color: var(--gold); display: block; margin-bottom: 4px; }
.session-card strong { font-size: 14px; color: var(--ink); display: block; }
.session-card small { font-size: 11px; color: var(--ink-light); }
.btn-logout-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 20px; border-radius: 4px;
  background: var(--red-lt); color: var(--red);
  border: 1px solid var(--red-bd); font-size: 13px;
  text-decoration: none; font-weight: 500;
  transition: background 0.15s;
}
.btn-logout-link:hover { background: #fae0dc; }

/* Terms modal */
.modal-bg {
  display: none; position: fixed; inset: 0;
  background: rgba(10,6,2,0.75); z-index: 500;
  align-items: center; justify-content: center; padding: 1rem;
}
.modal-bg.open { display: flex; }
.modal {
  background: var(--parch); border-radius: 6px;
  max-width: 380px; width: 100%; overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.modal-head {
  background: var(--ink); padding: 1rem 1.25rem;
  display: flex; justify-content: space-between; align-items: center;
}
.modal-head span { font-family: Georgia, serif; color: #f5e8c8; font-size: 15px; }
.modal-close { background: none; border: none; color: #a8906a; cursor: pointer; font-size: 20px; display: flex; }
.modal-body {
  padding: 1.25rem; max-height: 320px; overflow-y: auto;
  font-size: 12.5px; color: var(--ink-mid); line-height: 1.75;
}
.modal-body h4 { font-family: Georgia, serif; font-size: 13px; color: var(--ink); margin: 0.9rem 0 4px; font-weight: 700; }
.modal-body h4:first-child { margin-top: 0; }

@media (max-width: 480px) {
  .card-body { padding: 1.25rem; }
}
