/* SMS section for the owner dashboard.
   Prefix: .lc-sms
   Load after style.css. Uses the dashboard tokens (--ink, --mut, --sub, --line, --bg, --acc)
   and existing button classes (.btn, .btn.sm, .btn.ghost).

   Plan modes (Huy, 16 Nov 2026):
   - .lc-sms--plus  — automatic birthday and 3-month messages; Birthday customers is a list
   - .lc-sms--basic — packs and templates stay open; birthday and 3-month lists have a
                      Send SMS button on each consented row (nothing is automatic) */

.lc-sms{
  --lc-sms-ink:var(--ink,#0E0E10);
  --lc-sms-mut:var(--mut,#8B8B93);
  --lc-sms-sub:var(--sub,#55555C);
  --lc-sms-line:var(--line,#E7E7EA);
  --lc-sms-bg:var(--bg,#F4F4F6);
  --lc-sms-acc:var(--acc,#2F5BFF);
  --lc-sms-card:#EEE;
  position:relative;
}

/* ----- Top bar: balance + Buy SMS ----- */
.lc-sms-bar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  border:1px solid var(--lc-sms-card);
  border-radius:16px;
  padding:16px 18px;
  background:#fff;
}
.lc-sms-balance small{
  display:block;
  font-size:12px;
  font-weight:400;
  color:var(--lc-sms-mut);
}
.lc-sms-balance b{
  display:block;
  font-size:30px;
  font-weight:700;
  letter-spacing:-1px;
  line-height:1.1;
  margin-top:6px;
}
.lc-sms-buy{flex:none}
.lc-sms-hints{
  margin-top:10px;
}
.lc-sms-hints .hint{
  margin-top:4px;
}
.lc-sms-hints .hint:first-child{margin-top:0}
.lc-sms--plus .lc-sms-hint-basic{display:none}
.lc-sms--basic .lc-sms-hint-plus{display:none}

/* ----- Pack chooser (modal) ----- */
.lc-sms-packs-note{
  margin:0 0 14px;
  font-size:13px;
  color:var(--lc-sms-sub);
}
.lc-sms-pack-grid{
  display:grid;
  grid-template-columns:1fr;
  gap:10px;
}
.lc-sms-pack{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:4px;
  width:100%;
  margin:0;
  padding:16px;
  border:1px solid var(--lc-sms-card);
  border-radius:16px;
  background:var(--lc-sms-bg);
  color:inherit;
  font:inherit;
  text-align:start;
  cursor:pointer;
  outline:none;
  transition:border-color .15s,box-shadow .15s;
}
.lc-sms-pack:hover{border-color:#D8D8DE}
.lc-sms-pack:focus-visible{
  border-color:var(--lc-sms-ink);
  box-shadow:0 0 0 3px #0e0e1012;
}
.lc-sms-pack-count{
  font-size:18px;
  font-weight:700;
  letter-spacing:-.4px;
}
.lc-sms-pack-price{
  font-size:16px;
  font-weight:600;
  color:var(--lc-sms-sub);
  font-variant-numeric:tabular-nums;
}
.lc-sms-pack-rate{
  margin-top:2px;
  font-size:12px;
  color:var(--lc-sms-mut);
}
.lc-sms-pack-pending{
  display:inline-block;
  margin-top:6px;
  padding:2px 9px;
  border-radius:20px;
  background:#FFF4E5;
  color:#5a3d00;
  font-size:12px;
  font-weight:600;
  line-height:1.35;
}

@media(min-width:860px){
  .lc-sms-pack-grid{grid-template-columns:repeat(3,1fr);gap:14px}
}

/* ----- Section headings ----- */
.lc-sms-block{margin-top:22px}
.lc-sms-h{
  font-size:14px;
  font-weight:600;
  margin:0 0 12px;
}

/* ----- Group tabs / chips ----- */
.lc-sms-tabs{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
  margin:0 0 14px;
}
.lc-sms-tab{
  appearance:none;
  border:1px solid var(--lc-sms-line);
  background:#fff;
  border-radius:999px;
  padding:5px 12px;
  font:inherit;
  font-size:13px;
  color:var(--lc-sms-sub);
  cursor:pointer;
  white-space:nowrap;
  line-height:1.3;
}
.lc-sms-tab.is-on{
  background:var(--lc-sms-ink);
  border-color:var(--lc-sms-ink);
  color:#fff;
  font-weight:600;
}
.lc-sms-tab:focus-visible{
  outline:none;
  box-shadow:0 0 0 3px #0e0e1012;
}

/* ----- Template grid (scales as groups are added) ----- */
.lc-sms-grid{
  display:grid;
  grid-template-columns:1fr;
  gap:14px;
}
@media(max-width:859px){
  /* One peeking row on a phone, so Automatic / Birthday customers stay in reach */
  .lc-sms-grid{
    display:flex;
    gap:12px;
    overflow-x:auto;
    scroll-snap-type:x mandatory;
    margin:0 -16px;
    padding:0 16px 6px;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:none;
  }
  .lc-sms-grid::-webkit-scrollbar{display:none}
  .lc-sms-card{
    flex:0 0 78%;
    max-width:300px;
    scroll-snap-align:start;
  }
}
@media(min-width:860px){
  .lc-sms-grid{grid-template-columns:repeat(auto-fill,minmax(260px,1fr))}
}
.lc-sms-card{
  display:block;
  width:100%;
  margin:0;
  padding:14px;
  border:1px solid var(--lc-sms-card);
  border-radius:16px;
  background:#fff;
  color:inherit;
  font:inherit;
  text-align:start;
  cursor:pointer;
  outline:none;
  transition:border-color .15s,background .15s;
}
.lc-sms-card:hover{background:#FAFAFB}
.lc-sms-card:focus-visible{
  border-color:var(--lc-sms-ink);
  box-shadow:0 0 0 3px #0e0e1012;
}

/* Phone-message-bubble preview */
.lc-sms-phone{
  background:var(--lc-sms-bg);
  border:1px solid var(--lc-sms-card);
  border-radius:16px;
  padding:10px 12px 14px;
}
.lc-sms-phone-bar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  font-size:10px;
  font-weight:600;
  letter-spacing:.2px;
  color:var(--lc-sms-mut);
  padding:0 2px 8px;
  line-height:1;
}
.lc-sms-bubble{
  display:block;
  width:fit-content;
  max-width:100%;
  background:#E8E8ED;
  color:var(--lc-sms-ink);
  border-radius:18px 18px 18px 6px;
  padding:10px 14px;
  font-size:14px;
  font-weight:400;
  line-height:1.4;
  overflow-wrap:anywhere;
}
.lc-sms-ph{
  display:inline;
  padding:0 3px;
  border-radius:4px;
  background:#EEF2FF;
  color:#1B2A66;
  font-weight:600;
}

/* ----- Edit panel ----- */
.lc-sms-edit-preview{margin:0 0 14px}
.lc-sms-text{
  display:block;
  width:100%;
  min-height:132px;
  margin:0;
  border:1px solid var(--lc-sms-line);
  border-radius:14px;
  padding:13px 14px;
  background:#fff;
  font:inherit;
  font-size:16px;
  line-height:1.45;
  color:inherit;
  resize:vertical;
  outline:none;
  transition:border-color .15s,box-shadow .15s;
}
.lc-sms-text:focus{
  border-color:var(--lc-sms-ink);
  box-shadow:0 0 0 3px #0e0e1012;
}
.lc-sms-count{
  display:block;
  margin-top:8px;
  font-size:12px;
  color:var(--lc-sms-mut);
  text-align:right;
  font-variant-numeric:tabular-nums;
}
.lc-sms-count.is-long{color:var(--lc-sms-sub)}
.lc-sms-uses{
  display:none;
  margin-top:10px;
  padding:8px 12px;
  border-radius:12px;
  background:#FFF4E5;
  color:#5a3d00;
  font-size:13px;
  font-weight:600;
  line-height:1.35;
}
.lc-sms-uses.is-on{display:block}
.lc-sms-uses[hidden]{display:none!important}
.lc-sms-row .lc-sms-uses{
  display:none;
  margin:0;
  padding:3px 10px;
  border-radius:20px;
  font-size:12px;
  flex:none;
}
.lc-sms-row .lc-sms-uses.is-on{display:inline-block}
.lc-sms-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
  margin-top:16px;
}
.lc-sms-actions .btn{
  width:auto;
  padding:0 16px;
  height:40px;
  font-size:14px;
  border-radius:12px;
}

/* ----- Automatic messages (Plus only) ----- */
.lc-sms-auto{
  border:1px solid var(--lc-sms-card);
  border-radius:16px;
  background:#fff;
  overflow:hidden;
}
.lc-sms--basic .lc-sms-auto-block{display:none}
.lc-sms-auto-row{
  padding:14px 18px;
  border-top:1px solid #F0F0F2;
}
.lc-sms-auto-row:first-child{border-top:0}
.lc-sms-auto-top{
  display:flex;
  align-items:center;
  gap:10px;
}
.lc-sms-auto-title{
  flex:1;
  min-width:0;
  font-size:14px;
  font-weight:600;
}
.lc-sms-auto-chosen{
  margin-top:10px;
}
.lc-sms-auto-chosen .lc-sms-bubble{
  padding:8px 12px;
  font-size:13px;
}

/* Switch */
.lc-sms-switch{
  appearance:none;
  flex:none;
  width:44px;
  height:28px;
  margin:0;
  padding:0;
  border:0;
  border-radius:999px;
  background:var(--lc-sms-line);
  position:relative;
  cursor:pointer;
  transition:background .15s;
}
.lc-sms-switch::after{
  content:"";
  position:absolute;
  top:3px;
  left:3px;
  width:22px;
  height:22px;
  border-radius:50%;
  background:#fff;
  box-shadow:0 1px 3px #00000022;
  transition:transform .15s;
}
.lc-sms-switch.is-on{background:var(--lc-sms-ink)}
.lc-sms-switch.is-on::after{transform:translateX(16px)}
.lc-sms-switch:focus-visible{outline:none;box-shadow:0 0 0 3px #0e0e1012}

/* ----- Customer lists: Birthday customers + (Basic) Not back in 3 months ----- */
.lc-sms-people{
  border:1px solid var(--lc-sms-card);
  border-radius:16px;
  background:#fff;
  padding:18px;
}
.lc-sms-people-title{
  font-size:14px;
  font-weight:600;
  margin:0;
}
.lc-sms-people-sub{
  margin:4px 0 0;
  font-size:14px;
  color:var(--lc-sms-mut);
  line-height:1.45;
}
.lc-sms-people-note{
  margin:12px 0 0;
  font-size:12px;
  color:var(--lc-sms-sub);
  line-height:1.5;
}
.lc-sms--plus .lc-sms-people-note--basic{display:none}
.lc-sms--basic .lc-sms-people-note--plus{display:none}
.lc-sms--plus .lc-sms-lapsed{display:none}

.lc-sms-group{margin-top:14px}
.lc-sms-group-label{
  font-size:13px;
  font-weight:600;
  color:var(--lc-sms-sub);
  margin:0 0 2px;
}
.lc-sms-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:12px 0;
  border-top:1px solid #F0F0F2;
  font-size:14px;
}
.lc-sms-group-label + .lc-sms-row{border-top:0;padding-top:8px}
.lc-sms-row-text{
  min-width:0;
  flex:1;
  line-height:1.4;
  overflow-wrap:anywhere;
}
.lc-sms-row-text b{font-weight:600}
.lc-sms-row .btn.sm{
  flex:none;
  padding:9px 14px;
  white-space:nowrap;
}
.lc-sms-tag{
  display:inline-block;
  flex:none;
  padding:3px 10px;
  border-radius:20px;
  font-size:12px;
  font-weight:600;
  line-height:1.35;
  white-space:nowrap;
}
.lc-sms-tag--sent{
  background:#E9F8F2;
  color:var(--ok,#14A37F);
}
.lc-sms-tag--no{
  background:#F4F4F6;
  color:var(--lc-sms-mut);
}
.lc-sms-empty{
  color:var(--lc-sms-mut);
  font-size:13px;
  padding:14px 0 0;
  line-height:1.45;
}

/* Plus: no Send SMS button on birthday rows (they go out automatically) */
.lc-sms--plus .lc-sms-birthdays .lc-sms-send{display:none}

/* ----- Modals (packs, edit) ----- */
.lc-sms-modal{
  display:none;
  position:fixed;
  inset:0;
  z-index:80;
  background:#0E0E1059;
  align-items:flex-end;
  justify-content:center;
  padding:0;
}
.lc-sms-modal.is-open{display:flex}
.lc-sms-modal-panel{
  flex:none;
  height:auto;
  background:#fff;
  border-radius:22px 22px 0 0;
  padding:22px 20px 28px;
  width:100%;
  max-height:92vh;
  overflow:auto;
  -webkit-overflow-scrolling:touch;
}
.lc-sms-modal-panel>h3{
  font-size:18px;
  font-weight:700;
  letter-spacing:-.4px;
  margin:0 0 6px;
}
@media(min-width:860px){
  .lc-sms-modal{
    align-items:center;
    padding:24px;
  }
  .lc-sms-modal-panel{
    border-radius:22px;
    width:100%;
    max-width:520px;
    padding:28px 22px;
    box-shadow:0 30px 70px #0000001a;
  }
  .lc-sms-modal-panel.lc-sms-modal-panel--packs{max-width:640px}
}

@media(max-width:860px){
  .lc-sms-balance b{font-size:26px}
  .lc-sms-row{align-items:flex-start}
}
