/* h2jgift-front.css - Page carte cadeau FO v1.0.4
 * Pattern : card centree, tokens CUBX, montants grille 2x4
 *
 * @version 1.0.4
 */

/* sr-only (au cas où le theme ne le definit pas) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =========================================================================
   LAYOUT CARD
   ========================================================================= */
.h2jgift-page {
  padding: 32px 16px 48px;
}

/* v1.2.5 -- Container parent pour titre + card alignes (pattern h2jblog).
   Le H1 est rendu par <header class="h2jgift-page-title"> dans le template
   (pas le H1 PS natif), centre via text-align:center. Le breadcrumb PS natif
   est neutralise dans gift.tpl ({block name='breadcrumb'}{/block}). */
.h2jgift-container {
  max-width: 760px;
  margin: 0 auto;
}

.h2jgift-page-title {
  text-align: center;
  margin: 8px 0 28px;
  padding: 0 16px;
}

.h2jgift-page-title__h1 {
  font-size: 2.25rem;
  font-weight: 700;
  margin: 0;
  color: var(--h2j-text, #1a1a1a);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

@media (max-width: 600px) {
  .h2jgift-page-title__h1 {
    font-size: 1.65rem;
  }
  .h2jgift-page-title {
    margin: 4px 0 20px;
  }
}

.h2jgift-card {
  max-width: 720px;
  margin: 0 auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 16px rgba(0,0,0,.08);
  padding: 32px 36px;
}

@media (max-width: 600px) {
  .h2jgift-card {
    padding: 20px 16px;
  }
}

/* =========================================================================
   SECTIONS
   ========================================================================= */
.h2jgift-section {
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid #f0f0f0;
}

.h2jgift-section:last-of-type {
  border-bottom: none;
  margin-bottom: 20px;
}

.h2jgift-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--cubx-dark, #1a1a1a);
}

.h2jgift-section-title .material-icons {
  font-size: 20px;
  color: var(--cubx-gold, #b8960c);
}

.h2jgift-section-title .h2jgift-optional {
  font-size: 12px;
  font-weight: 400;
  color: var(--bs-secondary, #6c757d);
  margin-left: 4px;
}

.h2jgift-section-desc {
  font-size: 13px;
  color: var(--bs-secondary, #6c757d);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* Required indicator */
.required {
  color: #dc3545;
  font-weight: 700;
}

/* =========================================================================
   MONTANTS PREDEFINIS - GRILLE 2x4
   ========================================================================= */
.h2jgift-amounts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.h2jgift-amounts--grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

@media (max-width: 520px) {
  .h2jgift-amounts--grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.h2jgift-amount-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  background: #fff;
  color: #333;
  user-select: none;
  margin: 0;
}

.h2jgift-amount-btn input[type="radio"] {
  display: none;
}

.h2jgift-amount-btn.selected,
.h2jgift-amount-btn:hover {
  border-color: var(--cubx-gold, #b8960c);
  background: var(--cubx-gold-light, #fdf8e8);
  color: var(--cubx-gold, #b8960c);
}

/* =========================================================================
   MONTANT LIBRE
   ========================================================================= */
.h2jgift-free-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px dashed #e8e8e8;
}

.h2jgift-free-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
  margin: 0;
  font-weight: 500;
}

.h2jgift-free-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.h2jgift-free-input-wrap input[type="number"] {
  width: 100px;
  padding: 6px 10px;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  font-size: 14px;
}

.h2jgift-free-input-wrap small {
  font-size: 12px;
  color: var(--bs-secondary, #6c757d);
}

.h2jgift-hidden {
  display: none !important;
}

/* =========================================================================
   GRILLE SENDER / RECIPIENT
   ========================================================================= */
.h2jgift-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 520px) {
  .h2jgift-grid {
    grid-template-columns: 1fr;
  }
}

.h2jgift-grid .form-group label,
.h2jgift-section .form-group label {
  font-size: 13px;
  display: block;
  margin-bottom: 4px;
  color: #555;
  font-weight: 500;
}

/* =========================================================================
   MODE DE LIVRAISON
   ========================================================================= */
.h2jgift-delivery-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

@media (max-width: 520px) {
  .h2jgift-delivery-options {
    grid-template-columns: 1fr;
  }
}

.h2jgift-delivery-opt {
  position: relative;
  display: block;
  padding: 14px 16px;
  border: 2px solid #dee2e6;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: #fff;
  margin: 0;
}

.h2jgift-delivery-opt input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.h2jgift-delivery-opt:hover,
.h2jgift-delivery-opt:has(input:checked) {
  border-color: var(--cubx-gold, #b8960c);
  background: var(--cubx-gold-light, #fdf8e8);
}

.h2jgift-delivery-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.h2jgift-delivery-content .material-icons {
  font-size: 28px;
  color: var(--cubx-gold, #b8960c);
  flex-shrink: 0;
}

.h2jgift-delivery-content strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--cubx-dark, #1a1a1a);
}

.h2jgift-delivery-content small {
  display: block;
  font-size: 12px;
  color: var(--bs-secondary, #6c757d);
  margin-top: 2px;
  line-height: 1.4;
}

.h2jgift-email-block {
  padding-top: 8px;
}

/* =========================================================================
   MESSAGE PERSONNEL FULL-WIDTH
   ========================================================================= */
.h2jgift-full-width {
  width: 100%;
}

.h2jgift-message {
  width: 100%;
  resize: vertical;
  min-height: 90px;
}

/* =========================================================================
   SELECTEUR VISUELS (12 thèmes)
   ========================================================================= */
.h2jgift-templates {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

@media (max-width: 720px) {
  .h2jgift-templates {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 420px) {
  .h2jgift-templates {
    grid-template-columns: 1fr;
  }
}

.h2jgift-template {
  position: relative;
  display: block;
  cursor: pointer;
  border: 3px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  background: #f7f7f7;
  margin: 0;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}

.h2jgift-template input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.h2jgift-template:hover {
  border-color: rgba(184, 150, 12, .35);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}

.h2jgift-template.selected {
  border-color: var(--cubx-gold, #b8960c);
  box-shadow: 0 4px 16px rgba(184, 150, 12, .25);
}

.h2jgift-template picture,
.h2jgift-template img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.h2jgift-template-label {
  display: block;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  background: #fff;
  color: var(--cubx-dark, #1a1a1a);
}

.h2jgift-template.selected .h2jgift-template-label {
  background: var(--cubx-gold-light, #fdf8e8);
  color: var(--cubx-gold, #b8960c);
}

.h2jgift-template-check {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 28px !important;
  color: var(--cubx-gold, #b8960c);
  background: #fff;
  border-radius: 50%;
  opacity: 0;
  transform: scale(.5);
  transition: opacity .15s, transform .15s;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}

.h2jgift-template.selected .h2jgift-template-check {
  opacity: 1;
  transform: scale(1);
}

/* =========================================================================
   MY ACCOUNT - Liste cartes (emises + recues)
   ========================================================================= */
.h2jgift-account-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.h2jgift-account-item {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
  padding: 14px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}

.h2jgift-account-item:hover {
  border-color: var(--cubx-gold, #b8960c);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.h2jgift-account-item--expired {
  opacity: .65;
}

.h2jgift-account-item--cancelled {
  opacity: .5;
}

@media (max-width: 520px) {
  .h2jgift-account-item {
    grid-template-columns: 1fr;
  }
}

.h2jgift-account-thumb {
  background: #f3f4f6;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.h2jgift-account-thumb picture,
.h2jgift-account-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.h2jgift-account-thumb--placeholder .material-icons {
  font-size: 48px;
  color: #d1d5db;
}

.h2jgift-account-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.h2jgift-account-amount {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.h2jgift-account-amount strong {
  font-size: 22px;
  font-weight: 700;
  color: var(--cubx-gold, #b8960c);
  line-height: 1.1;
}

.h2jgift-account-amount small {
  font-size: 12px;
  color: var(--bs-secondary, #6c757d);
}

.h2jgift-account-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px 16px;
  padding-top: 6px;
  border-top: 1px dashed #e5e7eb;
}

.h2jgift-account-meta > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.h2jgift-account-meta small {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--bs-secondary, #6c757d);
}

.h2jgift-account-meta code,
.h2jgift-account-meta span {
  font-size: 13px;
  font-weight: 600;
  color: var(--cubx-dark, #1a1a1a);
}

.h2jgift-account-meta code {
  font-family: monospace, ui-monospace;
  letter-spacing: 1px;
}

/* Empty state */
.h2jgift-empty {
  text-align: center;
  padding: 28px 16px;
  background: #f9fafb;
  border: 1px dashed #e5e7eb;
  border-radius: 10px;
  color: var(--bs-secondary, #6c757d);
}

.h2jgift-empty .material-icons {
  font-size: 44px;
  color: #d1d5db;
  margin-bottom: 8px;
}

.h2jgift-empty p {
  margin: 0 0 6px;
  font-size: 14px;
}

/* Badge link My Account card */
.h2jgift-account-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  background: var(--cubx-gold, #b8960c);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
}

/* =========================================================================
   PAGE CONSULTATION SOLDE (/mon-solde-h2j)
   ========================================================================= */
.h2jgift-balance-form {
  margin-top: 8px;
}

.h2jgift-balance-search {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.h2jgift-balance-search input[type="text"] {
  flex: 1;
  min-width: 220px;
  font-size: 16px;
  padding: 12px 14px;
  letter-spacing: 2px;
  font-weight: 600;
  text-transform: uppercase;
}

.h2jgift-balance-search button {
  padding: 12px 22px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.h2jgift-balance-result {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid #f0f0f0;
}

/* Statut badge */
.h2jgift-balance-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 18px;
}
.h2jgift-balance-status .material-icons {
  font-size: 18px !important;
}
.h2jgift-balance-status--active {
  background: #dcfce7;
  color: #166534;
}
.h2jgift-balance-status--used {
  background: #e0e7ff;
  color: #3730a3;
}
.h2jgift-balance-status--expired {
  background: #fee2e2;
  color: #991b1b;
}
.h2jgift-balance-status--cancelled {
  background: #f3f4f6;
  color: #4b5563;
}
.h2jgift-balance-status--pending {
  background: #fef9c3;
  color: #854d0e;
}

/* Solde principal */
.h2jgift-balance-amount {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}
.h2jgift-balance-amount small {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--bs-secondary, #6c757d);
}
.h2jgift-balance-amount strong {
  font-size: 36px;
  font-weight: 700;
  color: var(--cubx-gold, #b8960c);
  line-height: 1.2;
}
.h2jgift-balance-initial {
  font-size: 12px;
  color: var(--bs-secondary, #6c757d);
  margin-top: 4px;
}

/* Jauge */
.h2jgift-balance-gauge {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 20px;
}
.h2jgift-balance-gauge-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cubx-gold, #b8960c), #f59e0b);
  transition: width .4s ease;
}

/* Meta (code + expiry) */
.h2jgift-balance-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px dashed #e5e7eb;
  border-bottom: 1px dashed #e5e7eb;
  margin-bottom: 20px;
}
.h2jgift-balance-meta > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.h2jgift-balance-meta small {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--bs-secondary, #6c757d);
}
.h2jgift-balance-meta strong {
  font-size: 15px;
  font-weight: 600;
  color: var(--cubx-dark, #1a1a1a);
  font-family: monospace, ui-monospace;
  letter-spacing: 1px;
}

@media (max-width: 520px) {
  .h2jgift-balance-meta {
    grid-template-columns: 1fr;
  }
}

/* Historique transactions */
.h2jgift-balance-history-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--cubx-dark, #1a1a1a);
}
.h2jgift-balance-history-title .material-icons {
  font-size: 18px;
  color: var(--cubx-gold, #b8960c);
}
.h2jgift-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.h2jgift-history-table th {
  text-align: left;
  padding: 8px 6px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--bs-secondary, #6c757d);
  border-bottom: 1px solid #e5e7eb;
}
.h2jgift-history-table td {
  padding: 10px 6px;
  border-bottom: 1px solid #f3f4f6;
}
.h2jgift-history-table tr:last-child td {
  border-bottom: none;
}

/* =========================================================================
   SUBMIT
   ========================================================================= */
.h2jgift-submit {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  font-weight: 600;
  letter-spacing: .3px;
}
