/**
 * Grain Account — UI
 * Design tokens mirror the theme's :root palette (grape / cream /
 * dark / gold, Tajawal) with safe fallbacks, so the plugin looks
 * native even if the theme ever changes.
 * Mobile-first, RTL-first. Every selector is scoped under .gacct-*.
 */

.gacct-box, .gacct-page, .gacct-login-page, .gacct-gate {
  --g-grape: var(--grape, #8B1A6B);
  --g-cream: var(--cream, #F5EDD8);
  --g-dark:  var(--dark, #1A0F0A);
  --g-gold:  var(--gold, #C8963E);
  font-family: 'Tajawal', sans-serif;
}

/* ══════════ Shared atoms ══════════ */

.gacct-row { display: flex; gap: .5rem; }
.gacct-row .gacct-input { flex: 1; min-width: 0; }

.gacct-input {
  width: 100%;
  padding: .8rem 1rem;
  border: 2px solid #e8dfc9;
  border-radius: 12px;
  font: inherit;
  font-size: 1rem;             /* ≥16px: iOS لا يزوم على الحقل */
  background: #fff;
  color: var(--g-dark);
  transition: border-color .15s;
}
.gacct-input:focus { outline: none; border-color: var(--g-grape); }
.gacct-code { letter-spacing: 8px; font-weight: 800; text-align: center; font-size: 1.25rem; }

.gacct-btn {
  padding: .8rem 1.3rem;
  border: 0;
  border-radius: 12px;
  background: var(--g-grape);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .1s, opacity .15s;
  touch-action: manipulation;
}
.gacct-btn:active { transform: scale(.97); }
.gacct-btn[disabled] { opacity: .55; cursor: default; }
.gacct-btn-wide { width: 100%; display: block; }
.gacct-btn-wide small { display: block; font-weight: 400; opacity: .8; direction: ltr; margin-top: .2rem; }
.gacct-btn-ghost { background: transparent; color: var(--g-grape); border: 2px solid var(--g-grape); }

.gacct-label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: .4rem; color: var(--g-dark); }

.gacct-alt, .gacct-resend, .gacct-mini-link {
  background: none; border: 0; padding: .5rem 0 0;
  color: var(--g-grape); font: inherit; font-size: .85rem;
  cursor: pointer; text-decoration: none; display: inline-block;
}
.gacct-resend[disabled] { color: #b3a98f; cursor: default; }

.gacct-msg { min-height: 1.2rem; font-size: .85rem; font-weight: 700; margin-top: .5rem; }
.gacct-msg.ok  { color: #2E7D45; }
.gacct-msg.err { color: #D94530; }

.gacct-pw-wrap { position: relative; flex: 1; min-width: 0; }
.gacct-pw-wrap .gacct-input { padding-inline-end: 2.8rem; }
.gacct-eye {
  position: absolute; inset-inline-end: .6rem; top: 50%;
  transform: translateY(-50%);
  background: none; border: 0; font-size: 1.1rem; cursor: pointer;
  padding: .3rem; line-height: 1;
}

/* ══════════ Checkout box ══════════ */

.gacct-box { margin: 0 0 1.2rem; }

.gacct-trigger {
  width: 100%;
  display: flex; align-items: center; gap: .6rem;
  padding: .85rem 1.1rem;
  background: var(--g-cream);
  border: 2px dashed var(--g-gold);
  border-radius: 14px;
  font: inherit; font-size: .95rem;
  color: var(--g-dark);
  cursor: pointer;
  text-align: start;
}
.gacct-trigger b { color: var(--g-grape); }
.gacct-trigger-ic { font-size: 1.1rem; }

.gacct-panel {
  background: var(--g-cream);
  border: 2px solid var(--g-gold);
  border-radius: 14px;
  padding: 1.1rem;
  margin-top: .5rem;
  animation: gacct-in .18s ease-out;
}
@keyframes gacct-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.gacct-hello {
  background: var(--g-cream);
  border-radius: 14px;
  padding: .85rem 1.1rem;
  margin-bottom: 1.2rem;
  font-weight: 700;
  color: var(--g-dark);
}

/* ══════════ Thank-you card ══════════ */

.gacct-thankyou {
  background: var(--g-cream);
  border: 2px solid var(--g-gold);
  border-radius: 16px;
  padding: 1.3rem;
  margin: 1.5rem auto 0;
  max-width: 560px;
}
.gacct-ty-head { display: flex; gap: .8rem; align-items: flex-start; margin-bottom: 1rem; }
.gacct-ty-ic { font-size: 1.8rem; line-height: 1; }
.gacct-ty-head b { font-size: 1.05rem; color: var(--g-dark); }
.gacct-ty-head p { margin: .2rem 0 0; font-size: .88rem; color: #6b5f4e; }

.gacct-done-hero {
  background: #eaf5ee; color: #2E7D45;
  border-radius: 12px; padding: .9rem 1rem;
  font-weight: 800; text-align: center; margin-bottom: 1rem;
}
.gacct-pw-note { font-size: .85rem; color: #6b5f4e; margin: 0 0 .5rem; }
.gacct-link { display: inline-block; margin-top: 1rem; color: var(--g-grape); font-weight: 800; text-decoration: none; }

/* ══════════ Account page ══════════ */

.gacct-login-page { max-width: 460px; margin: 0 auto; padding: 2rem 1rem 3rem; }
.gacct-login-hero { text-align: center; margin-bottom: 1.4rem; }
.gacct-login-ic { font-size: 2.4rem; display: block; margin-bottom: .3rem; }
.gacct-login-hero h2 { color: var(--g-dark); margin: 0 0 .2rem; font-size: 1.5rem; }
.gacct-login-hero p { color: #6b5f4e; margin: 0; font-size: .92rem; }
.gacct-login-page .gacct-panel { animation: none; }
.gacct-login-page .gacct-step[data-step="password"] .gacct-label { margin-top: .8rem; }

.gacct-page { max-width: 760px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.gacct-head h1 { color: var(--g-dark); font-size: 1.7rem; margin: 0; }
.gacct-head p { color: var(--g-grape); font-weight: 800; margin: .15rem 0 0; }

.gacct-nav {
  display: flex; gap: .5rem; overflow-x: auto;
  padding: 1rem 0; margin-bottom: .5rem;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.gacct-nav::-webkit-scrollbar { display: none; }
.gacct-nav-link {
  flex: 0 0 auto;
  padding: .55rem 1.1rem;
  border-radius: 999px;
  background: #fff;
  border: 2px solid #e8dfc9;
  color: var(--g-dark);
  font-weight: 700; font-size: .9rem;
  text-decoration: none;
  white-space: nowrap;
}
.gacct-nav-link.is-active { background: var(--g-grape); border-color: var(--g-grape); color: #fff; }

.gacct-sec { margin: 1.4rem 0; }
.gacct-sec-title { font-size: 1.05rem; color: var(--g-dark); margin: 0 0 .7rem; }

.gacct-grid { display: grid; grid-template-columns: 1fr; gap: .8rem; }
@media (min-width: 640px) { .gacct-grid { grid-template-columns: 1fr 1fr; } }

.gacct-card {
  background: #fff;
  border: 2px solid #efe7d2;
  border-radius: 16px;
  padding: 1rem 1.1rem;
}
.gacct-card--live { border-color: var(--g-grape); background: linear-gradient(180deg, #fdf7ff 0%, #fff 100%); }
.gacct-card--quiet { background: var(--g-cream); border-color: #e8dfc9; }
.gacct-card--quiet b { color: var(--g-dark); display: block; margin-bottom: .15rem; }

.gacct-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; }
.gacct-order-no { color: #8b8172; font-size: .85rem; font-weight: 700; }

.gacct-status { padding: .25rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 800; }
.gacct-status--live { background: #f3e2f0; color: var(--g-grape); }
.gacct-status--wait { background: #fdf3d7; color: #9a7b12; }
.gacct-status--done { background: #eaf5ee; color: #2E7D45; }
.gacct-status--off  { background: #eee; color: #777; }

.gacct-eta {
  background: var(--g-cream);
  border-radius: 10px;
  padding: .55rem .8rem;
  font-weight: 800; font-size: .9rem;
  color: var(--g-dark);
  margin-bottom: .7rem;
}

.gacct-thumbs { display: flex; align-items: center; gap: .4rem; margin-bottom: .7rem; }
.gacct-thumbs img {
  width: 52px; height: 52px; object-fit: cover;
  border-radius: 10px; border: 1px solid #efe7d2;
}
.gacct-thumbs-more {
  width: 52px; height: 52px; border-radius: 10px;
  background: var(--g-cream); color: var(--g-dark);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .85rem;
}

.gacct-card-meta { display: flex; justify-content: space-between; margin-bottom: .6rem; font-size: .88rem; }
.gacct-date { color: #8b8172; }
.gacct-total { font-weight: 800; color: var(--g-dark); }
.gacct-card-foot { display: flex; justify-content: space-between; align-items: center; gap: .6rem; }

.gacct-empty { text-align: center; padding: 1.6rem 1rem; background: var(--g-cream); border-radius: 16px; }
.gacct-empty p { margin: 0 0 .8rem; color: var(--g-dark); font-weight: 700; }

/* Native WC endpoint content (orders table, addresses, account form)
   gets a gentle Grain coat without touching its markup */
.gacct-content .woocommerce-table,
.gacct-content .woocommerce-Address,
.gacct-content .woocommerce-EditAccountForm {
  background: #fff; border: 2px solid #efe7d2; border-radius: 16px; padding: 1rem;
}
.gacct-content .woocommerce-button, .gacct-content .button {
  background: var(--g-grape) !important; color: #fff !important;
  border-radius: 12px !important; border: 0 !important; font-weight: 800 !important;
}

/* ══════════ Header button (theme .cart-btn twin) ══════════ */
.gacct-nav-btn { text-decoration: none; }

/* ══════════ Grain Account v1.2 polish ══════════ */

/* Compact header account button: keep the word, lose the bulk. */
.gacct-nav-btn {
  padding: .38rem .68rem !important;
  gap: .24rem !important;
  font-size: .72rem !important;
  line-height: 1 !important;
  min-height: 30px;
  border-radius: 6px !important;
}
.gacct-nav-btn .gacct-nav-icon { font-size: .82rem; line-height: 1; }
.gacct-nav-btn .gacct-nav-label { line-height: 1; }
@media (max-width: 520px) {
  .nav-r { gap: .42rem; }
  .gacct-nav-btn { padding: .34rem .52rem !important; font-size: .68rem !important; }
  .gacct-nav-btn .gacct-nav-icon { font-size: .76rem; }
}

.gacct-page { max-width: 820px; }
.gacct-head {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, #fff9ee 0%, #f8eef7 100%);
  border: 1px solid #eadfc7; border-radius: 18px;
  padding: 1.05rem 1.15rem; margin-bottom: .25rem;
}
.gacct-head h1 { font-size: clamp(1.28rem, 5vw, 1.65rem); line-height: 1.2; }
.gacct-head p { font-size: .84rem; margin-top: .25rem; }
.gacct-nav { padding: .85rem 0 .7rem; }
.gacct-nav-link { padding: .52rem .9rem; font-size: .82rem; border-width: 1px; }

.gacct-section-head {
  display: flex; align-items: end; justify-content: space-between;
  gap: .75rem; margin-bottom: .72rem;
}
.gacct-section-head .gacct-sec-title { margin: 0; }
.gacct-section-head > span { color: #948979; font-size: .75rem; }
.gacct-order-list { display: grid; gap: .95rem; }

.gacct-order-card {
  background: #fff; border: 1px solid #eadfc9; border-radius: 18px;
  overflow: hidden; box-shadow: 0 8px 24px rgba(47, 26, 17, .045);
}
.gacct-order-card.is-live {
  border: 1.5px solid var(--g-grape);
  box-shadow: 0 9px 28px rgba(139, 26, 107, .08);
}
.gacct-order-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: .75rem; padding: .9rem 1rem .78rem;
  border-bottom: 1px solid #f2ead9;
  background: #fffdf9;
}
.gacct-order-card.is-live .gacct-order-head { background: linear-gradient(90deg, #fffaf1, #fcf3fb); }
.gacct-order-sub { margin-top: .38rem; color: #8a7f70; font-size: .76rem; }
.gacct-order-details {
  color: var(--g-grape); text-decoration: none; font-size: .78rem;
  font-weight: 800; border-bottom: 1px solid rgba(139,26,107,.25); white-space: nowrap;
}
.gacct-order-card .gacct-eta { margin: .72rem .9rem 0; }
.gacct-order-products { padding: .15rem .9rem; }
.gacct-product-row {
  display: grid; grid-template-columns: 62px minmax(0,1fr) auto;
  align-items: center; gap: .72rem; padding: .78rem 0;
  border-bottom: 1px solid #f3ecde;
}
.gacct-product-row:last-child { border-bottom: 0; }
.gacct-product-image img {
  display: block; width: 62px; height: 62px; object-fit: cover;
  border-radius: 12px; border: 1px solid #eee3cd; background: #faf7f0;
}
.gacct-product-name { color: var(--g-dark); font-weight: 800; font-size: .9rem; line-height: 1.35; }
.gacct-product-qty { display: inline-block; margin-top: .28rem; color: #8a7f70; font-size: .74rem; }
.gacct-product-price { color: var(--g-dark); font-weight: 900; font-size: .82rem; white-space: nowrap; direction: ltr; }
.gacct-item-meta { margin-top: .16rem; color: #8a7f70; font-size: .7rem; }
.gacct-item-meta ul, .gacct-item-meta p { margin: 0; padding: 0; list-style: none; }
.gacct-order-summary { border-top: 1px solid #eee4d2; background: #fcfaf5; padding: .68rem .95rem; }
.gacct-order-summary > div { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .22rem 0; font-size: .78rem; color: #6e6354; }
.gacct-order-summary strong { color: var(--g-dark); direction: ltr; }
.gacct-order-summary .is-total { margin-top: .25rem; padding-top: .52rem; border-top: 1px dashed #dfd2b8; font-size: .9rem; font-weight: 900; }
.gacct-order-actions { padding: .75rem .9rem .9rem; display: flex; justify-content: flex-end; }
.gacct-order-actions .gacct-btn { min-width: 130px; text-align: center; }

.gacct-page-title {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin: .25rem 0 1rem;
}
.gacct-page-title h2 { margin: 0; color: var(--g-dark); font-size: 1.28rem; }
.gacct-page-title p { margin: .25rem 0 0; color: #7c7162; font-size: .82rem; }
.gacct-title-icon {
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--g-cream); border: 1px solid #e8dcc2; border-radius: 14px; font-size: 1.2rem;
}
.gacct-profile-page, .gacct-view-order { direction: rtl; }
.gacct-profile-form { display: grid; gap: .9rem; }
.gacct-form-card {
  background: #fff; border: 1px solid #eadfc9; border-radius: 18px;
  padding: 1rem; box-shadow: 0 8px 24px rgba(47, 26, 17, .035);
}
.gacct-form-card-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: .75rem;
  margin-bottom: .85rem;
}
.gacct-form-card-head h3 { margin: 0; color: var(--g-dark); font-size: .96rem; }
.gacct-form-card-head span { color: #918676; font-size: .72rem; }
.gacct-form-grid { display: grid; gap: .75rem; }
.gacct-form-grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.gacct-form-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.gacct-field { display: block; margin-bottom: .75rem; }
.gacct-field:last-child { margin-bottom: 0; }
.gacct-field > span { display: block; margin-bottom: .36rem; color: var(--g-dark); font-size: .78rem; font-weight: 800; }
.gacct-field small { display: block; margin-top: .34rem; color: #948979; font-size: .68rem; }
.gacct-field .gacct-input { width: 100%; box-sizing: border-box; }
.gacct-input.is-readonly { background: #f7f3eb; color: #786e60; cursor: default; }
.gacct-phone-field { position: relative; direction: ltr; }
.gacct-phone-field > span {
  position: absolute; left: 0; top: 0; bottom: 0; width: 58px;
  display: flex; align-items: center; justify-content: center;
  background: #f4ecdc; border: 1px solid #ded1b7; border-radius: 12px 0 0 12px;
  color: var(--g-dark); font-size: .78rem; font-weight: 800; z-index: 2;
}
.gacct-phone-field input { padding-left: 68px !important; text-align: left; }
.gacct-map-link {
  display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: .7rem;
  margin-top: .25rem; padding: .72rem .8rem;
  background: #f8f1f7; border: 1px solid #e4cfe0; border-radius: 14px;
  color: var(--g-dark); text-decoration: none;
}
.gacct-map-link:hover { border-color: var(--g-grape); }
.gacct-map-pin { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; background: #fff; border-radius: 11px; }
.gacct-map-link b { display: block; font-size: .82rem; }
.gacct-map-link small { display: block; margin-top: .15rem; color: #7e7364; font-size: .68rem; }
.gacct-map-arrow { color: var(--g-grape); font-weight: 900; direction: ltr; }
.gacct-map-pending { margin-top: .25rem; padding: .72rem .8rem; border-radius: 13px; background: #f7f3eb; color: #7e7364; font-size: .74rem; }
.gacct-save-address { margin-top: .1rem; }
.gacct-hidden-field { display: none !important; }

.gacct-back-link { display: inline-block; margin-bottom: .85rem; color: var(--g-grape); font-weight: 800; font-size: .78rem; text-decoration: none; }
.gacct-order-title { align-items: center; }
.gacct-order-products--detail { padding: 0; }
.gacct-order-summary--detail { margin: .65rem -1rem -1rem; padding: .8rem 1rem; border-radius: 0 0 18px 18px; }
.gacct-order-note { margin-bottom: .9rem; padding: .8rem .9rem; border-radius: 14px; background: #fff5d9; border: 1px solid #efdca4; }
.gacct-order-note b { color: var(--g-dark); font-size: .82rem; }
.gacct-order-note p { margin: .3rem 0 0; color: #6f624d; font-size: .76rem; }
.gacct-address-lines { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .65rem; }
.gacct-address-lines > div { background: #faf7f0; border-radius: 12px; padding: .65rem .72rem; }
.gacct-address-lines span { display: block; color: #908575; font-size: .68rem; margin-bottom: .18rem; }
.gacct-address-lines b { color: var(--g-dark); font-size: .8rem; }
.gacct-customer-note { margin: 0; color: #6f6455; font-size: .8rem; }

/* Required-once birthday gate */
.gacct-gate {
  position: fixed; inset: 0; z-index: 999999;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem; background: rgba(22, 11, 16, .62); backdrop-filter: blur(5px);
  transition: opacity .22s ease;
}
.gacct-gate.is-done { opacity: 0; pointer-events: none; }
.gacct-gate-card {
  width: min(100%, 390px); background: #fffdf9; border: 1px solid #eadfc9;
  border-radius: 22px; padding: 1.25rem; text-align: center;
  box-shadow: 0 22px 70px rgba(0,0,0,.2); direction: rtl;
}
.gacct-gate-icon { display: inline-flex; width: 52px; height: 52px; align-items: center; justify-content: center; background: var(--g-cream); border-radius: 16px; font-size: 1.45rem; }
.gacct-gate h2 { color: var(--g-dark); margin: .7rem 0 .3rem; font-size: 1.16rem; }
.gacct-gate p { color: #74695b; margin: 0 0 .85rem; font-size: .78rem; line-height: 1.65; }
.gacct-bday-field { padding: .75rem; margin: 0 0 .7rem; background: #faf5eb; border: 1px solid #eadfc9; border-radius: 15px; }
.gacct-bday-label { display: block; margin: 0 0 .42rem; color: var(--g-dark); font-size: .78rem; font-weight: 800; text-align: start; }
.gacct-gate .gacct-input { width: 100%; box-sizing: border-box; margin: 0; text-align: center; border: 2px solid #dfcfb3; background:#fff; }
.gacct-gate .gacct-input:focus { border-color:#8B1A6B; box-shadow:0 0 0 3px rgba(139,26,107,.09); }
.gacct-gate .gacct-bday-confirm {
  width:100% !important; display:flex !important; align-items:center; justify-content:center;
  min-height:49px; padding:.82rem 1rem !important; border:0 !important; border-radius:14px !important;
  background:#8B1A6B !important; color:#fff !important; font-size:.92rem; font-weight:900;
  box-shadow:0 9px 22px rgba(139,26,107,.24); opacity:1;
}
.gacct-gate .gacct-bday-confirm[disabled] {
  background:#d8bfd0 !important; color:#fff !important; box-shadow:none; opacity:1; cursor:not-allowed;
}
.gacct-bday-row .gacct-bday-confirm { min-width: 92px; }
.gacct-gate .gacct-msg { margin-top: .55rem; }

@media (max-width: 620px) {
  .gacct-page { padding: 1rem .72rem 2.5rem; }
  .gacct-head { padding: .88rem .9rem; border-radius: 15px; }
  .gacct-nav-link { padding: .48rem .75rem; font-size: .76rem; }
  .gacct-sec { margin: 1.05rem 0; }
  .gacct-order-head { padding: .78rem .82rem .68rem; }
  .gacct-order-products { padding: .05rem .78rem; }
  .gacct-product-row { grid-template-columns: 54px minmax(0,1fr) auto; gap: .58rem; padding: .68rem 0; }
  .gacct-product-image img { width: 54px; height: 54px; border-radius: 10px; }
  .gacct-product-name { font-size: .82rem; }
  .gacct-product-price { font-size: .74rem; }
  .gacct-order-summary { padding: .62rem .82rem; }
  .gacct-form-card { padding: .85rem; border-radius: 16px; }
  .gacct-form-grid.two, .gacct-form-grid.three { grid-template-columns: 1fr; gap: 0; }
  .gacct-address-lines { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 390px) {
  .gacct-product-row { grid-template-columns: 50px minmax(0,1fr); }
  .gacct-product-image img { width: 50px; height: 50px; }
  .gacct-product-price { grid-column: 2; justify-self: start; margin-top: -.2rem; }
  .gacct-address-lines { grid-template-columns: 1fr; }
}
