/* ============================================================
   Ofertas Página Inicial - Drawer Styles v0.2.1
   FIXES: z-index consistente, botão copy, spinner loading
   v0.2.1: hover do trigger alterado para #223829
   ============================================================ */

/* Reset e isolamento */
#opi-drawer-wrapper,
#opi-drawer-wrapper *,
.opi-drawer-trigger {
  box-sizing: border-box;
}

/* ================================
   BOTÃO LATERAL FIXO
   ================================ */

.opi-drawer-trigger {
  position: fixed;
  top: 35%;
  right: 0;
  transform: translateY(-50%);
  z-index: 99990;

  width: 56px;
  height: 200px;

  background: #8b4b2b;
  color: #ffffff;

  border: none;
  border-radius: 14px 0 0 14px;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  padding: 0;

  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.1;
  letter-spacing: 0.4px;

  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.opi-drawer-trigger:hover,
.opi-drawer-trigger:focus,
.opi-drawer-trigger:active {
  background: #223829; /* hover — verde escuro da marca */
  color: #ffffff;
  filter: none;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.24);
}

.opi-drawer-trigger:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.85);
  outline-offset: 3px;
}

.opi-drawer-trigger-text {
  transform: rotate(-90deg);
  white-space: nowrap;
}

/* ================================
   OVERLAY
   ================================ */

.opi-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
  z-index: 99991;
}

/* ================================
   MODAL CENTRAL
   ================================ */

.opi-drawer {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  opacity: 0;
  visibility: hidden;

  width: 100%;
  max-width: 520px;
  max-height: 82vh;

  background: #ffffff;
  border-radius: 16px;

  display: flex;
  flex-direction: column;

  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.22);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;

  z-index: 99992;
}

/* Header */
.opi-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid #e5e5e5;
  flex-shrink: 0;
}

.opi-drawer-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #333;
}

#opi-drawer-wrapper .sb-auth-widget .sb-auth-btn,
#opi-drawer-wrapper .sb-auth-widget button.sb-auth-btn,
#opi-drawer-wrapper .sb-auth-widget button[type="submit"].sb-auth-btn,
#opi-drawer-wrapper .sb-auth-widget button[type="button"].sb-auth-btn,
#opi-drawer-wrapper .opi-drawer-close,
.opi-drawer-close {
  background: #223829 !important;
  background-color: #223829 !important;
  border: none !important;
  border-color: #223829 !important;
  color: #ffffff !important;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: none !important;
  appearance: none;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

#opi-drawer-wrapper .opi-drawer-close,
.opi-drawer-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 42px;
  font-size: 26px;
  line-height: 1;
  padding: 4px 8px;
}

#opi-drawer-wrapper .sb-auth-widget .sb-auth-btn:hover,
#opi-drawer-wrapper .sb-auth-widget .sb-auth-btn:focus,
#opi-drawer-wrapper .sb-auth-widget .sb-auth-btn:active,
#opi-drawer-wrapper .opi-drawer-close:hover,
#opi-drawer-wrapper .opi-drawer-close:focus,
#opi-drawer-wrapper .opi-drawer-close:active,
.opi-drawer-close:hover {
  color: #ffffff !important;
  background: #3A7D4E !important;
  background-color: #3A7D4E !important;
  border-color: #3A7D4E !important;
}

#opi-drawer-wrapper .sb-auth-widget .sb-auth-btn:focus-visible,
#opi-drawer-wrapper .opi-drawer-close:focus-visible,
.opi-drawer-close:focus-visible {
  outline: 3px solid #223829;
  outline-offset: 2px;
}

/* Content */
.opi-drawer-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

/* ================================
   LOADING SPINNER
   ================================ */

.opi-drawer-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #777;
  font-size: 14px;
}

.opi-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid #e0d0c8;
  border-top-color: #8b4b2b;
  border-radius: 50%;
  animation: opi-spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes opi-spin {
  to { transform: rotate(360deg); }
}

/* ================================
   LOGIN WALL
   ================================ */

.opi-login-wall {
  text-align: center;
}

.opi-login-title {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 700;
  color: #333;
}

.opi-login-missing {
  font-size: 14px;
  color: #b00020;
  margin: 0;
}

.opi-login-register {
  margin-top: 14px;
  font-size: 14px;
}

.opi-login-register a {
  color: #8b4b2b;
  text-decoration: underline;
}

/* ================================
   CUPONS
   ================================ */

.opi-coupons-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.opi-coupon-card {
  border: 2px dashed #c8855a;
  border-radius: 14px;
  padding: 16px 18px;
  text-align: center;
  background: #fafaf9;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.opi-coupon-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.07);
}

/* Código + botão de cópia lado a lado */
.opi-coupon-code-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.opi-coupon-code {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #8b4b2b;
}

/* Botão copiar */
#opi-drawer-wrapper .opi-copy-btn,
.opi-copy-btn {
  background: #223829 !important;
  background-color: #223829 !important;
  color: #ffffff !important;
  border: none !important;
  border-color: #223829 !important;
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none !important;
  transition: background 0.18s ease, transform 0.12s ease;
  white-space: nowrap;
}

#opi-drawer-wrapper .opi-copy-btn:hover,
#opi-drawer-wrapper .opi-copy-btn:focus,
#opi-drawer-wrapper .opi-copy-btn:active,
.opi-copy-btn:hover {
  background: #3A7D4E !important;
  background-color: #3A7D4E !important;
  border-color: #3A7D4E !important;
  color: #ffffff !important;
}

#opi-drawer-wrapper .opi-copy-btn:focus-visible,
.opi-copy-btn:focus-visible {
  outline: 3px solid #223829;
  outline-offset: 2px;
}

#opi-drawer-wrapper .opi-copy-btn.is-copied,
.opi-copy-btn.is-copied {
  background: #3A7D4E !important;
  background-color: #3A7D4E !important;
  transform: scale(1.04);
}

.opi-coupon-text {
  font-size: 14px;
  color: #555;
  line-height: 1.45;
}

.opi-no-coupons {
  text-align: center;
  font-size: 14px;
  color: #777;
  margin: 0;
}

/* Mensagem de erro */
.opi-drawer-error p {
  margin: 0;
  color: #b00020;
  font-size: 14px;
  text-align: center;
}

/* ================================
   ESTADO ABERTO
   ================================ */

.opi-drawer-wrapper.is-open .opi-drawer {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.opi-drawer-wrapper.is-open .opi-drawer-overlay {
  opacity: 1;
  visibility: visible;
}

/* ================================
   SCROLL LOCK
   ================================ */

html.opi-scroll-locked,
body.opi-scroll-locked {
  overflow: hidden;
}

/* ================================
   MOBILE
   ================================ */

@media (max-width: 768px) {
  .opi-drawer {
    width: 94vw;
    max-height: 88vh;
    border-radius: 14px;
  }

  .opi-drawer-trigger {
    width: 48px;
    height: 170px;
    font-size: 13px;
  }

  .opi-coupon-code {
    font-size: 22px;
  }

  .opi-coupon-code-wrap {
    flex-direction: column;
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .opi-drawer,
  .opi-drawer-overlay,
  .opi-drawer-trigger,
  .opi-coupon-card {
    transition: none;
  }
  .opi-spinner {
    animation: none;
  }
}
