
/* ═══════════════════════════════════════════
   CHICCA AUTH MODAL — Firebase Login/Register
═══════════════════════════════════════════ */

/* Overlay */
.ch-auth-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(18, 8, 14, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.ch-auth-overlay.active {
  display: flex !important;
  animation: overlay-in .25s ease;
}
@keyframes overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Modal card */
.ch-auth-modal {
  background: #fdf6f0;
  border-radius: 20px;
  padding: 32px 28px 28px;
  width: 100%; max-width: 400px;
  max-height: 92vh; overflow-y: auto;
  box-shadow: 0 24px 80px rgba(18,8,14,.45);
  animation: modal-up .32s cubic-bezier(.22,1,.36,1);
  scrollbar-width: none;
}
.ch-auth-modal::-webkit-scrollbar { display: none; }
@keyframes modal-up {
  from { opacity: 0; transform: translateY(24px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Brand */
.ch-modal-brand {
  text-align: center;
  margin-bottom: 24px;
}
.ch-modal-icon {
  width: 54px; height: 54px;
  background: linear-gradient(135deg, #2e1420, #5c1f32);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  box-shadow: 0 6px 20px rgba(92,31,50,.35);
}
.ch-modal-title {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 1.5rem; font-weight: 700;
  color: #2e1420; margin-bottom: 6px;
}
.ch-modal-sub {
  font-size: .82rem; color: #9a8085;
  line-height: 1.65; font-weight: 300;
}

/* Tabs */
.ch-auth-tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid #e8ddd5;
  margin-bottom: 22px;
}
.ch-auth-tab {
  flex: 1; padding: 10px 0;
  background: none; border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: 'Jost', sans-serif;
  font-size: .75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .14em;
  color: #9a8085; cursor: pointer;
  transition: color .18s, border-color .18s;
}
.ch-auth-tab.active { color: #2e1420; border-bottom-color: #8b2d45; }

/* Fields */
.ch-auth-form { }
.ch-field { margin-bottom: 16px; }
.ch-label {
  display: block;
  font-family: 'Jost', sans-serif;
  font-size: .6rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .16em;
  color: #6a4850; margin-bottom: 7px;
}
.ch-input {
  width: 100%; padding: 12px 14px;
  background: #fff;
  border: 1px solid #e8ddd5;
  border-radius: 8px;
  font-family: 'Jost', sans-serif;
  font-size: .92rem; color: #1e1014;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
}
.ch-input:focus {
  border-color: #8b2d45;
  box-shadow: 0 0 0 3px rgba(139,45,69,.08);
}
.ch-pw-wrap { position: relative; }
.ch-pw-wrap .ch-input { padding-right: 44px; }
.ch-pw-eye {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  cursor: pointer; font-size: .85rem;
  color: #9a8085; padding: 2px;
  transition: color .15s;
}
.ch-pw-eye:hover { color: #8b2d45; }

/* Forgot */
.ch-btn-forgot {
  display: block; background: none; border: none;
  font-family: 'Jost', sans-serif;
  font-size: .75rem; color: #9a8085;
  cursor: pointer; padding: 0;
  margin-bottom: 16px; margin-top: -6px;
  text-align: right; width: 100%;
  transition: color .15s;
}
.ch-btn-forgot:hover { color: #8b2d45; }

/* Primary button */
.ch-btn-primary {
  display: block; width: 100%;
  padding: 13px 20px;
  background: linear-gradient(135deg, #2e1420, #5c1f32);
  color: #fff; border: none; border-radius: 8px;
  font-family: 'Jost', sans-serif;
  font-size: .8rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .12em;
  cursor: pointer; margin-bottom: 14px;
  transition: opacity .2s, transform .15s, box-shadow .2s;
  box-shadow: 0 4px 16px rgba(46,20,32,.25);
}
.ch-btn-primary:hover:not(:disabled) {
  opacity: .92; transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(46,20,32,.32);
}
.ch-btn-primary:disabled { opacity: .55; cursor: wait; }

/* Divider */
.ch-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 14px 0;
}
.ch-divider::before, .ch-divider::after {
  content: ''; flex: 1; height: 1px; background: #e8ddd5;
}
.ch-divider span {
  font-size: .68rem; color: #9a8085;
  text-transform: uppercase; letter-spacing: .1em;
}

/* Google button */
.ch-btn-google {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; width: 100%; padding: 11px 20px;
  background: #fff; border: 1px solid #e8ddd5;
  border-radius: 8px;
  font-family: 'Jost', sans-serif;
  font-size: .82rem; font-weight: 500;
  color: #1e1014; cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.ch-btn-google:hover {
  border-color: #8b2d45;
  box-shadow: 0 2px 10px rgba(0,0,0,.1);
}

/* Status messages */
.ch-auth-msg {
  font-size: .8rem; text-align: center;
  padding: 8px 12px; border-radius: 6px;
  margin-top: 12px; min-height: 0;
  transition: all .2s;
}
.ch-msg-error   { background: #fde8ec; color: #6a0a20; }
.ch-msg-success { background: #e8f8ee; color: #084820; }

/* Terms */
.ch-terms {
  font-size: .7rem; color: #9a8085; text-align: center;
  line-height: 1.65; margin-top: 14px; font-weight: 300;
}
.ch-terms a { color: #8b2d45; text-decoration: underline; }

/* Privacy note */
.ch-privacy-note {
  text-align: center;
  font-size: .68rem; color: #9a8085;
  margin-top: 16px; padding-top: 16px;
  border-top: 1px solid #e8ddd5;
  line-height: 1.7; font-weight: 300;
}

/* ═══════════════════════════════════════════
   USER BAR — shown when logged in
═══════════════════════════════════════════ */
/* ── User tarja — shown in BBT panel when logged in ── */
.ch-user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, #2d1a22 0%, #4a1f10 100%);
  border-radius: 16px;
  margin-bottom: 24px;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: 0 6px 24px rgba(45,26,34,.35);
  position: relative;
  overflow: hidden;
}
.ch-user-bar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200,160,80,.6), transparent);
}
.ch-user-info { display:flex; align-items:center; gap:14px; position:relative; z-index:1; }
.ch-user-avatar {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, #c8a050 0%, #e8781a 100%);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.2rem; color: #fff; font-weight: 600;
  flex-shrink: 0; overflow: hidden;
  box-shadow: 0 0 0 2px rgba(200,160,80,.4), 0 3px 12px rgba(0,0,0,.3);
}
.ch-user-details { display:flex; flex-direction:column; gap:3px; }
.ch-user-greeting {
  display: block;
  font-family: 'Jost', sans-serif;
  font-size: .58rem; font-weight: 500;
  color: rgba(200,160,80,.85);
  text-transform: uppercase; letter-spacing: .18em;
}
.ch-user-name {
  display: block;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.1rem; font-weight: 600;
  color: #fff; letter-spacing: .01em; line-height: 1.15;
}
.ch-user-email {
  display: block;
  font-size: .62rem; color: rgba(255,255,255,.38);
  font-family: 'Jost', sans-serif; margin-top: 1px;
}
.ch-user-actions { display:flex; gap:8px; align-items:center; position:relative; z-index:1; }
.ch-btn-export {
  padding: 7px 14px;
  background: rgba(200,160,80,.15);
  border: 1px solid rgba(200,160,80,.4);
  border-radius: 8px;
  font-family: 'Jost', sans-serif;
  font-size: .67rem; font-weight: 500; letter-spacing: .05em;
  color: #d4a850; cursor: pointer;
  transition: all .22s;
  display: flex; align-items: center; gap: 5px;
}
.ch-btn-export:hover { background:rgba(200,160,80,.28); border-color:rgba(200,160,80,.65); color:#f0c060; }
.ch-btn-signout {
  padding: 7px 14px;
  background: none;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 8px;
  font-family: 'Jost', sans-serif;
  font-size: .67rem; font-weight: 400; letter-spacing: .04em;
  color: rgba(255,255,255,.4); cursor: pointer;
  transition: all .22s;
}
.ch-btn-signout:hover { background:rgba(255,255,255,.08); border-color:rgba(255,255,255,.28); color:rgba(255,255,255,.8); }

/* ── BBT tab lock indicator ── */
.tab-lock-badge {
  font-size: .55rem;
  vertical-align: super;
  margin-left: 3px;
  opacity: .7;
  transition: opacity .2s;
}
.chicca-hub-authenticated .tab-lock-badge {
  display: none;
}

/* Locked tab visual — muted opacity, cursor signals it requires action */
.bbt-tab-locked {
  opacity: .65;
}
.bbt-tab-locked:hover {
  opacity: 1;
}

/* BBT panel auth wall — shown when not authenticated, covers panel content */
#tool-bbt .bbt-auth-wall {
  position: absolute; inset: 0;
  background: rgba(249,243,239,.96);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px; border-radius: 16px; z-index: 20;
  text-align: center; padding: 32px;
  backdrop-filter: blur(4px);
}
#tool-bbt .bbt-auth-wall .aw-icon {
  font-size: 2.4rem; line-height: 1;
}
#tool-bbt .bbt-auth-wall .aw-title {
  font-family: 'Libre Baskerville', serif;
  font-size: 1.1rem; color: var(--noir, #1a1014); font-weight: 700;
}
#tool-bbt .bbt-auth-wall .aw-sub {
  font-size: .82rem; color: var(--muted, #9a8085); line-height: 1.6; max-width: 300px;
}
#tool-bbt .bbt-auth-wall .aw-btn {
  background: var(--wine, #5c1f32); color: #fff;
  border: none; border-radius: 24px; padding: 12px 32px;
  font-family: 'Jost', sans-serif; font-size: .9rem; font-weight: 600;
  cursor: pointer; transition: background .2s; letter-spacing: .03em;
}
#tool-bbt .bbt-auth-wall .aw-btn:hover {
  background: var(--ruby, #8b2d45);
}
.chicca-hub-authenticated #tool-bbt .bbt-auth-wall {
  display: none;
}


/* ── Inline C/F unit toggle inside form label ── */
.unit-inline-btn {
  background: none;
  border: 1px solid var(--sand, #e8ddd5);
  border-radius: 4px;
  padding: 1px 7px;
  font-family: 'DM Mono', monospace;
  font-size: .72rem;
  color: var(--muted, #9a8085);
  cursor: pointer;
  transition: all .16s;
  vertical-align: middle;
}
.unit-inline-btn.active,
.unit-inline-btn:hover {
  background: var(--wine, #5c1f32);
  border-color: var(--wine, #5c1f32);
  color: #fff;
}

/* ── BBT loading spinner ── */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
