/* ===========================
   KetoFlow — auth.css
   =========================== */

/* ─── Layout ─── */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  padding: 32px 24px;
}

.auth-container {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ─── Logo ─── */
.auth-logo-link { display: block; margin-bottom: 30px; margin-top: -26px; text-decoration: none; }
.auth-logo-img  { height: 160px; width: auto; display: block; transform: scale(1.35); transform-origin: center top; }

/* ─── Titles ─── */
.auth-title {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--green-dark);
  text-align: center;
  margin-bottom: 6px;
  font-family: var(--font-serif);
}
.auth-subtitle {
  font-size: 0.9rem;
  color: var(--green);
  text-align: center;
  margin-bottom: 28px;
  font-weight: 500;
}

/* ─── Message box ─── */
.auth-msg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  margin-bottom: 16px;
  line-height: 1.5;
  width: 100%;
}
.auth-msg.msg-error   { background: #FEF2F2; border: 1px solid #FECACA; color: #991B1B; }
.auth-msg.msg-success { background: var(--green-light); border: 1px solid var(--green-mid); color: var(--green-dark); }
.auth-msg.msg-info    { background: #EFF6FF; border: 1px solid #BFDBFE; color: #1E40AF; }

/* ─── Form ─── */
.auth-form { width: 100%; }

.form-group { margin-bottom: 10px; }

.field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--green-dark);
  margin-bottom: 6px;
}

.field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.field-label-row .field-label { margin-bottom: 0; }

/* ─── Input with icon ─── */
.input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon {
  position: absolute;
  left: 14px;
  width: 17px;
  height: 17px;
  color: var(--text-dim);
  flex-shrink: 0;
  pointer-events: none;
}
.auth-input {
  width: 100%;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  padding: 9px 44px 9px 40px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.auth-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(74,124,47,0.10);
}
.auth-input.input-error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(192,57,43,0.08);
}
.auth-input::placeholder { color: var(--text-dim); }

/* ─── Password eye toggle ─── */
.pwd-toggle {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.pwd-toggle:hover { color: var(--green); }
.eye-icon { width: 18px; height: 18px; display: block; }

/* ─── Password strength ─── */
.pwd-strength-bar {
  height: 3px;
  border-radius: 3px;
  margin-top: 7px;
  background: var(--border);
  overflow: hidden;
}
.pwd-strength-fill {
  height: 100%;
  border-radius: 3px;
  width: 0;
  transition: width 0.3s ease, background-color 0.3s ease;
}
.pwd-strength-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 4px;
  display: block;
}

/* ─── Forgot password link ─── */
.link-btn {
  background: none;
  border: none;
  color: var(--green);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
  padding: 0;
  font-weight: 500;
  white-space: nowrap;
}
.link-btn:hover { color: var(--green-dark); text-decoration: underline; }

/* ─── Ricordami ─── */
.form-check-row { margin-bottom: 20px; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.checkbox-label input[type="checkbox"] { cursor: pointer; accent-color: var(--green); }

/* ─── Submit button ─── */
.btn-auth {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--orange);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  padding: 14px 24px;
  border-radius: 100px;
  border: none;
  box-shadow: 0 2px 12px rgba(245,130,10,0.28);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  outline: 1px solid var(--green);
  outline-offset: 2px;
}
.btn-auth:hover:not(:disabled) {
  background: var(--orange-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(245,130,10,0.38);
}
.btn-auth:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-auth-outline {
  background: transparent;
  color: var(--green-dark);
  border: 1.5px solid var(--border);
  box-shadow: none;
}
.btn-auth-outline:hover:not(:disabled) {
  background: var(--green-light);
  transform: none;
  box-shadow: none;
}

/* ─── Spinner ─── */
.btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { rotate: 360deg; } }

/* ─── Switch link ─── */
.auth-switch {
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 18px;
  margin-bottom: 0;
}
.auth-switch-bottom {
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.switch-btn {
  background: none;
  border: none;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  padding: 0;
}
.switch-btn:hover { color: var(--green-dark); text-decoration: underline; }

/* ─── OAuth divider ─── */
.oauth-divider {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 16px;
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.8px;
}
.oauth-divider::before,
.oauth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── OAuth buttons ─── */
.oauth-grid {
  display: flex;
  gap: 10px;
  width: 100%;
}
.oauth-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 10px;
  border-radius: 100px;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.oauth-btn:hover {
  border-color: var(--border-2);
  background: var(--bg-card);
  transform: translateY(-1px);
}

/* ─── Terms ─── */
.terms-check {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 0.78rem; color: var(--text-dim);
  margin-bottom: 14px; line-height: 1.5; cursor: pointer;
}
.terms-check input[type="checkbox"] {
  margin-top: 2px; flex-shrink: 0;
  width: 15px; height: 15px;
  accent-color: var(--green); cursor: pointer;
}
.terms-check a { color: var(--green); text-decoration: none; font-weight: 600; }
.terms-check a:hover { text-decoration: underline; }

/* ─── Reset back ─── */
.reset-back {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  padding: 0 0 16px;
  font-weight: 500;
  align-self: flex-start;
}
.reset-back:hover { color: var(--green-dark); }

/* ─── Email confirmation ─── */
.confirm-screen {
  text-align: center;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.confirm-icon { font-size: 3rem; margin-bottom: 16px; }
.confirm-screen h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}
.confirm-screen p {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.6;
  margin-bottom: 24px;
}
.confirm-screen strong { color: var(--green-dark); }

/* ─── App Sidebar ───────────────────────────────────────────── */
.sidebar {
  width: 224px;
  background: #2D5016;
  border-right: 1px solid #F5820A;
  box-shadow: 3px 0 24px rgba(245,130,10,0.18);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
  transition: transform 0.3s ease;
}

/* Logo */
.sb-logo { padding: 0 4px; margin-bottom: 28px; }
.sb-logo-link {
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
  background: rgba(255,255,255,0.70);
  border: 1px solid #F5820A;
  border-radius: 16px;
  padding: 10px;
}
.sb-logo-img { width: 150px; height: auto; object-fit: contain; }
.sb-logo-text { font-size: 1.1rem; font-weight: 800; color: #fff; letter-spacing: -0.3px; }
.sb-logo-flow { color: #F5820A; }

/* Nav */
.sb-nav  { flex: 1; overflow-y: auto; }
.sb-nav ul { list-style: none; }
.sb-nav li + li { margin-top: 2px; }
.sb-group-label {
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: #F5820A;
  padding: 14px 12px 4px;
  margin-top: 4px;
}
.sb-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  text-decoration: none;
  font-size: 0.875rem; font-weight: 500;
  color: rgba(255,255,255,0.65);
  transition: all 0.15s;
}
.sb-link:hover  { color: #fff; background: rgba(255,255,255,0.1); }
.sb-link.active {
  color: #fff; background: rgba(255,255,255,0.15);
  font-weight: 600;
  border-left: 3px solid #F5820A;
  padding-left: 9px;
}
.sb-icon { flex-shrink: 0; display: flex; align-items: center; }

/* Footer */
.sb-footer { padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.15); }

/* Percorso attivo */
.sb-percorso {
  background: rgba(255,255,255,0.08);
  border-radius: 10px; padding: 10px 12px;
  margin-bottom: 10px;
}
.sb-percorso-label {
  font-size: 0.65rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; color: rgba(255,255,255,0.45); margin-bottom: 4px;
}
.sb-percorso-nome {
  font-size: 0.82rem; font-weight: 700; color: #fff;
  display: flex; align-items: center; gap: 6px;
}
.sb-percorso-free {
  font-size: 0.6rem; font-weight: 700;
  background: rgba(255,255,255,0.15); color: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.25);
  padding: 1px 6px; border-radius: 100px;
  display: inline-flex; align-items: center; gap: 3px;
}
.sb-percorso-premium {
  font-size: 0.6rem; font-weight: 700; background: #F5820A;
  color: #fff; padding: 1px 6px; border-radius: 100px;
}

/* Upgrade button */
.sb-upgrade {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: #F5820A; color: #fff;
  border-radius: 10px; padding: 9px 12px; margin-bottom: 10px;
  font-size: 0.8rem; font-weight: 700; text-decoration: none;
  transition: background 0.15s, box-shadow 0.15s;
  outline: 1px solid rgba(255,255,255,0.3); outline-offset: 2px;
}
.sb-upgrade:hover { background: #d97008; box-shadow: 0 4px 14px rgba(245,130,10,0.4); }

/* User row */
.sb-user { display: flex; align-items: center; gap: 8px; padding: 6px 4px; }
.sb-avatar {
  width: 30px; height: 30px;
  background: rgba(255,255,255,0.15);
  color: #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; flex-shrink: 0;
  border: 1.5px solid rgba(255,255,255,0.3);
}
.sb-name {
  flex: 1; font-size: 0.8rem; color: rgba(255,255,255,0.8);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500;
}
.sb-icon-btn {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,0.5); padding: 4px;
  border-radius: 6px; transition: color 0.15s, background 0.15s;
  display: flex; align-items: center; text-decoration: none;
}
.sb-icon-btn:hover { color: #fff; background: rgba(255,255,255,0.12); }
.sb-toggle  { display: none; }
.sb-overlay { display: none; }
.app-content { margin-left: 224px; padding: 28px; min-height: 100vh; background: #DFF0D4; }
.app-content-inner { max-width: 1100px; margin: 0 auto; }

/* ─── Responsive ─── */
@media (max-width: 768px) {
  html, body { overflow-x: hidden; max-width: 100vw; }
  .auth-body { padding: 24px 20px; align-items: flex-start; padding-top: 40px; }
  .oauth-btn span { display: none; }

  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .sidebar.open { transform: translateX(0); }
  .sb-overlay.open {
    display: block;
    position: fixed; inset: 0;
    background: rgba(28,43,18,0.4);
    z-index: 40;
  }
  .sb-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    position: fixed; top: 16px; left: 16px;
    z-index: 60;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    box-shadow: var(--shadow);
  }
  .sb-toggle span { display: block; width: 18px; height: 2px; background: var(--green-dark); border-radius: 2px; }
  .app-content { margin-left: 0; padding: 20px 16px; padding-top: 64px; overflow-x: hidden; width: 100%; box-sizing: border-box; }
  .app-content-inner { width: 100%; max-width: 100%; margin: 0; box-sizing: border-box; }
}
