/* ==========================================================================
   Crux Technology — Components (buttons, cards, forms, modals, toasts, etc.)
   ========================================================================== */

/* Buttons ---------------------------------------------------------------- */
.btn {
  --btn-bg: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px 22px; border-radius: var(--r-pill); border: 1px solid transparent;
  font-weight: 700; font-size: .93rem; cursor: pointer; white-space: nowrap;
  transition: transform .16s ease, box-shadow .2s ease, background .2s ease, color .2s ease, border-color .2s ease;
  background: var(--btn-bg); position: relative; text-align: center;
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-loading { opacity: .72; cursor: not-allowed; }
.btn-primary { background: var(--gradient-green); color: #001304; box-shadow: 0 10px 30px -12px rgba(0, 255, 25, .8); }
.btn-primary:hover { box-shadow: 0 14px 40px -12px rgba(0, 255, 25, .95); }
.btn-outline { border-color: rgba(0, 255, 25, .38); color: var(--primary-green); background: rgba(0, 255, 25, .06); }
.btn-outline:hover { background: rgba(0, 255, 25, .14); }
.btn-ghost { color: var(--text-muted); border-color: var(--border); background: var(--surface); }
.btn-ghost:hover { color: var(--white); border-color: rgba(255, 255, 255, .2); }
.btn-link { padding: 0; color: var(--primary-green); background: none; }
.btn-sm { padding: 9px 16px; font-size: .84rem; }
.btn-lg { padding: 16px 30px; font-size: 1rem; }
.btn-block { display: flex; width: 100%; }

/* Badges / pills --------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: var(--r-pill);
  font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--border); color: var(--text-muted);
}
.badge-green { background: rgba(0, 255, 25, .12); border-color: rgba(0, 255, 25, .3); color: var(--primary-green); }
.badge-warn { background: rgba(255, 190, 0, .12); border-color: rgba(255, 190, 0, .3); color: #ffd049; }
.badge-red { background: rgba(255, 74, 74, .12); border-color: rgba(255, 74, 74, .3); color: #ff8080; }
.badge-sponsored { background: rgba(0, 255, 25, .14); color: var(--primary-green); border-color: rgba(0, 255, 25, .35); }

/* Cards ------------------------------------------------------------------ */
.card {
  background: var(--gradient-surface);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 24px; box-shadow: var(--shadow-card);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.card-hover:hover { transform: translateY(-5px); border-color: var(--border-strong); box-shadow: var(--shadow-card), var(--glow-sm); }
.card-pad-sm { padding: 18px; }
.card-flush { padding: 0; overflow: hidden; }

.icon-box {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: rgba(0, 255, 25, .1); border: 1px solid rgba(0, 255, 25, .22);
  color: var(--primary-green); margin-bottom: 16px;
}
.feature-card h4 { font-size: 1.05rem; margin-bottom: 6px; }
.feature-card p { font-size: .9rem; color: var(--text-muted); margin: 0; }

/* Media slots */
.media {
  position: relative; width: 100%; aspect-ratio: 16/9; overflow: hidden;
  background: linear-gradient(140deg, rgba(0, 255, 25, .1), rgba(0, 31, 5, .8));
  display: grid; place-items: center;
}
.media img { width: 100%; height: 100%; object-fit: cover; }
.media .media-fallback { color: rgba(0, 255, 25, .5); font-weight: 800; letter-spacing: .18em; font-size: .8rem; }
.media-banner { aspect-ratio: 3/1; }

.thumb {
  width: 52px; height: 52px; border-radius: 14px; overflow: hidden; flex: 0 0 auto;
  display: grid; place-items: center; font-weight: 800; color: var(--primary-green);
  background: linear-gradient(145deg, rgba(0, 255, 25, .16), rgba(0, 61, 8, .55));
  border: 1px solid rgba(0, 255, 25, .26);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }

/* Filter chips / toolbar ------------------------------------------------- */
.toolbar { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 26px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 9px 16px; border-radius: var(--r-pill); cursor: pointer; font-size: .85rem; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); transition: .18s;
}
.chip:hover { color: var(--white); border-color: rgba(255, 255, 255, .2); }
.chip.active { background: rgba(0, 255, 25, .14); border-color: rgba(0, 255, 25, .4); color: var(--primary-green); }

.search {
  position: relative; display: flex; align-items: center; min-width: 260px; flex: 1 1 260px; max-width: 420px;
}
.search svg { position: absolute; left: 15px; color: var(--text-dim); pointer-events: none; }
.search input {
  width: 100%; padding: 13px 16px 13px 44px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--border); color: var(--white); outline: none;
}
.search input::placeholder { color: var(--text-dim); }
.search input:focus { border-color: var(--border-strong); box-shadow: var(--glow-sm); }

.select {
  padding: 12px 16px; border-radius: var(--r-pill); background: var(--surface);
  border: 1px solid var(--border); color: var(--text); outline: none; cursor: pointer;
}
.select option { background: #04120a; color: var(--white); }

/* Forms ------------------------------------------------------------------ */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: .84rem; font-weight: 600; margin-bottom: 7px; color: var(--soft-green); }
.input, .textarea, select.input {
  width: 100%; padding: 13px 15px; border-radius: var(--r-md);
  background: rgba(255, 255, 255, .04); border: 1px solid var(--border);
  color: var(--white); outline: none; transition: border-color .18s, box-shadow .18s;
}
.textarea { min-height: 130px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--text-dim); }
.input:focus, .textarea:focus { border-color: rgba(0, 255, 25, .5); box-shadow: 0 0 0 3px rgba(0, 255, 25, .1); }
.input.is-invalid, .textarea.is-invalid { border-color: rgba(255, 90, 90, .6); }
.error-msg { display: none; color: #ff8f8f; font-size: .78rem; margin-top: 6px; }
.error-msg.show { display: block; }
.hint { color: var(--text-dim); font-size: .78rem; margin-top: 6px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 48px; }
.pw-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent;
  color: var(--text-dim); cursor: pointer; display: grid; place-items: center;
}
.pw-toggle:hover { color: var(--primary-green); }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: .88rem; color: var(--text-muted); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary-green); margin-top: 2px; flex: 0 0 auto; }
.strength { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; margin-top: 10px; }
.strength i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--gradient-green); transition: width .3s ease, background .3s ease; }
.strength-label { font-size: .76rem; color: var(--text-dim); margin-top: 6px; }

/* OTP */
.otp { display: flex; gap: 10px; justify-content: space-between; }
.otp input {
  width: 100%; aspect-ratio: 1; text-align: center; font-size: 1.4rem; font-weight: 800;
  border-radius: var(--r-md); background: rgba(255, 255, 255, .04); border: 1px solid var(--border);
  color: var(--white); outline: none;
}
.otp input:focus { border-color: var(--primary-green); box-shadow: var(--glow-sm); }

/* Spinner / loaders ------------------------------------------------------ */
.spinner {
  display: inline-block; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(0, 255, 25, .25); border-top-color: var(--primary-green);
  animation: spin .7s linear infinite; flex: 0 0 auto;
}
.btn-primary .spinner { border-color: rgba(0, 19, 4, .3); border-top-color: #001304; }
.spinner-lg { width: 54px; height: 54px; border-width: 3px; box-shadow: 0 0 26px rgba(0, 255, 25, .35); }

#preloader {
  position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center;
  background: radial-gradient(700px 420px at 50% 40%, rgba(0, 61, 8, .8), var(--black) 70%);
  transition: opacity .45s ease, visibility .45s ease;
}
#preloader.is-hidden { opacity: 0; visibility: hidden; }
#preloader .pl-inner { text-align: center; display: grid; justify-items: center; gap: 22px; }
#preloader .pl-text { color: var(--text-muted); font-size: .9rem; letter-spacing: .05em; }
#preloader .pl-bar { width: 190px; height: 3px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; }
#preloader .pl-bar i { display: block; height: 100%; width: 40%; background: var(--gradient-green); animation: slide 1.3s ease-in-out infinite; }

.overlay-loader {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 5;
  background: rgba(2, 8, 4, .68); backdrop-filter: blur(3px); border-radius: inherit;
}

/* Skeletons */
.skeleton { border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); padding: 20px; }
.sk-line { height: 12px; border-radius: 99px; margin-bottom: 10px; background: linear-gradient(90deg, rgba(255,255,255,.05), rgba(0,255,25,.12), rgba(255,255,255,.05)); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.sk-line.w-40 { width: 40%; } .sk-line.w-60 { width: 60%; } .sk-line.w-80 { width: 80%; }
.sk-box { height: 120px; border-radius: var(--r-md); margin-bottom: 16px; background: linear-gradient(90deg, rgba(255,255,255,.05), rgba(0,255,25,.1), rgba(255,255,255,.05)); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }

/* Modal ------------------------------------------------------------------ */
.modal-root {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px;
  background: rgba(1, 5, 2, .78); backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility .2s ease;
}
.modal-root.is-open { opacity: 1; visibility: visible; }
.modal {
  width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto;
  background: linear-gradient(160deg, #061a0d, #030f07);
  border: 1px solid var(--border-strong); border-radius: var(--r-xl);
  box-shadow: var(--shadow-card), var(--glow-md); padding: 28px;
  transform: translateY(14px) scale(.98); transition: transform .24s ease;
}
.modal-root.is-open .modal { transform: translateY(0) scale(1); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 8px; }
.modal-head h3 { font-size: 1.3rem; margin: 0; }
.modal-close {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted); cursor: pointer; display: grid; place-items: center;
}
.modal-close:hover { color: var(--primary-green); border-color: var(--border-strong); }
.modal-body { color: var(--text-muted); }
.modal-foot { display: flex; gap: 12px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }
.modal-icon { width: 60px; height: 60px; border-radius: 20px; display: grid; place-items: center; margin-bottom: 14px; background: rgba(0,255,25,.12); border: 1px solid rgba(0,255,25,.3); color: var(--primary-green); }

/* Toasts ----------------------------------------------------------------- */
#toast-root { position: fixed; top: 18px; right: 18px; z-index: 300; display: grid; gap: 10px; width: min(360px, calc(100vw - 36px)); }
.toast {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md);
  background: rgba(4, 16, 9, .96); border: 1px solid var(--border); border-left: 3px solid var(--primary-green);
  box-shadow: var(--shadow-card); animation: toastIn .28s ease both;
}
.toast.is-out { animation: toastOut .25s ease forwards; }
.toast b { display: block; font-size: .92rem; }
.toast p { margin: 2px 0 0; font-size: .84rem; color: var(--text-muted); }
.toast .t-icon { color: var(--primary-green); flex: 0 0 auto; margin-top: 2px; }
.toast.error { border-left-color: #ff5a5a; } .toast.error .t-icon { color: #ff8080; }
.toast.warning { border-left-color: #ffbe00; } .toast.warning .t-icon { color: #ffd049; }
.toast.info { border-left-color: #4ad0ff; } .toast.info .t-icon { color: #7fdcff; }

/* Tabs & accordion ------------------------------------------------------- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 26px; overflow-x: auto; }
.tab { padding: 12px 18px; cursor: pointer; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.tab.active { color: var(--primary-green); border-bottom-color: var(--primary-green); }

.accordion { display: grid; gap: 12px; }
.acc-item { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.acc-item.open { border-color: var(--border-strong); }
.acc-head {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 18px 20px; background: none; border: 0; cursor: pointer; text-align: left; font-weight: 700; color: var(--white);
}
.acc-head .acc-ico { color: var(--primary-green); transition: transform .22s ease; flex: 0 0 auto; }
.acc-item.open .acc-head .acc-ico { transform: rotate(45deg); }
.acc-body { max-height: 0; overflow: hidden; transition: max-height .3s ease; }
.acc-body div { padding: 0 20px 20px; color: var(--text-muted); font-size: .94rem; }

/* Dropdown --------------------------------------------------------------- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 190px; z-index: 60;
  background: #06180d; border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-card); padding: 6px; display: none;
}
.dropdown.open .dropdown-menu { display: block; animation: fadeUp .18s ease both; }
.dropdown-menu a { display: block; padding: 10px 12px; border-radius: 10px; font-size: .9rem; color: var(--text-muted); }
.dropdown-menu a:hover { background: rgba(0, 255, 25, .1); color: var(--primary-green); }

/* Task / merchant / coupon / ad cards ------------------------------------ */
.task-card { display: flex; flex-direction: column; gap: 14px; }
.task-card .t-top { display: flex; gap: 14px; align-items: flex-start; }
.task-card h4 { font-size: 1.02rem; margin: 0 0 4px; }
.task-card p { font-size: .88rem; color: var(--text-muted); margin: 0; }
.task-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: .8rem; color: var(--text-muted); padding-top: 12px; border-top: 1px solid var(--border); }
.task-meta span { display: inline-flex; align-items: center; gap: 6px; }
.reward { font-weight: 800; color: var(--primary-green); white-space: nowrap; }

.merchant-card .m-body { padding: 18px; }
.merchant-card .m-head { display: flex; gap: 12px; align-items: center; margin-top: -44px; margin-bottom: 12px; position: relative; }
.merchant-card .m-head .thumb { width: 62px; height: 62px; border-radius: 18px; background: #061a0d; }
.rating { display: inline-flex; align-items: center; gap: 5px; color: #ffd049; font-size: .84rem; font-weight: 700; }

.coupon-card { position: relative; overflow: hidden; }
.coupon-card::before, .coupon-card::after {
  content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%;
  background: var(--black); border: 1px solid var(--border); top: 50%; transform: translateY(-50%);
}
.coupon-card::before { left: -12px; } .coupon-card::after { right: -12px; }
.coupon-discount { font-size: 1.9rem; font-weight: 800; color: var(--primary-green); line-height: 1; }
.coupon-code {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px dashed rgba(0, 255, 25, .45); border-radius: var(--r-md);
  padding: 10px 14px; background: rgba(0, 255, 25, .06); margin: 16px 0;
  font-weight: 800; letter-spacing: .1em; color: var(--primary-green);
}
.coupon-code button { background: none; border: 0; color: var(--white); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; font-size: .8rem; font-weight: 700; }
.coupon-code button:hover { color: var(--primary-green); }

.ad-card { position: relative; display: flex; flex-direction: column; }
.ad-card .ad-body { padding: 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.ad-card .ad-adv { display: flex; align-items: center; gap: 10px; }
.ad-card .ad-adv .thumb { width: 38px; height: 38px; border-radius: 11px; font-size: .8rem; }
.ad-card .sponsor-tag { position: absolute; top: 12px; left: 12px; z-index: 2; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); border: 1px dashed var(--border); border-radius: var(--r-lg); }
.empty-state svg { color: var(--text-dim); margin-bottom: 12px; }

/* Utility grid for content lists */
.auto-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.auto-grid-sm { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
