/* ═══════════════════════════════════════════════════════════════
   MangalamPay — Design System
   Saffron Gold + Royal Purple + Emerald Green
   ═══════════════════════════════════════════════════════════════ */

/* ── Tokens ── */
:root {
  --mp-gold: #E8A838;
  --mp-gold-light: #FEF3C7;
  --mp-gold-deep: #D4922A;
  --mp-purple: #5B2C8E;
  --mp-purple-mid: #7C3AED;
  --mp-purple-light: #EDE9FE;
  --mp-green: #16A34A;
  --mp-green-light: #DCFCE7;
  --mp-red: #DC2626;
  --mp-red-light: #FEE2E2;
  --mp-bg: #FDF8F0;
  --mp-card: #FFFFFF;
  --mp-text: #1E293B;
  --mp-muted: #64748B;
  --mp-border: #E2E8F0;
  --mp-radius: 12px;
  --mp-radius-sm: 8px;
  --mp-shadow: 0 4px 24px rgba(91, 44, 142, .08);
  --mp-shadow-hover: 0 8px 32px rgba(91, 44, 142, .14);
  --mp-transition: .22s cubic-bezier(.4, 0, .2, 1);

  /* gradients */
  --mp-grad-purple: linear-gradient(135deg, #5B2C8E 0%, #7C3AED 100%);
  --mp-grad-gold: linear-gradient(135deg, #E8A838 0%, #F59E0B 100%);
  --mp-grad-green: linear-gradient(135deg, #16A34A 0%, #22C55E 100%);
  --mp-grad-hero: linear-gradient(135deg, #5B2C8E 0%, #7C3AED 50%, #E8A838 100%);
}

/* ── Base ── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--mp-bg);
  color: var(--mp-text);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body > main {
  flex: 1;
}

h1,
h2,
h3,
h4,
h5,
h6,
.navbar-brand {
  font-family: 'Outfit', 'Inter', system-ui, sans-serif;
}

/* ── Navbar ── */
.mp-navbar {
  background: var(--mp-grad-purple);
  border-bottom: none;
  padding: .65rem 0;
  box-shadow: 0 2px 16px rgba(91, 44, 142, .18);
}

.mp-navbar .navbar-brand {
  color: var(--mp-gold) !important;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: .5px;
}

.mp-navbar .navbar-brand:hover {
  opacity: .88;
}

.mp-navbar .nav-link {
  color: rgba(255, 255, 255, .82) !important;
  font-weight: 500;
  font-size: .9rem;
  padding: .45rem .85rem !important;
  border-radius: var(--mp-radius-sm);
  transition: var(--mp-transition);
}

.mp-navbar .nav-link:hover,
.mp-navbar .nav-link:focus {
  color: #fff !important;
  background: rgba(255, 255, 255, .12);
}

.mp-navbar .navbar-toggler {
  border-color: rgba(255, 255, 255, .25);
  color: #fff;
}

.mp-navbar .navbar-toggler-icon {
  filter: invert(1);
}

.mp-navbar .user-badge {
  color: rgba(255, 255, 255, .9);
  font-size: .82rem;
}

.mp-navbar .user-badge strong {
  color: #fff;
}

.mp-navbar .btn-outline-light {
  border-color: rgba(255, 255, 255, .35);
  color: #fff;
  font-size: .82rem;
  border-radius: 20px;
  padding: .3rem .9rem;
}

.mp-navbar .btn-outline-light:hover {
  background: rgba(255, 255, 255, .15);
  border-color: rgba(255, 255, 255, .5);
}

.profile-trigger {
  border: 1px solid rgba(255, 255, 255, .35);
  color: #fff;
  background: rgba(255, 255, 255, .08);
  border-radius: 20px;
  padding: .24rem .55rem .24rem .24rem;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}

.profile-trigger:hover,
.profile-trigger:focus {
  color: #fff;
  background: rgba(255, 255, 255, .18);
  border-color: rgba(255, 255, 255, .5);
}

.profile-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--mp-gold);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  overflow: hidden;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-name {
  font-size: .82rem;
  font-weight: 600;
}

.profile-menu {
  border-radius: var(--mp-radius-sm);
  border: 1px solid var(--mp-border);
  box-shadow: var(--mp-shadow);
}

.profile-menu .dropdown-item {
  font-size: .88rem;
}

/* Profile dropdown wrapper: always visible, even on mobile */
.profile-dropdown-wrap {
  position: relative;
  z-index: 1050;
}

/* On large screens, profile sits at the right end of the navbar */
@media (min-width: 992px) {
  .profile-dropdown-wrap {
    margin-left: 1rem !important;
    margin-right: 0 !important;
  }
}

/* ── Footer ── */
.mp-footer {
  background: var(--mp-purple);
  color: rgba(255, 255, 255, .7);
  padding: 1.2rem 0;
  margin-top: 3rem;
}

.mp-footer a {
  color: var(--mp-gold);
  text-decoration: none;
}

.mp-footer a:hover {
  text-decoration: underline;
}

/* ── Cards ── */
.card,
.card-elev,
.elev {
  background: var(--mp-card);
  border: 1px solid var(--mp-border);
  border-radius: var(--mp-radius);
  box-shadow: var(--mp-shadow);
  transition: transform var(--mp-transition), box-shadow var(--mp-transition);
}

.card:hover,
.card-elev:hover {
  box-shadow: var(--mp-shadow-hover);
}

.card-accent-top {
  border-top: 3px solid var(--mp-gold);
}

.card-accent-purple {
  border-top: 3px solid var(--mp-purple);
}

.card-accent-green {
  border-top: 3px solid var(--mp-green);
}

/* ── Stat Cards ── */
.stat-card {
  background: var(--mp-card);
  border: 1px solid var(--mp-border);
  border-radius: var(--mp-radius);
  padding: 1.25rem;
  box-shadow: var(--mp-shadow);
  transition: transform var(--mp-transition), box-shadow var(--mp-transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.stat-card.stat-purple::before {
  background: var(--mp-grad-purple);
}

.stat-card.stat-gold::before {
  background: var(--mp-grad-gold);
}

.stat-card.stat-green::before {
  background: var(--mp-grad-green);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--mp-shadow-hover);
}

.stat-card .stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-bottom: .6rem;
}

.stat-card.stat-purple .stat-icon {
  background: var(--mp-purple-light);
  color: var(--mp-purple);
}

.stat-card.stat-gold .stat-icon {
  background: var(--mp-gold-light);
  color: var(--mp-gold-deep);
}

.stat-card.stat-green .stat-icon {
  background: var(--mp-green-light);
  color: var(--mp-green);
}

.stat-card .stat-value {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--mp-text);
}

.stat-card .stat-label {
  font-size: .78rem;
  color: var(--mp-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ── Buttons ── */
.btn-mp-primary {
  background: var(--mp-grad-purple);
  color: #fff;
  border: none;
  border-radius: var(--mp-radius-sm);
  font-weight: 600;
  padding: .55rem 1.4rem;
  transition: var(--mp-transition);
  box-shadow: 0 2px 8px rgba(91, 44, 142, .25);
}

.btn-mp-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(91, 44, 142, .35);
  color: #fff;
}

.btn-mp-gold {
  background: var(--mp-grad-gold);
  color: #fff;
  border: none;
  border-radius: var(--mp-radius-sm);
  font-weight: 600;
  padding: .55rem 1.4rem;
  transition: var(--mp-transition);
  box-shadow: 0 2px 8px rgba(232, 168, 56, .3);
}

.btn-mp-gold:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(232, 168, 56, .4);
  color: #fff;
}

.btn-mp-green {
  background: var(--mp-grad-green);
  color: #fff;
  border: none;
  border-radius: var(--mp-radius-sm);
  font-weight: 600;
  padding: .55rem 1.4rem;
  transition: var(--mp-transition);
  box-shadow: 0 2px 8px rgba(22, 163, 74, .25);
}

.btn-mp-green:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(22, 163, 74, .35);
  color: #fff;
}

.btn-mp-outline {
  background: transparent;
  color: var(--mp-purple);
  border: 1.5px solid var(--mp-border);
  border-radius: var(--mp-radius-sm);
  font-weight: 500;
  padding: .5rem 1.2rem;
  transition: var(--mp-transition);
}

.btn-mp-outline:hover {
  border-color: var(--mp-purple);
  background: var(--mp-purple-light);
  color: var(--mp-purple);
}

/* ── Form Controls ── */
.form-control,
.form-select {
  border-radius: var(--mp-radius-sm);
  border: 1.5px solid var(--mp-border);
  padding: .6rem .9rem;
  font-size: .92rem;
  transition: var(--mp-transition);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--mp-purple-mid);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, .12);
}

.form-label {
  font-weight: 600;
  font-size: .85rem;
  color: var(--mp-text);
  margin-bottom: .35rem;
}

/* ── Badges ── */
.badge-active {
  background: var(--mp-green-light);
  color: var(--mp-green);
  font-weight: 600;
  font-size: .75rem;
  padding: .35rem .7rem;
  border-radius: 20px;
}

.badge-pending {
  background: var(--mp-gold-light);
  color: var(--mp-gold-deep);
  font-weight: 600;
  font-size: .75rem;
  padding: .35rem .7rem;
  border-radius: 20px;
}

.badge-error {
  background: var(--mp-red-light);
  color: var(--mp-red);
  font-weight: 600;
  font-size: .75rem;
  padding: .35rem .7rem;
  border-radius: 20px;
}

/* ── Tables ── */
.mp-table-wrap {
  background: var(--mp-card);
  border: 1px solid var(--mp-border);
  border-radius: var(--mp-radius);
  overflow: hidden;
  box-shadow: var(--mp-shadow);
}

.mp-table-wrap .table {
  margin-bottom: 0;
}

.mp-table-wrap .table thead th {
  background: #F8FAFC;
  border-bottom: 2px solid var(--mp-border);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--mp-muted);
  padding: .75rem 1rem;
}

.mp-table-wrap .table tbody td {
  padding: .7rem 1rem;
  vertical-align: middle;
  font-size: .9rem;
  border-color: #F1F5F9;
}

.mp-table-wrap .table tbody tr:hover {
  background: #FEFCE8;
}

.mp-table-wrap .table tfoot th {
  background: #F8FAFC;
  padding: .75rem 1rem;
}

/* ── Progress ── */
.progress-mp {
  height: 8px;
  border-radius: 4px;
  background: #F1F5F9;
  overflow: hidden;
}

.progress-mp .progress-bar {
  background: var(--mp-grad-hero);
  border-radius: 4px;
  transition: width .6s ease;
}

/* ── Occasions Grid ── */
.occasions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}

/* ── Occasion Card ── */
.occ-card {
  background: var(--mp-card);
  border: 1px solid var(--mp-border);
  border-radius: var(--mp-radius);
  box-shadow: var(--mp-shadow);
  padding: 1.25rem;
  transition: transform var(--mp-transition), box-shadow var(--mp-transition);
  position: relative;
  overflow: hidden;
}

.occ-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--mp-grad-gold);
}

.occ-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--mp-shadow-hover);
}

.occ-card .occ-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: .25rem;
  color: var(--mp-text);
}

.occ-card .occ-meta {
  color: var(--mp-muted);
  font-size: .8rem;
}

.occ-card .occ-stat-label {
  font-size: .72rem;
  color: var(--mp-muted);
  text-transform: uppercase;
  letter-spacing: .3px;
  font-weight: 600;
}

.occ-card .occ-stat-value {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--mp-text);
}

.occ-card .btn-group .btn {
  font-size: .78rem;
  padding: .3rem .6rem;
  border-radius: 6px;
}

/* ── Hero Banner ── */
.hero-banner {
  background: var(--mp-grad-hero);
  border-radius: var(--mp-radius);
  padding: 2rem 2.25rem;
  color: #fff;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}

.hero-banner::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 300px;
  height: 300px;
  background: rgba(255, 255, 255, .06);
  border-radius: 50%;
}

.hero-banner h1 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.6rem;
  margin-bottom: .25rem;
}

.hero-banner .hero-sub {
  opacity: .85;
  font-size: .95rem;
}

/* ── Auth Card ── */
.auth-card {
  background: var(--mp-card);
  border: 1px solid var(--mp-border);
  border-radius: var(--mp-radius);
  box-shadow: var(--mp-shadow);
  overflow: hidden;
}

.auth-card-header {
  background: var(--mp-grad-purple);
  padding: 1.5rem 2rem;
  text-align: center;
  color: #fff;
}

.auth-card-header h3 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  margin-bottom: .15rem;
  color: var(--mp-gold);
}

.auth-card-header p {
  margin-bottom: 0;
  font-size: .88rem;
}

.auth-card-body {
  padding: 1.75rem 2rem;
}

/* ── Section Headers ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.section-header h3,
.section-header h4 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  margin-bottom: 0;
  color: var(--mp-text);
}

.section-header .section-sub {
  font-size: .85rem;
  color: var(--mp-muted);
}

/* ── Page Wrapper Animation ── */
.page-fade {
  animation: fadeSlideIn .4s ease both;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Alerts ── */
.alert {
  border-radius: var(--mp-radius-sm);
  border: none;
  font-size: .9rem;
}

.alert-success {
  background: var(--mp-green-light);
  color: #166534;
}

.alert-danger,
.alert-error {
  background: var(--mp-red-light);
  color: #991B1B;
}

.alert-warning {
  background: var(--mp-gold-light);
  color: #92400E;
}

.alert-info {
  background: var(--mp-purple-light);
  color: var(--mp-purple);
}

/* ── Validation Errors ── */
.field-error {
  color: var(--mp-red);
  font-size: .82rem;
  margin-top: .25rem;
  animation: fieldErrorIn .25s ease;
}

.field-error .bi {
  margin-right: .25rem;
}

@keyframes fieldErrorIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Help Card ── */
.help-card {
  background: var(--mp-purple-light);
  border: 1px solid #DDD6FE;
  border-radius: var(--mp-radius);
  padding: 1.25rem;
}

.help-card h6 {
  color: var(--mp-purple);
  font-weight: 700;
}

.help-card ul {
  margin-bottom: 0;
  padding-left: 1.2rem;
  color: #4C1D95;
  font-size: .88rem;
}

.help-card li {
  margin-bottom: .35rem;
}

/* ── QR Frame ── */
.qr-frame {
  border: 2px dashed var(--mp-gold);
  border-radius: var(--mp-radius);
  padding: 1rem;
  display: inline-block;
  background: #FFFDF7;
}

/* ── Search Bar ── */
.search-bar {
  position: relative;
}

.search-bar .bi-search {
  position: absolute;
  left: .85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--mp-muted);
  font-size: .9rem;
}

.search-bar input {
  padding-left: 2.4rem;
}

/* ── Pagination ── */
.pagination .page-link {
  border-radius: 8px;
  margin: 0 2px;
  border: 1px solid var(--mp-border);
  color: var(--mp-purple);
  font-size: .85rem;
  font-weight: 500;
}

.pagination .page-item.active .page-link {
  background: var(--mp-purple);
  border-color: var(--mp-purple);
  color: #fff;
}

.pagination .page-link:hover {
  background: var(--mp-purple-light);
  border-color: var(--mp-purple);
  color: var(--mp-purple);
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--mp-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: .75rem;
  opacity: .5;
}

.empty-state h5 {
  color: var(--mp-text);
  font-weight: 600;
}

.empty-state p {
  max-width: 360px;
  margin: 0 auto .75rem;
  font-size: .9rem;
}

/* ── Payment Status ── */
.payment-amount {
  font-family: 'Outfit', sans-serif;
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--mp-green);
}

.pulse-btn {
  animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {

  0%,
  100% {
    box-shadow: 0 2px 8px rgba(22, 163, 74, .25);
  }

  50% {
    box-shadow: 0 4px 24px rgba(22, 163, 74, .45);
  }
}

/* Page transition loader */
.page-loader {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1040;
  opacity: 0;
  transition: opacity .18s ease;
}

.page-loader.is-visible {
  opacity: 1;
}

.page-loader-bar {
  position: fixed;
  top: 0;
  left: -40%;
  width: 40%;
  height: 3px;
  background: var(--mp-grad-hero);
  box-shadow: 0 0 10px rgba(91, 44, 142, .35);
}

.page-loader.is-visible .page-loader-bar {
  animation: pageLoaderMove 1s ease-in-out infinite;
}

.page-loader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, .22);
  pointer-events: none;
}

@keyframes pageLoaderMove {
  0% {
    left: -40%;
  }

  100% {
    left: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-loader.is-visible .page-loader-bar {
    animation: none;
    left: 0;
    width: 100%;
  }
}

/* ── Responsive: Tablet (lg breakpoint — navbar collapses) ── */
@media (max-width: 991px) {
  .mp-navbar .navbar-collapse .d-flex {
    width: 100%;
    margin-top: .75rem;
    padding-top: .75rem;
    border-top: 1px solid rgba(255, 255, 255, .15);
  }

  .profile-trigger {
    min-height: 44px;
    min-width: 44px;
    padding: .35rem .7rem .35rem .35rem;
  }

  .profile-name {
    display: inline !important;
  }
}

/* ── Responsive: Small Tablets ── */
@media (max-width: 768px) {
  .hero-banner {
    padding: 1.5rem 1.25rem;
  }

  .hero-banner h1 {
    font-size: 1.35rem;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: .5rem;
  }

  .mp-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .mp-table-wrap .table {
    min-width: 540px;
  }

  .card-elev.p-5,
  .card.p-5 {
    padding: 1.5rem !important;
  }

  .payment-amount {
    font-size: 1.75rem;
  }

  .help-card {
    padding: 1rem;
  }
}

/* ── Responsive: Mobile ── */
@media (max-width: 576px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .occasions-grid {
    grid-template-columns: 1fr;
  }

  .hero-banner {
    padding: 1.25rem 1rem;
    margin-bottom: 1rem;
  }

  .hero-banner h1 {
    font-size: 1.2rem;
  }

  .hero-banner .hero-sub {
    font-size: .85rem;
  }

  .auth-card-body {
    padding: 1.25rem;
  }

  .auth-card-header {
    padding: 1rem 1.25rem;
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-card .stat-value {
    font-size: 1.25rem;
  }

  .stat-card .stat-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .occ-card {
    padding: 1rem;
  }

  .occ-card .occ-title {
    font-size: 1rem;
  }

  .card-elev.p-5,
  .card.p-5 {
    padding: 1.25rem !important;
  }

  .payment-amount {
    font-size: 1.5rem;
  }

  .form-control,
  .form-select {
    font-size: .88rem;
    padding: .5rem .75rem;
  }

  .btn-mp-primary,
  .btn-mp-gold,
  .btn-mp-green {
    padding: .5rem 1rem;
    font-size: .88rem;
  }

  .mp-footer {
    padding: 1rem 0;
    margin-top: 2rem;
  }

  .profile-trigger {
    min-height: 44px;
    min-width: 44px;
  }

  .profile-avatar {
    width: 32px;
    height: 32px;
    font-size: .85rem;
  }

  .bg-light.rounded-4.p-4 {
    padding: 1rem !important;
    border-radius: .75rem !important;
  }

  .row.g-2 .col-8 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .row.g-2 .col-4 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .empty-state {
    padding: 2rem 1rem;
  }

  .empty-state .empty-icon {
    font-size: 2.5rem;
  }
}
