/* ═══════════════════════════════════════════════════
   OPHIRA Billing System — Design System
   Brand: Luxury jewelry, refined minimal
   ═══════════════════════════════════════════════════ */

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

/* ─── CSS Variables ─── */
:root {
  --wine:        #722F37;       /* Primary brand — deep wine */
  --wine-dark:   #4E1F26;       /* Hover / dark variant */
  --wine-light:  #9B4D56;       /* Accent / lighter tint */
  --gold:        #C9A96E;       /* Secondary brand — warm gold */
  --gold-light:  #E8D5B0;       /* Gold tint for backgrounds */
  --cream:       #FAF7F2;       /* Page background */
  --white:       #FFFFFF;
  --text-dark:   #1A1A1A;       /* Primary text */
  --text-mid:    #5A5A5A;       /* Secondary text */
  --text-light:  #9A9A9A;       /* Placeholder / hint */
  --border:      #E5DDD5;       /* Subtle border */
  --border-dark: #C5BAB0;       /* Stronger border */
  --danger:      #C0392B;       /* Error red */
  --success:     #27AE60;       /* Success green */
  --warning:     #E67E22;       /* Warning orange */

  --shadow-sm:   0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.14);

  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-lg:   20px;

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;

  --transition:  all 0.22s ease;
}

/* ─── Reset ─── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background-color: var(--cream);
  color: var(--text-dark);
  line-height: 1.6;
  min-height: 100vh;
}

/* ─── Typography ─── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0.01em;
}

h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: clamp(1.1rem, 2vw, 1.4rem); }

/* ─── Layout ─── */
.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ─── Auth Layout (Login / Change Password) ─── */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(114,47,55,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(201,169,110,0.08) 0%, transparent 60%),
    var(--cream);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: cardAppear 0.4s ease both;
}

@keyframes cardAppear {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.auth-header {
  background: linear-gradient(135deg, var(--wine-dark) 0%, var(--wine) 100%);
  padding: 36px 32px 28px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.auth-header::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(201,169,110,0.12);
}

.auth-header::after {
  content: '';
  position: absolute;
  bottom: -60px; left: -30px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
}

.auth-logo {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 300;
  color: var(--white);
  letter-spacing: 0.25em;
  position: relative;
  z-index: 1;
}

.auth-logo span {
  color: var(--gold);
}

.auth-subtitle {
  margin-top: 6px;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.65);
  font-weight: 400;
  position: relative;
  z-index: 1;
}

.auth-body {
  padding: 32px;
}

/* ─── Forms ─── */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mid);
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  padding: 13px 16px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-dark);
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  outline: none;
  -webkit-appearance: none;
}

.form-control:focus {
  border-color: var(--wine-light);
  box-shadow: 0 0 0 3px rgba(114,47,55,0.10);
}

.form-control::placeholder {
  color: var(--text-light);
}

.form-control.is-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(192,57,43,0.10);
}

/* Input with icon */
.input-wrapper {
  position: relative;
}

.input-wrapper .form-control {
  padding-left: 44px;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  width: 18px;
  height: 18px;
  pointer-events: none;
}

/* Password toggle */
.password-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  padding: 2px;
  transition: var(--transition);
}
.password-toggle:hover { color: var(--wine); }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--wine) 0%, var(--wine-dark) 100%);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(114,47,55,0.35);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--wine-light) 0%, var(--wine) 100%);
  box-shadow: 0 4px 14px rgba(114,47,55,0.40);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-full {
  width: 100%;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--wine);
  color: var(--wine);
}

.btn-outline:hover {
  background: var(--wine);
  color: var(--white);
}

.btn-ghost {
  background: transparent;
  color: var(--text-mid);
}

.btn-ghost:hover {
  background: var(--border);
  color: var(--text-dark);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}

/* ─── Alerts / Flash Messages ─── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 20px;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.alert-error   { background: #FDF0EF; border: 1px solid #F5C6C2; color: var(--danger); }
.alert-success { background: #EAF8F0; border: 1px solid #A9DFC0; color: #1E8449; }
.alert-warning { background: #FEF9F0; border: 1px solid #FAD7A0; color: #935116; }
.alert-info    { background: #EBF5FB; border: 1px solid #AED6F1; color: #1A5276; }

.alert-icon { flex-shrink: 0; margin-top: 1px; }

/* ─── Navigation (Top Bar) ─── */
.topbar {
  background: linear-gradient(135deg, var(--wine-dark) 0%, var(--wine) 100%);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-brand {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  color: var(--white);
  text-decoration: none;
}

.topbar-brand span { color: var(--gold); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-store {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.12);
  padding: 5px 12px;
  border-radius: 20px;
}

.topbar-user {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.9);
  font-weight: 500;
}

.btn-logout {
  padding: 7px 16px;
  font-size: 0.8rem;
  background: rgba(255,255,255,0.15);
  color: var(--white);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-body);
  transition: var(--transition);
  text-decoration: none;
}

.btn-logout:hover {
  background: rgba(255,255,255,0.25);
}

/* ─── Dashboard Layout ─── */
.dashboard {
  padding: 32px 24px;
  max-width: 1100px;
  margin: 0 auto;
}

.dashboard-header {
  margin-bottom: 32px;
}

.dashboard-title {
  color: var(--wine-dark);
}

.dashboard-meta {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 4px;
}

/* ─── Cards ─── */
.card {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--wine-dark);
}

.card-body {
  padding: 24px;
}

/* ─── Password Rules Hint ─── */
.password-rules {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-top: 6px;
  line-height: 1.6;
}

.password-rules li {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  padding: 1px 0;
  transition: color 0.2s;
}

.password-rules li.valid   { color: var(--success); }
.password-rules li.invalid { color: var(--text-light); }

/* ─── Form Footer (inside auth) ─── */
.auth-footer {
  margin-top: 8px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-light);
}

/* ─── Divider ─── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* ─── Spinner ─── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Responsive ─── */
@media (max-width: 480px) {
  .auth-page     { padding: 16px; }
  .auth-body     { padding: 24px; }
  .auth-header   { padding: 28px 24px 22px; }
  .auth-logo     { font-size: 1.8rem; }
  .topbar        { padding: 0 16px; }
  .dashboard     { padding: 24px 16px; }
}

/* ─── Utility Classes ─── */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-wine    { color: var(--wine); }
.text-gold    { color: var(--gold); }
.text-muted   { color: var(--text-light); }
.mt-4         { margin-top: 4px; }
.mt-8         { margin-top: 8px; }
.mt-16        { margin-top: 16px; }
.mt-24        { margin-top: 24px; }
.mb-0         { margin-bottom: 0; }
.d-none       { display: none !important; }
