/* ========================================================
   EARNDALA - COMPONENTS (Buttons, Cards, Inputs, Nav, Toast, Modals)
   ======================================================== */

/* 1. BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--clr-emerald-600) 0%, var(--clr-emerald-800) 100%);
  color: var(--clr-white);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--clr-emerald-500) 0%, var(--clr-emerald-700) 100%);
  transform: translateY(-2px);
  box-shadow: var(--glow-emerald);
  color: var(--clr-white);
}

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

.btn-gold {
  background: linear-gradient(135deg, var(--clr-gold-500) 0%, #D97706 100%);
  color: #070D1E;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

.btn-gold:hover {
  background: linear-gradient(135deg, var(--clr-gold-400) 0%, var(--clr-gold-500) 100%);
  transform: translateY(-2px);
  box-shadow: var(--glow-gold);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--clr-slate-100);
  border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--clr-white);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--clr-emerald-400);
  border: 1px solid var(--border-emerald);
}

.btn-outline:hover {
  background: rgba(16, 185, 129, 0.1);
  color: var(--clr-emerald-300);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.05rem;
  border-radius: var(--radius-md);
}

.btn:disabled, .btn.loading {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none !important;
  pointer-events: none;
}

/* 2. CARDS & GLASS PANELS */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.card-hover:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-emerald);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.card-emerald-glow {
  border-color: var(--border-emerald);
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.15);
}

.card-gold-glow {
  border-color: var(--border-gold);
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.15);
}

/* 3. INPUT FIELDS & FORM GROUPS */
.form-group {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--clr-slate-300);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 1rem;
  color: var(--clr-slate-400);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.form-control {
  width: 100%;
  padding: 0.8rem 1rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--clr-white);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: all var(--transition-fast);
  outline: none;
}

.form-control.has-icon {
  padding-left: 2.75rem;
}

.form-control:focus {
  border-color: var(--clr-emerald-500);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
  background-color: rgba(15, 23, 42, 0.9);
}

.form-control.is-invalid {
  border-color: var(--clr-danger-500);
}

.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.form-error-msg {
  font-size: 0.8rem;
  color: var(--clr-danger-400);
  display: none;
}

.form-group.has-error .form-error-msg {
  display: block;
}

.form-help {
  font-size: 0.8rem;
  color: var(--clr-slate-400);
}

/* 4. BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-coming-soon {
  background: rgba(245, 158, 11, 0.15);
  color: var(--clr-gold-400);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-emerald {
  background: rgba(16, 185, 129, 0.15);
  color: var(--clr-emerald-400);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-user {
  background: rgba(59, 130, 246, 0.15);
  color: #60A5FA;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-admin {
  background: rgba(236, 72, 153, 0.15);
  color: #F472B6;
  border: 1px solid rgba(236, 72, 153, 0.3);
}

/* 5. TOP NAVIGATION BAR (Header) */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(7, 13, 30, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-glass);
  padding: 0.85rem 0;
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-logo img {
  width: 38px;
  height: 38px;
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--clr-white);
  letter-spacing: -0.03em;
}

.brand-tagline-sm {
  font-size: 0.7rem;
  color: var(--clr-emerald-400);
  font-weight: 600;
  letter-spacing: 0.05em;
  display: block;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-link {
  color: var(--clr-slate-300);
  font-weight: 600;
  font-size: 0.925rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-link:hover, .nav-link.active {
  color: var(--clr-white);
  background: rgba(255, 255, 255, 0.08);
}

.nav-link.active {
  color: var(--clr-emerald-400);
  border-bottom: 2px solid var(--clr-emerald-500);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Mobile Nav Toggle Button */
.nav-mobile-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--clr-slate-100);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.4rem;
}

/* 6. MOBILE BOTTOM NAVIGATION BAR */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(11, 19, 43, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-glass);
  padding: 0.5rem 0.75rem calc(0.5rem + env(safe-area-inset-bottom));
  justify-content: space-around;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.5);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  color: var(--clr-slate-400);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  width: 20%;
  text-align: center;
}

.mobile-nav-item svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  transition: transform var(--transition-bounce);
}

.mobile-nav-item.active {
  color: var(--clr-emerald-400);
}

.mobile-nav-item.active svg {
  transform: translateY(-2px) scale(1.1);
  filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.6));
}

@media (max-width: 768px) {
  .nav-menu {
    display: none;
  }
  .mobile-bottom-nav {
    display: flex;
  }
  body {
    padding-bottom: 70px;
  }
}

/* 7. TOAST NOTIFICATIONS */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 380px;
  width: calc(100% - 3rem);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--clr-slate-900);
  color: var(--clr-white);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-lg);
  transform: translateX(120%);
  transition: transform var(--transition-bounce), opacity var(--transition-fast);
  opacity: 0;
}

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

.toast-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  margin-top: 2px;
}

.toast-content {
  flex-grow: 1;
}

.toast-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.15rem;
}

.toast-message {
  font-size: 0.825rem;
  color: var(--clr-slate-300);
}

.toast-success {
  border-left: 4px solid var(--clr-success-500);
}
.toast-success .toast-icon { color: var(--clr-success-500); }

.toast-error {
  border-left: 4px solid var(--clr-danger-500);
}
.toast-error .toast-icon { color: var(--clr-danger-500); }

.toast-info {
  border-left: 4px solid var(--clr-info-500);
}
.toast-info .toast-icon { color: var(--clr-info-500); }

/* 8. LOADING OVERLAY & SPINNER */
.page-loader {
  position: fixed;
  inset: 0;
  background: var(--bg-dark);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.page-loader.fade-out {
  opacity: 0;
  visibility: hidden;
}

.spinner-earndala {
  width: 60px;
  height: 60px;
  position: relative;
}

.spinner-earndala::before, .spinner-earndala::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 4px solid transparent;
}

.spinner-earndala::before {
  border-top-color: var(--clr-emerald-400);
  border-right-color: var(--clr-emerald-500);
  animation: spin 1s linear infinite;
}

.spinner-earndala::after {
  border-bottom-color: var(--clr-gold-400);
  border-left-color: var(--clr-gold-500);
  animation: spin 1.5s linear infinite reverse;
  inset: 6px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.inline-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

/* 9. FOOTER */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-glass);
  background: rgba(7, 13, 30, 0.9);
  padding: 3rem 0 2rem;
  font-size: 0.875rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.footer-links-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--clr-white);
  margin-bottom: 1rem;
}

.footer-links-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.footer-links-list a {
  color: var(--clr-slate-400);
  transition: color var(--transition-fast);
}

.footer-links-list a:hover {
  color: var(--clr-emerald-400);
}

.footer-bottom {
  border-top: 1px solid var(--border-glass);
  padding-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--clr-slate-400);
  font-size: 0.8rem;
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
  .footer-brand {
    grid-column: 1 / -1;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }
}
