/* ============================================
   CATICASH - Design System
   Palette: Blanc / Bleu / Noir / Gris
   LIGHT & MODERN THEME
   ============================================ */

:root {
  /* Core Colors - LIGHT THEME */
  --bg: #f8fafc;
  --bg-subtle: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #e2e8f0;

  /* Text */
  --text: #0f172a;
  --text-secondary: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;

  /* Brand - Blue accent */
  --primary: #2563eb;
  --primary-light: #3b82f6;
  --primary-dark: #1d4ed8;
  --primary-glow: rgba(37, 99, 235, .1);
  --primary-gradient: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);

  /* Status */
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #0ea5e9;

  /* Borders & Shadows */
  --border: #e2e8f0;
  --border-light: #cbd5e1;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, .1), 0 2px 4px -2px rgba(0, 0, 0, .1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -4px rgba(0, 0, 0, .1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, .1), 0 8px 10px -6px rgba(0, 0, 0, .1);

  /* Radius */
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --radius-full: 9999px;

  /* Sizing */
  --tap: 48px;

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ============================================
   Reset & Base
   ============================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0
}

html,
body {
  height: 100%
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none
}

button,
input,
select,
textarea {
  font: inherit;
  border: none;
  background: none
}

button {
  cursor: pointer
}

img {
  max-width: 100%;
  display: block
}

.hidden {
  display: none !important
}

/* ============================================
   Splash Screen
   ============================================ */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity .6s ease;
}

.splash-screen.fade-out {
  opacity: 0;
  pointer-events: none
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

.splash-logo-main {
  width: 120px;
  height: auto;
  border-radius: 14px;
  animation: splash-float 3s ease-in-out infinite;
}

@keyframes splash-float {

  0%,
  100% {
    transform: translateY(0)
  }

  50% {
    transform: translateY(-6px)
  }
}

.splash-loader {
  display: flex;
  gap: 8px
}

.splash-spinner {
  width: 10px;
  height: 10px;
  background: var(--primary);
  border-radius: 50%;
  animation: splash-dot 1.4s ease-in-out infinite;
}

.splash-spinner:nth-child(2) {
  animation-delay: .2s
}

.splash-spinner:nth-child(3) {
  animation-delay: .4s
}

@keyframes splash-dot {

  0%,
  80%,
  100% {
    opacity: .3;
    transform: scale(.8)
  }

  40% {
    opacity: 1;
    transform: scale(1)
  }
}

.splash-footer {
  position: absolute;
  bottom: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.splash-by {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--muted);
}

.splash-logo-bomil {
  width: 60px;
  height: auto;
  opacity: .5;
}

/* ============================================
   App Shell
   ============================================ */
.app-shell {
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  background: var(--bg);
}

/* ============================================
   Top Bar
   ============================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-title {
  font-weight: 700
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.topbar-name {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
}

.icon-btn {
  width: var(--tap);
  height: var(--tap);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}

.icon-btn:hover {
  background: var(--surface-2)
}

.icon-btn:active {
  transform: scale(.97)
}

/* ============================================
   Bottom Navigation
   ============================================ */
.bottom-nav {
  position: relative;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  transition: all .15s;
}

.bottom-nav-item:hover {
  color: var(--text)
}

.bottom-nav-item.active {
  color: var(--primary);
  background: var(--primary-glow);
}

.bottom-nav-icon svg {
  display: block
}

.bottom-nav-label {
  font-size: 11px;
  font-weight: 600
}

/* ============================================
   Main Content
   ============================================ */
.main {
  /* padding: 20px; */
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.main-centered {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
}

/* ============================================
   Typography
   ============================================ */
.h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.2;
  color: var(--text)
}

.h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.3
}

.h3 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4
}

.p {
  color: var(--muted);
  line-height: 1.6
}

/* ============================================
   Cards
   ============================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-inner {
  padding: 20px
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  height: var(--tap);
  padding: 0 24px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all .15s;
}

.btn:hover {
  background: var(--surface-2)
}

.btn:active {
  transform: scale(.98)
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, .25);
}

.btn-primary:hover {
  background: var(--primary-light);
  border-color: var(--primary-light)
}

.btn-danger {
  background: #fef2f2;
  border-color: #fecaca;
  color: var(--danger);
}

.btn-sm {
  height: 40px;
  padding: 0 16px;
  font-size: 14px
}

.btn-xs {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: var(--radius-xs)
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  font-size: 14px;
}

.btn-link:disabled {
  color: var(--muted-2)
}

/* ============================================
   Inputs
   ============================================ */
.input {
  width: 100%;
  height: var(--tap);
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: all .15s;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.input::placeholder {
  color: var(--muted-2)
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px
}

.label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted)
}

.password-wrap {
  position: relative
}

.password-wrap .input {
  padding-right: 52px
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================
   Language Switch
   ============================================ */
.lang-switch {
  display: flex;
  gap: 4px
}

.lang-btn {
  height: 36px;
  padding: 0 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: all .15s;
}

.lang-btn:hover {
  color: var(--text)
}

.lang-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ============================================
   Skeleton Loading
   ============================================ */
@keyframes skel-shimmer {
  0% {
    background-position: -300% 0
  }

  100% {
    background-position: 300% 0
  }
}

.skeleton {
  background: linear-gradient(90deg,
      var(--surface-2) 0%,
      var(--surface-3) 50%,
      var(--surface-2) 100%);
  background-size: 300% 100%;
  animation: skel-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-xs);
}

.skel-line {
  display: block;
  height: 14px
}

.skel-h-10 {
  height: 10px
}

.skel-h-12 {
  height: 12px
}

.skel-h-14 {
  height: 14px
}

.skel-h-18 {
  height: 18px
}

.skel-w-20 {
  width: 20%
}

.skel-w-30 {
  width: 30%
}

.skel-w-40 {
  width: 40%
}

.skel-w-50 {
  width: 50%
}

.skel-w-60 {
  width: 60%
}

.skel-w-70 {
  width: 70%
}

.skel-w-80 {
  width: 80%
}

.skel-w-90 {
  width: 90%
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
  position: fixed;
  left: 16px;
  right: 16px;
  top: 80px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(-10px);
  transition: all .25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0)
}

.toast.hide {
  opacity: 0;
  transform: translateY(-10px)
}

.toast-icon svg {
  display: block
}

.toast-message {
  flex: 1;
  font-size: 14px;
  line-height: 1.4
}

.toast-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-success {
  border-left: 3px solid var(--success)
}

.toast-error {
  border-left: 3px solid var(--danger)
}

.toast-warning {
  border-left: 3px solid var(--warning)
}

.toast-info {
  border-left: 3px solid var(--info)
}

/* ============================================
   Modal
   ============================================ */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
}

.modal-root.open {
  display: block
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  backdrop-filter: blur(4px);
}

.modal {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(480px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 18px;
  font-weight: 700
}

.modal-close {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: auto;
  flex: 1;
}

.modal-actions {
  padding: 16px 20px;
  display: flex;
  gap: 12px;
  border-top: 1px solid var(--border);
}

.modal-actions .btn {
  flex: 1
}

/* ============================================
   OTP Modal
   ============================================ */
.otp-modal-content {
  text-align: center
}

.otp-subtitle {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 20px
}

.otp-input {
  text-align: center;
  font-size: 28px;
  letter-spacing: 12px;
  font-weight: 700
}

.otp-actions {
  margin-top: 16px
}

.otp-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 8px
}

/* ============================================
   Payment Modal
   ============================================ */
.payment-modal-content {
  display: flex;
  flex-direction: column;
  gap: 16px
}

.payment-methods {
  display: flex;
  flex-direction: column;
  gap: 8px
}

.payment-method {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: all .15s;
}

.payment-method:hover {
  border-color: var(--border-light);
  background: var(--surface-2)
}

.payment-method.selected {
  border-color: var(--primary);
  background: var(--primary-glow)
}

.payment-method input {
  display: none
}

.payment-method-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: contain
}

.payment-method-name {
  font-weight: 600
}

.payment-pending {
  text-align: center;
  padding: 32px 0
}

.payment-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

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

.payment-pending-text {
  font-weight: 600;
  margin-bottom: 20px
}

.payment-instructions {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 20px;
  text-align: left;
}

.payment-instructions .label {
  font-size: 11px;
  margin-bottom: 6px
}

.payment-instructions p {
  font-size: 14px;
  color: var(--muted)
}

.payment-completed,
.payment-failed {
  text-align: center;
  padding: 32px 0
}

.payment-success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.payment-fail-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.payment-completed-text {
  font-weight: 700;
  color: var(--success)
}

.payment-failed-text {
  font-weight: 700;
  color: var(--danger)
}

.payment-failed-reason {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px
}

/* ============================================
   Date Picker & Search Select (compact)
   ============================================ */
.search-select,
.date-picker {
  position: relative;
  width: 100%
}

.search-select-input-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--tap);
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.search-select-input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text)
}

.search-select-clear,
.date-picker-clear {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center
}

.search-select-arrow {
  color: var(--muted)
}

.search-select-dropdown {
  position: absolute;
  margin-top: 8px;
  width: 100%;
  max-height: 260px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  display: none
}

.search-select.open .search-select-dropdown {
  display: block
}

.search-select-item {
  padding: 14px 16px;
  cursor: pointer;
  transition: background .1s
}

.search-select-item:hover,
.search-select-item.highlighted {
  background: var(--surface-2)
}

.search-select-item.selected {
  background: var(--primary-glow);
  color: var(--primary);
  font-weight: 600
}

.search-select-no-results {
  padding: 14px 16px;
  color: var(--muted)
}

.date-picker-button {
  width: 100%;
  height: var(--tap);
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px
}

.date-picker-dropdown {
  position: absolute;
  top: calc(var(--tap) + 8px);
  left: 0;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 16px;
  display: none
}

.date-picker-dropdown.portal {
  position: fixed;
  z-index: 600
}

.date-picker.open .date-picker-dropdown {
  display: block
}

.date-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px
}

.date-picker-nav {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center
}

.date-picker-title {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 600
}

.date-picker-weekdays,
.date-picker-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px
}

.date-picker-weekday {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 8px 0
}

.date-picker-day {
  height: 40px;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .1s
}

.date-picker-day:hover {
  background: var(--surface-2)
}

.date-picker-day.other-month {
  opacity: .4
}

.date-picker-day.today {
  border-color: var(--primary)
}

.date-picker-day.selected {
  background: var(--primary);
  color: #fff
}

.date-picker-day.disabled {
  opacity: .3;
  pointer-events: none
}

.date-picker-quick {
  display: flex;
  gap: 8px;
  margin-top: 12px
}

.date-picker-quick-btn {
  flex: 1;
  height: 36px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  transition: all .1s
}

.date-picker-quick-btn:hover {
  background: var(--surface-2)
}