/*
  Bidluna Offers/Promos UI
  - Scoped styles for plugin UI (front only)
  - Uses CSS variables from frontend.css when available
*/

:root{
  --bidluna-blue: var(--primary-blue, #2563eb);
  --bidluna-green: var(--secondary-green, #10b981);
  --bidluna-text: #0f172a;
  --bidluna-muted: #64748b;
  --bidluna-border: rgba(148,163,184,.35);
  --bidluna-shadow: 0 14px 40px rgba(2,6,23,.18);
}

/* Generic premium buttons (plugin UI only) */
.bidluna-btn{
  appearance:none;
  border:0;
  cursor:pointer;
  font-weight:800;
  letter-spacing:.2px;
  border-radius:14px;
  padding:12px 16px;
  line-height:1;
  transition: transform .08s ease, filter .15s ease, opacity .15s ease;
  user-select:none;
}
.bidluna-btn:active{ transform: translateY(1px); }
.bidluna-btn[disabled]{ opacity:.55; cursor:not-allowed; }

.bidluna-btn--primary{
  color:#fff;
  background: linear-gradient(135deg, var(--bidluna-blue), var(--bidluna-green));
  box-shadow: 0 10px 26px rgba(2,6,23,.16);
}
.bidluna-btn--primary:hover{ filter: brightness(1.03); }

.bidluna-btn--ghost{
  background:#fff;
  color: var(--bidluna-blue);
  border: 2px solid rgba(37,99,235,.35);
}
.bidluna-btn--ghost:hover{ filter: brightness(.98); }

/* Small action buttons for tables */
.bidluna-btn--sm{ padding:10px 14px; border-radius:12px; font-size:13px; }

/* Loading state */
.bidluna-btn.is-loading{ position:relative; }
.bidluna-btn.is-loading:after{
  content:'';
  position:absolute;
  right:12px;
  top:50%;
  width:14px;
  height:14px;
  margin-top:-7px;
  border-radius:50%;
  border:2px solid rgba(255,255,255,.55);
  border-top-color:#fff;
  animation: bidlunaSpin .8s linear infinite;
}

/* Make loading state work for theme buttons too (offers tables) */
.btn.is-loading{ position:relative; opacity:.85; }
.btn.is-loading:after{
  content:'';
  position:absolute;
  right:12px;
  top:50%;
  width:14px;
  height:14px;
  margin-top:-7px;
  border-radius:50%;
  border:2px solid rgba(255,255,255,.55);
  border-top-color:#fff;
  animation: bidlunaSpin .8s linear infinite;
}
.btn.btn-outline.is-loading:after,
.btn.btn-ghost.is-loading:after{
  border-color: rgba(37,99,235,.35);
  border-top-color: rgba(37,99,235,1);
}
@keyframes bidlunaSpin{ to{ transform: rotate(360deg);} }

/* Toast */
.bidluna-toast{
  position:fixed;
  right:18px;
  bottom:18px;
  z-index: 999999;
  max-width: min(420px, 92vw);
  padding:12px 14px;
  border-radius:14px;
  background:#0b1220;
  color:#fff;
  box-shadow: var(--bidluna-shadow);
  opacity:0;
  transform: translateY(10px);
  transition: opacity .2s ease, transform .2s ease;
  font-weight:700;
}
.bidluna-toast.show{ opacity:1; transform: translateY(0); }
.bidluna-toast.success{ background: linear-gradient(135deg, #0ea5e9, #22c55e); }
.bidluna-toast.error{ background: linear-gradient(135deg, #ef4444, #f97316); }

/* Offer modal */
.bidluna-offer-modal{ position:fixed; inset:0; z-index:999990; }
.bidluna-offer-modal__backdrop{
  position:fixed; inset:0;
  background: rgba(2,6,23,.55);
  backdrop-filter: blur(2px);
}
.bidluna-offer-modal__panel{
  position:fixed;
  right:18px;
  top:90px;
  bottom:90px;
  width: min(460px, 92vw);
  background:#fff;
  border-radius:18px;
  box-shadow: var(--bidluna-shadow);
  overflow:hidden;
  display:flex;
  flex-direction:column;
}

.bidluna-offer-modal__header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding:16px 16px 12px 16px;
  border-bottom:1px solid var(--bidluna-border);
  background: linear-gradient(180deg, rgba(37,99,235,.08), rgba(16,185,129,.04));
}
.bidluna-offer-modal__title{ font-size:18px; font-weight:900; color: var(--bidluna-text); }
.bidluna-offer-modal__subtitle{ font-size:12px; color: var(--bidluna-muted); margin-top:4px; line-height:1.35; }
.bidluna-offer-modal__close{
  width:38px;
  height:38px;
  border-radius:12px;
  border:1px solid var(--bidluna-border);
  background:#fff;
  color: var(--bidluna-text);
  font-size:20px;
  line-height:34px;
  cursor:pointer;
}

.bidluna-offer-modal__body{
  padding:14px 16px 16px 16px;
  overflow:auto;
}

.bidluna-offer-item{
  gap:12px;
  align-items:center;
  padding:12px;
  border:1px solid var(--bidluna-border);
  border-radius:16px;
  margin-bottom:14px;
  background: rgba(148,163,184,.08);
}
.bidluna-offer-item__img{
  width:54px;
  height:54px;
  border-radius:12px;
  object-fit:cover;
  background:#fff;
  border:1px solid rgba(148,163,184,.45);
}
.bidluna-offer-item__title{ font-weight:900; color:var(--bidluna-text); font-size:14px; }
.bidluna-offer-item__note{ font-size:12px; color:var(--bidluna-muted); margin-top:2px; }

.bidluna-form-row{ margin-bottom:12px; }
.bidluna-offer-label{ display:block; font-weight:800; margin-bottom:6px; color:var(--bidluna-text); }
.bidluna-offer-input,
.bidluna-offer-textarea{
  width:100%;
  padding:12px 12px;
  border-radius:14px;
  border:1px solid rgba(148,163,184,.55);
  outline:none;
  background:#fff;
  font-size:14px;
}
.bidluna-offer-input:focus,
.bidluna-offer-textarea:focus{ border-color: rgba(37,99,235,.65); box-shadow: 0 0 0 4px rgba(37,99,235,.12); }
.bidluna-offer-textarea{ min-height: 92px; resize: vertical; }
.bidluna-help{ font-size:12px; color:var(--bidluna-muted); margin-top:6px; }

.bidluna-offer-actions{ display:flex; gap:10px; margin-top:12px; }
.bidluna-offer-actions .bidluna-btn{ flex:1; }

.bidluna-offer-feedback{
  margin-top:10px;
  padding:12px;
  border-radius:14px;
  font-weight:800;
  font-size:13px;
}
.bidluna-offer-feedback.is-ok{ background: rgba(34,197,94,.12); border:1px solid rgba(34,197,94,.35); color:#166534; }
.bidluna-offer-feedback.is-err{ background: rgba(239,68,68,.10); border:1px solid rgba(239,68,68,.30); color:#991b1b; }

@media (max-width: 640px){
  .bidluna-offer-modal__panel{
    left: 12px;
    right: 12px;
    top: 12px;
    bottom: 12px;
    width: auto;
    border-radius: 16px;
  }
  .bidluna-offer-actions{ flex-direction:column; }
}

/* Offers / Discounts tables (account pages) */
.bidluna-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  overflow:hidden;
  border-radius:16px;
  background:#fff;
  box-shadow: 0 10px 28px rgba(2,6,23,.08);
}
.bidluna-table th,
.bidluna-table td{ padding:12px 12px; border-bottom:1px solid rgba(148,163,184,.25); font-size:14px; }
.bidluna-table th{ color:var(--bidluna-muted); font-weight:900; text-transform:uppercase; font-size:12px; letter-spacing:.5px; }
.bidluna-table tr:last-child td{ border-bottom:0; }

.bidluna-pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  border-radius:999px;
  font-weight:900;
  font-size:12px;
  border:1px solid rgba(148,163,184,.35);
  background: rgba(148,163,184,.10);
  color: var(--bidluna-text);
}
.bidluna-pill.pending{ background: rgba(14,165,233,.10); border-color: rgba(14,165,233,.25); color:#075985; }
.bidluna-pill.accepted{ background: rgba(34,197,94,.10); border-color: rgba(34,197,94,.25); color:#166534; }
.bidluna-pill.refused{ background: rgba(239,68,68,.10); border-color: rgba(239,68,68,.25); color:#991b1b; }
.bidluna-pill.expired{ background: rgba(148,163,184,.10); border-color: rgba(148,163,184,.35); color:#334155; }

/* Promo badge / countdown (used in cards + product page) */
.bidluna-promo-badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  border-radius:999px;
  font-weight:1000;
  font-size:12px;
  color:#fff;
  background: linear-gradient(135deg, #0ea5e9, #22c55e);
  box-shadow: 0 8px 18px rgba(2,6,23,.14);
  white-space:nowrap;
}
.bidluna-promo-countdown{
  display:inline-flex;
  align-items:center;
  padding:6px 10px;
  border-radius:999px;
  font-weight:900;
  font-size:12px;
  background: rgba(15,23,42,.06);
  border: 1px solid rgba(148,163,184,.30);
  color: var(--bidluna-text);
  white-space:nowrap;
}
.bidluna-promo-countdown.is-ended{ opacity:.65; }

/* Make common theme buttons match Bidluna (front only) */
body .btn.btn-primary,
body a.btn.btn-primary,
body button.btn.btn-primary{
  background: linear-gradient(135deg, var(--bidluna-blue), var(--bidluna-green));
  border:0;
  box-shadow: 0 10px 26px rgba(2,6,23,.14);
  font-weight:900;
}
body .btn.btn-primary:hover{ filter: brightness(1.02); }
body .btn.btn-outline-primary,
body a.btn.btn-outline-primary,
body button.btn.btn-outline-primary{
  border:2px solid rgba(37,99,235,.35);
  color: var(--bidluna-blue);
  font-weight:900;
}


/* === v11.7 account offers/promos refinements === */
.bidluna-offers-wrap,
.bidluna-discounts-wrap{
  display:flex;
  flex-direction:column;
  gap:16px;
}
.bidluna-offers-wrap .bidluna-box,
.bidluna-discounts-wrap .bidluna-box{
  border:1px solid #e5ebf3;
  border-radius:22px;
  background:#fbfdff;
  padding:18px;
  box-shadow:0 10px 24px rgba(15,23,42,.04);
}
.bidluna-discount-panel .bidluna-discount-form{
  gap:14px !important;
}
.bidluna-history-panel{
  border-radius:22px;
  background:linear-gradient(180deg,#fbfdff 0%,#f7faff 100%);
  border:1px solid #e5ebf3;
  padding:10px;
  box-shadow:0 10px 24px rgba(15,23,42,.04);
}
.bidluna-table--cards{
  border-collapse:separate;
  border-spacing:0 10px;
  background:transparent;
  box-shadow:none;
  border-radius:0;
}
.bidluna-table--cards thead th{
  background:transparent;
  color:#6b7c93;
  font-size:11px;
  letter-spacing:.08em;
  text-transform:uppercase;
  border-bottom:0;
  padding:0 14px 6px;
}
.bidluna-table--cards tbody td{
  background:#fff;
  border-top:1px solid #e7edf5;
  border-bottom:1px solid #e7edf5;
  padding:12px 14px;
  vertical-align:middle;
}
.bidluna-table--cards tbody td:first-child{
  border-left:1px solid #e7edf5;
  border-top-left-radius:18px;
  border-bottom-left-radius:18px;
}
.bidluna-table--cards tbody td:last-child{
  border-right:1px solid #e7edf5;
  border-top-right-radius:18px;
  border-bottom-right-radius:18px;
}
.bidluna-cell-thumb{ width:72px; }
.bidluna-thumb-link{
  display:inline-flex;
  width:56px;
  height:72px;
  border-radius:16px;
  overflow:hidden;
  border:1px solid #dce6f2;
  background:#f8fafc;
  box-shadow:0 6px 18px rgba(15,23,42,.06);
}
.bidluna-thumb-link:hover{ transform:translateY(-1px); box-shadow:0 10px 22px rgba(15,23,42,.10); }
.bidluna-thumb{ display:block; width:100%; height:100%; object-fit:cover; }
.bidluna-offers-wrap .btn,
.bidluna-discounts-wrap .btn{ border-radius:999px; }
.bidluna-discounts-wrap h3,
.bidluna-offers-wrap h3,
.bidluna-discounts-wrap h4{ color:#132c54; }
@media (max-width: 767px){
  .bidluna-history-panel{padding:8px;}
  .bidluna-table--cards,
  .bidluna-table--cards thead,
  .bidluna-table--cards tbody,
  .bidluna-table--cards tr,
  .bidluna-table--cards th,
  .bidluna-table--cards td{display:block;width:100%;}
  .bidluna-table--cards thead{display:none;}
  .bidluna-table--cards{border-spacing:0;}
  .bidluna-table--cards tbody tr{display:block;margin:0 0 12px;}
  .bidluna-table--cards tbody td{
    border-left:1px solid #e7edf5;
    border-right:1px solid #e7edf5;
    border-top:0;
    border-bottom:0;
    border-radius:0 !important;
    padding:10px 12px;
  }
  .bidluna-table--cards tbody td:first-child{
    border-top:1px solid #e7edf5;
    border-top-left-radius:18px !important;
    border-top-right-radius:18px !important;
  }
  .bidluna-table--cards tbody td:last-child{
    border-bottom:1px solid #e7edf5;
    border-bottom-left-radius:18px !important;
    border-bottom-right-radius:18px !important;
  }
  .bidluna-cell-thumb{width:100%;}
  .bidluna-thumb-link{width:84px;height:84px;}
}


/* v11.8 hotfix — compact thumbs + rounded promo inputs */
.bidluna-table--gallery .bidluna-cell-thumb{width:72px !important;}
.bidluna-table--gallery .bidluna-thumb-link,
.bidluna-thumb-link--compact{width:56px !important;height:72px !important;border-radius:14px !important;display:inline-flex;align-items:center;justify-content:center;overflow:hidden;}
.bidluna-table--gallery .bidluna-thumb,
.bidluna-thumb--compact{width:100% !important;height:100% !important;object-fit:contain !important;background:#fff;display:block;}
.bidluna-discounts-wrap select,
.bidluna-discounts-wrap input[type="datetime-local"],
.bidluna-discounts-wrap .bidluna-offer-input{min-height:46px;border-radius:18px !important;border:1px solid #d9e3f2 !important;padding:10px 14px !important;background:#fff !important;}
@media (max-width: 767px){
  .bidluna-table--gallery .bidluna-thumb-link,
  .bidluna-thumb-link--compact{width:52px !important;height:66px !important;}
}
