/* =========================================================
   Restaurant Loyalty System — Public CSS
   Theme: Warm luxury, Japanese restaurant aesthetic
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+JP:wght@300;400;600&family=Noto+Sans+JP:wght@300;400;500;700&display=swap');

:root {
  --rls-primary:   #c8a96e;
  --rls-primary-d: #a8813e;
  --rls-accent:    #1a1a2e;
  --rls-text:      #2d2d2d;
  --rls-muted:     #7a7a7a;
  --rls-border:    #e8e0d4;
  --rls-bg:        #faf8f5;
  --rls-card:      #ffffff;
  --rls-positive:  #2e7d32;
  --rls-negative:  #c62828;
  --rls-radius:    12px;
  --rls-shadow:    0 4px 24px rgba(0,0,0,0.08);
  --rls-font-body: 'Noto Sans JP', sans-serif;
  --rls-font-head: 'Noto Serif JP', serif;
}

/* ---- Base ---- */
.rls-dashboard,
.rls-auth-wrap,
.rls-scanner-front {
  font-family: var(--rls-font-body);
  color: var(--rls-text);
  max-width: 480px;
  margin: 0 auto;
  padding: 0 0 40px;
  background: var(--rls-bg);
  min-height: 100vh;
}

/* ---- Auth ---- */
.rls-auth-wrap {
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.rls-auth-brand {
  font-family: var(--rls-font-head);
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--rls-accent);
  text-align: center;
  margin-bottom: 4px;
}

.rls-auth-subtitle {
  font-size: 0.85rem;
  color: var(--rls-muted);
  margin-bottom: 32px;
  text-align: center;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.rls-auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--rls-border);
  margin-bottom: 28px;
  width: 100%;
}

.rls-auth-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 12px 0;
  font-family: var(--rls-font-body);
  font-size: 0.9rem;
  color: var(--rls-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.rls-auth-tab.active {
  color: var(--rls-primary-d);
  border-bottom-color: var(--rls-primary);
  font-weight: 500;
}

.rls-auth-form {
  display: none;
  width: 100%;
}
.rls-auth-form.active { display: block; }

.rls-auth-note {
  font-size: 0.75rem;
  color: var(--rls-muted);
  text-align: center;
  margin-top: 16px;
  line-height: 1.5;
}

/* ---- Form elements ---- */
.rls-form-group {
  margin-bottom: 18px;
}

.rls-form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--rls-muted);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rls-form-group input,
.rls-form-group select,
.rls-form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--rls-border);
  border-radius: var(--rls-radius);
  font-size: 0.95rem;
  font-family: var(--rls-font-body);
  background: var(--rls-card);
  color: var(--rls-text);
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.rls-form-group input:focus {
  outline: none;
  border-color: var(--rls-primary);
  box-shadow: 0 0 0 3px rgba(200,169,110,0.15);
}

.rls-readonly { background: #f4f0ea !important; color: var(--rls-muted) !important; }

/* ---- Buttons ---- */
.rls-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 22px;
  border-radius: var(--rls-radius);
  font-family: var(--rls-font-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all 0.2s;
  text-decoration: none;
}

.rls-btn-primary {
  background: var(--rls-primary);
  color: #fff;
  border-color: var(--rls-primary);
}
.rls-btn-primary:hover { background: var(--rls-primary-d); border-color: var(--rls-primary-d); }

.rls-btn-outline {
  background: transparent;
  color: var(--rls-primary-d);
  border-color: var(--rls-primary);
}
.rls-btn-outline:hover { background: rgba(200,169,110,0.08); }

.rls-btn-full { width: 100%; }
.rls-btn-sm   { padding: 8px 16px; font-size: 0.8rem; }

.rls-form-error {
  background: #fff5f5;
  border: 1px solid #fcc;
  color: var(--rls-negative);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

/* ---- Dashboard Header ---- */
.rls-dash-header {
  background: var(--rls-accent);
  color: #fff;
  padding: 28px 24px 24px;
  position: relative;
}

.rls-dash-brand {
  font-family: var(--rls-font-head);
  font-size: 1rem;
  font-weight: 300;
  opacity: 0.7;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.rls-dash-greeting {
  font-size: 1.25rem;
  font-weight: 300;
}
.rls-dash-greeting strong { font-weight: 600; }

/* ---- Points Card ---- */
.rls-points-card {
  margin: -1px 0 0;
  background: linear-gradient(135deg, #c8a96e 0%, #e8c87a 50%, #a8813e 100%);
  padding: 28px 24px;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.rls-points-card::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 200px;
  height: 200px;
  background: rgba(255,255,255,0.07);
  border-radius: 50%;
}

.rls-points-card::after {
  content: '';
  position: absolute;
  bottom: -60px;
  left: -30px;
  width: 160px;
  height: 160px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
}

.rls-points-card-inner { position: relative; z-index: 1; }

.rls-points-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.8;
  margin-bottom: 4px;
}

.rls-points-number {
  font-family: var(--rls-font-head);
  font-size: 3.5rem;
  font-weight: 600;
  line-height: 1;
  margin-bottom: 2px;
}

.rls-points-unit {
  font-size: 0.85rem;
  opacity: 0.75;
  margin-bottom: 18px;
}

.rls-points-meta {
  display: flex;
  gap: 24px;
  font-size: 0.8rem;
  opacity: 0.85;
}

/* ---- Tabs ---- */
.rls-dash-tabs {
  display: flex;
  background: var(--rls-card);
  border-bottom: 2px solid var(--rls-border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.rls-dash-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 14px 0;
  font-size: 0.85rem;
  font-family: var(--rls-font-body);
  color: var(--rls-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.rls-dash-tab.active {
  color: var(--rls-primary-d);
  border-bottom-color: var(--rls-primary);
  font-weight: 600;
}

.rls-dash-pane { display: none; }
.rls-dash-pane.active { display: block; }

/* ---- QR Code section ---- */
.rls-qr-section {
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.rls-qr-instruction {
  font-size: 0.85rem;
  color: var(--rls-muted);
  text-align: center;
  max-width: 280px;
  line-height: 1.5;
  margin: 0;
}

.rls-qr-frame {
  background: #fff;
  border-radius: var(--rls-radius);
  padding: 16px;
  box-shadow: var(--rls-shadow);
  border: 3px solid var(--rls-primary);
}

.rls-qr-frame svg { display: block; width: 180px; height: 180px; }

.rls-qr-token {
  font-size: 0.7rem;
  color: var(--rls-muted);
  font-family: monospace;
  letter-spacing: 0.05em;
}

/* ---- Transaction history ---- */
.rls-history-list { padding: 16px; }

.rls-empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--rls-muted);
}
.rls-empty-icon { font-size: 3rem; margin-bottom: 12px; }

.rls-history-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rls-border);
}
.rls-history-item:last-child { border-bottom: none; }

.rls-history-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: var(--rls-bg);
  border-radius: 50%;
  flex-shrink: 0;
}

.rls-history-detail { flex: 1; min-width: 0; }

.rls-history-label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--rls-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rls-history-note { color: var(--rls-muted); font-weight: 400; }

.rls-history-meta {
  font-size: 0.78rem;
  color: var(--rls-muted);
  margin-top: 2px;
}

.rls-history-date {
  font-size: 0.72rem;
  color: var(--rls-muted);
  margin-top: 2px;
}

.rls-history-points {
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.rls-positive { color: var(--rls-positive); }
.rls-negative { color: var(--rls-negative); }

/* ---- Profile ---- */
.rls-profile-section { padding: 24px; }

.rls-profile-logout {
  margin-top: 32px;
  text-align: center;
}

.rls-feedback {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-top: 12px;
}
.rls-feedback.success { background: #e8f5e9; color: #2e7d32; }
.rls-feedback.error   { background: #fff5f5; color: #c62828; }

/* ---- Scanner (Frontend) ---- */
.rls-scanner-front { padding: 24px; }

.rls-scanner-front-header { text-align: center; margin-bottom: 24px; }
.rls-scanner-front-header h2 { font-family: var(--rls-font-head); color: var(--rls-accent); }
.rls-scanner-front-header p  { color: var(--rls-muted); font-size: 0.9rem; }

.rls-scanner-video-box {
  position: relative;
  border-radius: var(--rls-radius);
  overflow: hidden;
  background: #111;
  margin-bottom: 16px;
  min-height: 240px;
}

#rls-front-video-container { width: 100%; }
#rls-front-video-container video { width: 100% !important; height: auto !important; }

.rls-scan-frame-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rls-scan-corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: var(--rls-primary);
  border-style: solid;
}
.rls-scan-corner.tl { top: 20%; left: 20%; border-width: 3px 0 0 3px; }
.rls-scan-corner.tr { top: 20%; right: 20%; border-width: 3px 3px 0 0; }
.rls-scan-corner.bl { bottom: 20%; left: 20%; border-width: 0 0 3px 3px; }
.rls-scan-corner.br { bottom: 20%; right: 20%; border-width: 0 3px 3px 0; }

.rls-scanner-front-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 20px;
}

.rls-manual-lookup {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.rls-manual-lookup input {
  flex: 1;
  padding: 11px 14px;
  border: 1.5px solid var(--rls-border);
  border-radius: var(--rls-radius);
  font-family: var(--rls-font-body);
  font-size: 0.9rem;
}

.rls-front-result {
  background: var(--rls-card);
  border-radius: var(--rls-radius);
  padding: 20px;
  box-shadow: var(--rls-shadow);
}

/* Loading spinner */
.rls-spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: rls-spin 0.7s linear infinite;
  vertical-align: middle;
}
.rls-spinner-dark {
  border-color: rgba(0,0,0,0.15);
  border-top-color: var(--rls-primary);
}
@keyframes rls-spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (min-width: 600px) {
  .rls-dashboard,
  .rls-auth-wrap,
  .rls-scanner-front {
    border-radius: 16px;
    margin: 32px auto;
    min-height: unset;
    box-shadow: 0 8px 48px rgba(0,0,0,0.12);
  }
}
