/* =============================================
   Samayik Mandal App — Global Stylesheet
   ============================================= */

:root {
  --primary:    #6C4AB6;
  --primary-dk: #4e3291;
  --accent:     #F9B208;
  --success:    #22c55e;
  --danger:     #ef4444;
  --warning:    #f97316;
  --bg:         #f4f1fb;
  --card:       #ffffff;
  --text:       #1e1b4b;
  --muted:      #6b7280;
  --border:     #e5e7eb;
  --shadow:     0 4px 24px rgba(108,74,182,0.10);
  --radius:     14px;
}

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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ---- NAVBAR ---- */
.navbar {
  background: var(--primary);
  color: #fff;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  position: sticky; top: 0; z-index: 100;
}
.navbar .brand { font-size: 1.1rem; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.navbar .brand .logo { width: 32px; height: 32px; background: var(--accent); border-radius: 50%; display:flex; align-items:center; justify-content:center; font-size: 16px; }
.navbar-actions { display: flex; gap: 10px; align-items: center; }
.badge-role { background: rgba(255,255,255,0.2); border-radius: 20px; padding: 3px 12px; font-size: 0.75rem; font-weight: 600; }
.badge-role.admin { background: var(--accent); color: #1e1b4b; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 22px; border-radius: 10px; border: none; font-size: 0.95rem;
  font-weight: 600; cursor: pointer; transition: all 0.2s; text-decoration: none;
}
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dk); transform: translateY(-1px); }
.btn-accent    { background: var(--accent); color: #1e1b4b; }
.btn-accent:hover  { background: #e09c00; }
.btn-success   { background: var(--success); color: #fff; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-outline   { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; border-radius: 8px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; }
.btn-block { width: 100%; }
.btn-logout { background: rgba(255,255,255,0.15); color: #fff; border: 1px solid rgba(255,255,255,0.3); padding: 6px 14px; font-size:0.82rem; border-radius:8px; }
.btn-logout:hover { background: rgba(255,255,255,0.3); }

/* ---- CARDS ---- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px;
}
.card-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 16px; color: var(--primary); display: flex; align-items: center; gap: 8px; }

/* ---- STATS ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 20px; text-align: center; box-shadow: var(--shadow); }
.stat-card .num { font-size: 2rem; font-weight: 800; color: var(--primary); }
.stat-card .label { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }

/* ---- FORM ---- */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.88rem; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-control {
  width: 100%; padding: 11px 14px; border: 2px solid var(--border);
  border-radius: 10px; font-size: 1rem; transition: border 0.2s; outline: none;
  background: #fafafa;
}
.form-control:focus { border-color: var(--primary); background: #fff; }
.form-control::placeholder { color: #aaa; }

/* ---- ALERTS ---- */
.alert {
  padding: 12px 16px; border-radius: 10px; font-size: 0.9rem; font-weight: 500;
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info    { background: #e0f2fe; color: #0c4a6e; border: 1px solid #bae6fd; }
.alert-warning { background: #fef9c3; color: #854d0e; border: 1px solid #fef08a; }

/* ---- TABLE ---- */
.table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th { background: var(--primary); color: #fff; padding: 10px 14px; text-align: left; font-weight: 600; }
td { padding: 10px 14px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f9f5ff; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; }
.badge-green  { background: #dcfce7; color: #166534; }
.badge-purple { background: #ede9fe; color: #5b21b6; }

/* ---- QR SCANNER ---- */
#qr-reader { width: 100%; border-radius: 12px; overflow: hidden; }
#qr-reader video { border-radius: 12px; }

/* ---- LOGIN PAGE ---- */
.login-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(135deg, #6C4AB6 0%, #4e3291 50%, #F9B208 100%);
}
.login-box { background: #fff; border-radius: 20px; padding: 40px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .icon { font-size: 3rem; }
.login-logo h1 { font-size: 1.4rem; color: var(--primary); font-weight: 800; margin-top: 8px; }
.login-logo p { font-size: 0.85rem; color: var(--muted); }

/* ---- MEMBER QR BOX & PROFILE ---- */
.member-profile-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
}
.member-name {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 10px;
}
.member-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  color: var(--muted);
  font-size: 0.9rem;
}
.member-meta strong { color: var(--text); }
.member-stats {
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  margin-bottom: 0;
}
.stat-card-inner {
  background: var(--bg);
  box-shadow: none;
  border: 1px solid var(--border);
  padding: 14px;
}
.member-qr-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.qr-display { text-align: center; }
.qr-display img { max-width: 170px; width: 100%; border: 3px solid var(--primary); border-radius: 12px; background: #fff; }
.qr-placeholder {
  width: 140px; height: 140px; background: #ede9fe; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 3rem;
}

/* ---- TABS ---- */
.tabs { display: flex; gap: 4px; background: #ede9fe; border-radius: 10px; padding: 4px; margin-bottom: 20px; }
.tab-btn { flex: 1; padding: 8px; border: none; background: transparent; border-radius: 8px; font-weight: 600; cursor: pointer; color: var(--muted); transition: all 0.2s; }
.tab-btn.active { background: #fff; color: var(--primary); box-shadow: 0 2px 8px rgba(108,74,182,0.15); }

/* ---- SPINNER ---- */
.spinner { width: 20px; height: 20px; border: 3px solid rgba(255,255,255,0.4); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- OTP BOXES ---- */
.otp-hint { background: #fef9c3; border: 1px solid #fef08a; border-radius: 8px; padding: 10px 14px; font-size: 0.88rem; color: #854d0e; margin-top: 10px; display: none; }

/* ---- STEP INDICATOR ---- */
.steps-bar { display: flex; gap: 0; margin-bottom: 28px; }
.step { flex:1; text-align:center; }
.step .dot { width: 28px; height: 28px; border-radius: 50%; background: #e5e7eb; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8rem; color: #9ca3af; }
.step.active .dot { background: var(--primary); color: #fff; }
.step.done   .dot { background: var(--success); color: #fff; }
.step .label { font-size: 0.72rem; color: var(--muted); margin-top: 4px; }

/* ---- UTILITY ---- */
.mt-1  { margin-top: 8px; }
.mt-2  { margin-top: 16px; }
.mt-3  { margin-top: 24px; }
.mb-2  { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-muted  { color: var(--muted); font-size: 0.85rem; }
.d-none { display: none; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.page { max-width: 900px; margin: 0 auto; padding: 24px 16px; }
.section-title { font-size: 1rem; font-weight: 700; color: var(--primary); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.scan-result { border-radius: 12px; padding: 16px; margin-top: 14px; display: none; }
.scan-result.success { background: #dcfce7; border: 2px solid #22c55e; }
.scan-result.error   { background: #fee2e2; border: 2px solid #ef4444; }
.scan-result.warning { background: #fef9c3; border: 2px solid #f97316; }

/* Responsive */
@media (max-width: 640px) {
  .login-box { padding: 24px; }
  .navbar .brand span { display: none; }
  .nav-mobile { display: none; }
  .member-profile-card {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .member-meta { justify-content: center; }
  .member-qr-box { margin: 0 auto; }
}
