/* NaaS Global Styles */

/* ── Color Palette (Red spectrum) ────────────────────────────────────────────
   LESSON: These colors were chosen for psychological impact (consumption/desire)
   and accessibility (sufficient contrast). The red palette creates a coherent,
   distinctive brand identity while maintaining dark-mode readiness.
*/

:root {
  /* Primary red palette */
  --color-primary-900: #4A0404;  /* deep bordeaux */
  --color-primary-600: #A82020;  /* rich red — primary buttons */
  --color-primary-500: #CC2936;  /* vibrant red — CTAs */
  --color-primary-400: #E84855;  /* coral — highlights, prices */
  --color-primary-50:  #FFF0F0;  /* near-white pink — background */

  /* Accent */
  --color-accent-gold: #FFB347;  /* gold — premium badges, stars */
  --color-accent-dark: #1A0A0A;  /* near-black — text */

  /* Neutral */
  --color-neutral-50: #FFFFFF;
  --color-neutral-100: #F5F5F5;
  --color-neutral-200: #E0E0E0;
  --color-neutral-300: #CCCCCC;
  --color-neutral-500: #777777;
  --color-neutral-700: #333333;
  --color-neutral-900: #000000;

  /* Semantic */
  --color-success: #4CAF50;
  --color-warning: #FF9800;
  --color-error: #F44336;
  --color-info: #2196F3;

  /* Typography */
  --font-display: "Fredoka One", sans-serif;     /* headings: rounded, bold */
  --font-body: "Nunito", sans-serif;             /* body: readable, rounded */

  /* Spacing (8px base unit) */
  --spacing-xs: 0.25rem;   /* 4px */
  --spacing-sm: 0.5rem;    /* 8px */
  --spacing-md: 1rem;      /* 16px */
  --spacing-lg: 1.5rem;    /* 24px */
  --spacing-xl: 2rem;      /* 32px */
  --spacing-2xl: 3rem;     /* 48px */

  /* Shadows — red-tinted */
  --shadow-sm: 0 2px 4px rgba(168, 32, 32, 0.08);
  --shadow-md: 0 4px 8px rgba(168, 32, 32, 0.10);
  --shadow-lg: 0 8px 32px rgba(168, 32, 32, 0.12);
  --shadow-xl: 0 16px 48px rgba(168, 32, 32, 0.15);

  /* Border radius */
  --radius-sm: 0.25rem;    /* 4px */
  --radius-md: 0.5rem;     /* 8px */
  --radius-lg: 1rem;       /* 16px */
  --radius-pill: 999px;    /* pill buttons */

  /* Transitions */
  --transition-fast: 150ms ease-out;
  --transition-normal: 300ms ease-out;
  --transition-slow: 500ms ease-out;
}

/* ── Global Reset ────────────────────────────────────────────────────────────*/

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-accent-dark);
  background-color: var(--color-primary-50);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Typography ──────────────────────────────────────────────────────────────*/

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-accent-dark);
}

h1 {
  font-size: 3rem;
  margin: var(--spacing-lg) 0 var(--spacing-md);
}

h2 {
  font-size: 2rem;
  margin: var(--spacing-lg) 0 var(--spacing-md);
}

h3 {
  font-size: 1.5rem;
  margin: var(--spacing-md) 0 var(--spacing-sm);
}

p {
  margin: var(--spacing-md) 0;
}

a {
  color: var(--color-primary-500);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-600);
  text-decoration: underline;
}

/* ── Form Elements ───────────────────────────────────────────────────────────*/

input,
textarea,
select,
button {
  font-family: var(--font-body);
  font-size: 1rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea {
  width: 100%;
  padding: var(--spacing-md);
  border: 1px solid var(--color-neutral-300);
  border-radius: var(--radius-md);
  background-color: var(--color-neutral-50);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary-500);
  box-shadow: 0 0 0 3px rgba(204, 41, 54, 0.1);
}

button {
  padding: var(--spacing-md) var(--spacing-lg);
  border: none;
  border-radius: var(--radius-pill);
  background-color: var(--color-primary-500);
  color: var(--color-neutral-50);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

button:hover {
  background-color: var(--color-primary-600);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Utility Classes ─────────────────────────────────────────────────────────*/

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-md {
  gap: var(--spacing-md);
}

.mt-md {
  margin-top: var(--spacing-md);
}

.mb-md {
  margin-bottom: var(--spacing-md);
}

.text-center {
  text-align: center;
}

/* ── Loading Shimmer Animation ──────────────────────────────────────────────*/

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.shimmer {
  animation: shimmer 2s infinite;
  background: linear-gradient(
    90deg,
    var(--color-neutral-200) 25%,
    var(--color-neutral-100) 50%,
    var(--color-neutral-200) 75%
  );
  background-size: 1000px 100%;
}

/* ── Responsive ──────────────────────────────────────────────────────────────*/

@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.25rem;
  }

  body {
    font-size: 0.9375rem;
  }
}

/* ── Toast Notifications ─────────────────────────────────────────────────── */

.toast-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9000;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 400px;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-family: var(--font-body);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  pointer-events: all;
  animation: toast-in 0.2s ease-out;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.toast--success { background: #E8F5E9; color: #1B5E20; border-left: 4px solid var(--color-success); }
.toast--error   { background: #FFEBEE; color: #B71C1C; border-left: 4px solid var(--color-error); }
.toast--info    { background: #E3F2FD; color: #0D47A1; border-left: 4px solid var(--color-info); }

.toast__msg  { flex: 1; }
.toast__close {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.6;
  line-height: 1;
  padding: 0 2px;
}
.toast__close:hover { opacity: 1; }

@media (max-width: 480px) {
  .toast-stack { left: 12px; right: 12px; bottom: 12px; }
  .toast { min-width: unset; }
}

/* ── KYC Banner ──────────────────────────────────────────────────────────── */

.kyc-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #FFF8E1;
  border: 1px solid #FFB300;
  border-radius: 10px;
  padding: 12px 18px;
  margin-bottom: 20px;
  font-size: 0.95rem;
  color: #5D4037;
}

.kyc-banner__link {
  color: var(--color-primary-600);
  font-weight: 700;
  text-decoration: underline;
  white-space: nowrap;
}

/* ── Email OTP ────────────────────────────────────────────────────────────── */
.email-otp {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.email-otp__title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-accent-dark);
  margin: 0;
}

.email-otp__desc {
  font-size: 0.95rem;
  color: var(--color-accent-dark);
  opacity: 0.75;
  margin: 0;
}

.email-otp__error {
  color: var(--color-primary-500);
  font-size: 0.9rem;
  margin: 0;
}

.email-otp__success {
  color: #2e7d32;
  font-size: 0.9rem;
  margin: 0;
}

.email-otp__verify {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.email-otp__code-input {
  font-size: 1.5rem;
  letter-spacing: 0.4em;
  text-align: center;
  font-family: monospace;
  max-width: 200px;
}

.email-otp__resend {
  font-size: 0.85rem;
  background: none;
  border: none;
  color: var(--color-primary-600);
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  align-self: flex-start;
}

.email-otp__resend:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Notification Bell ───────────────────────────────────────────────────── */
.notif-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.notif-bell__btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  position: relative;
  font-size: 1.2rem;
  line-height: 1;
  border-radius: 8px;
  transition: background 0.15s;
}

.notif-bell__btn:hover {
  background: rgba(168, 32, 32, 0.08);
}

.notif-bell__icon {
  font-size: 1.2rem;
}

.notif-bell__badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--color-primary-500);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 320px;
  background: #fff;
  border: 1px solid rgba(168, 32, 32, 0.15);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(168, 32, 32, 0.12);
  z-index: 200;
  overflow: hidden;
}

.notif-dropdown__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(168, 32, 32, 0.08);
}

.notif-dropdown__title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-accent-dark);
}

.notif-dropdown__mark-read {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-primary-600);
  font-size: 0.8rem;
  text-decoration: underline;
}

.notif-dropdown__mark-read:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.notif-dropdown__empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--color-accent-dark);
  opacity: 0.5;
  font-size: 0.9rem;
  margin: 0;
}

.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(168, 32, 32, 0.05);
  transition: background 0.15s;
}

.notif-item:last-child {
  border-bottom: none;
}

.notif-item:hover {
  background: var(--color-primary-50, #fff0f0);
}

.notif-item--unread {
  background: rgba(232, 72, 85, 0.05);
  border-left: 3px solid var(--color-primary-500);
}

.notif-item--unread:hover {
  background: rgba(232, 72, 85, 0.1);
}

.notif-item__text {
  font-size: 0.88rem;
  color: var(--color-accent-dark);
  text-decoration: none;
  display: block;
}

.notif-item__text:hover {
  color: var(--color-primary-600);
  text-decoration: underline;
}
