/* FarmaPOS 1.0.4 - tablet fullscreen without changing other pages */
html body.farmapos-page { margin:0 !important; }
html body.farmapos-page #wpadminbar { display:none !important; }

/* The shortcode becomes an app overlay only on the page containing [farmapos]. */
.farmapos-app{
    position:fixed !important;
    inset:0 !important;
    width:100vw !important;
    height:100vh !important;
    min-height:100vh !important;
    margin:0 !important;
    padding:0 !important;
    z-index:2147483000 !important;
    background:#f5f8fc;
    overflow:hidden !important;
    box-sizing:border-box;
    font-family:Arial,Helvetica,sans-serif;
    color:#14213d;
}
.farmapos-app *{box-sizing:border-box}
body.farmapos-page > *:not(#wpadminbar) { }
.fp-sidebar{
    position:absolute; left:0; top:0; bottom:0; width:205px;
    background:#073b68; color:#fff; overflow:hidden; z-index:3;
}
.fp-brand{
    height:82px; display:flex; align-items:center; gap:9px; padding:12px 14px;
    background:#075292;
}
.fp-cross{font-size:38px; line-height:1}
.fp-brand strong{display:block;font-size:24px}
.fp-brand small{display:block;font-size:12px;margin-top:3px}
.fp-nav{
    width:100%; min-height:53px; border:0; background:transparent; color:#fff;
    text-align:left; padding:9px 13px; font-size:14px; font-weight:600; cursor:pointer;
}
.fp-nav.active,.fp-nav:hover{background:#1688ed}
.fp-nav span{margin-left:8px}
.fp-main{position:absolute;left:205px;right:0;top:0;bottom:0;overflow:hidden}
.fp-header{
    height:76px;background:#fff;border-bottom:1px solid #dce5ef;
    display:flex;align-items:center;justify-content:space-between;padding:10px 22px;
}
.fp-header h1{margin:0;font-size:28px}.fp-header span{font-size:13px;color:#65758b}
.fp-header-info{font-size:13px;color:#53657a}
.fp-content{height:calc(100% - 76px - 88px);padding:14px;overflow:hidden}
.fp-actions{display:flex;gap:10px;margin-bottom:12px}
.fp-actions button,.fp-bottom button{
    border:1px solid #d4deea;background:#fff;border-radius:7px;padding:11px 15px;
    font-weight:600;color:#193a5a;cursor:pointer;
}
.fp-actions .danger,.fp-bottom .danger{color:#c92b2b}
.fp-sale-grid{display:grid;grid-template-columns:minmax(0,1fr) 285px;gap:14px;height:calc(100% - 57px)}
.fp-product-panel,.fp-cart{background:#fff;border:1px solid #dbe4ee;border-radius:8px;overflow:hidden}
.fp-product-empty{height:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;color:#65758b;padding:20px}
.fp-product-empty h2{font-size:25px;color:#233b56;margin:0 0 10px}
.fp-product-card{height:100%;padding:28px;position:relative}
.fp-product-card h2{font-size:28px;margin:0 0 18px}
.fp-detail-grid{display:grid;grid-template-columns:150px 1fr;gap:12px;font-size:17px}
.fp-detail-grid span{color:#66778b}.fp-price{position:absolute;right:28px;top:25px;font-size:30px;font-weight:800;color:#073b68}
.fp-add-row{position:absolute;left:28px;right:28px;bottom:28px;display:flex;gap:8px}
.fp-add-row button,.fp-add-row input{height:48px;border:1px solid #cdd9e6;background:#fff;border-radius:6px;text-align:center;font-size:20px}
.fp-add-row button{width:48px}.fp-add-row input{width:70px}
.fp-add-row .add{width:auto;flex:1;background:#0b9b57;color:#fff;border:0;font-weight:700;font-size:17px}
.fp-cart{display:flex;flex-direction:column;min-width:0}
.fp-cart-title{padding:10px 12px;border-bottom:1px solid #e3eaf2;display:flex;justify-content:space-between;font-size:16px}
.fp-cart-title button{border:0;background:#fff;color:#c52c2c;font-weight:700}
.fp-cart-items{flex:1;overflow:auto;padding:8px}
.fp-cart-item{display:grid;grid-template-columns:1fr 55px 75px 28px;gap:5px;align-items:center;padding:10px;border-bottom:1px solid #edf1f5}
.fp-cart-item small{display:block;color:#718096}
.fp-cart-item .remove{color:#d72828;border:0;background:#fff;font-size:18px}
.empty{text-align:center;color:#8998aa;padding:40px 15px}
.fp-totals{padding:10px;border-top:1px solid #e3eaf2;font-size:15px}
.fp-totals div{display:flex;justify-content:space-between;padding:5px 0}.fp-totals .total{font-size:20px;font-weight:800;padding-top:12px}
.fp-bottom{
    position:absolute;left:205px;right:0;bottom:0;height:88px;background:#fff;border-top:1px solid #d7e1eb;
    display:grid;grid-template-columns:minmax(280px,1fr) 110px 120px 125px 180px;gap:8px;
    align-items:center;padding:10px 14px;z-index:5;
}
.fp-search{height:58px;border:2px solid #1688ed;border-radius:7px;display:flex;align-items:center;background:#fff}
.fp-search span{font-size:25px;padding:0 12px}.fp-search input{border:0;outline:0;flex:1;height:100%;font-size:16px;min-width:0}.fp-search button{border:0;background:transparent;font-size:18px;padding:10px}
.fp-bottom .pay{background:#0b9b57;color:#fff;border:0;font-size:18px}
@media (max-width:900px){
    .fp-sidebar{width:175px}.fp-main{left:175px}.fp-bottom{left:175px}
    .fp-sale-grid{grid-template-columns:minmax(0,1fr) 330px}
    .fp-nav{font-size:12px}.fp-brand strong{font-size:20px}
}
@media (max-width:700px){
    .fp-sidebar{width:68px}.fp-brand{justify-content:center;padding:8px}.fp-brand strong,.fp-brand small,.fp-nav span{display:none}
    .fp-nav{text-align:center;padding:12px 4px;font-size:18px}.fp-main{left:68px}.fp-bottom{left:68px}
    .fp-sale-grid{grid-template-columns:1fr}.fp-cart{display:none}
    .fp-bottom{grid-template-columns:minmax(180px,1fr) 80px 80px 85px 110px}
    .fp-bottom button{padding:8px 4px;font-size:12px}
}

/* FarmaPOS 1.0.5 - compact tablet POS */
.farmapos-app .fp-header{
    display:none !important;
}
.farmapos-app .fp-actions{
    display:none !important;
}
.farmapos-app .fp-main{
    top:0 !important;
}
.farmapos-app .fp-content{
    height:calc(100% - 88px) !important;
    padding:10px !important;
}
.farmapos-app .fp-sale-grid{
    height:100% !important;
}

/* FarmaPOS 1.0.6 - ensure bottom scanner/action bar is visible on tablet */
.farmapos-app{
  height:100dvh !important;
  max-height:100dvh !important;
}
.farmapos-app .fp-bottom{
  position:fixed !important;
  left:205px !important;
  right:0 !important;
  bottom:0 !important;
  height:76px !important;
  min-height:76px !important;
  display:flex !important;
  align-items:center !important;
  gap:7px !important;
  padding:8px 10px !important;
  background:#fff !important;
  box-shadow:0 -2px 8px rgba(0,0,0,.08) !important;
  z-index:2147483002 !important;
}
.farmapos-app .fp-search{
  flex:1 1 auto !important;
  min-width:260px !important;
  width:auto !important;
  height:58px !important;
}
.farmapos-app .fp-bottom > button{
  flex:0 0 88px !important;
  min-width:0 !important;
  height:58px !important;
  padding:6px 4px !important;
  font-size:13px !important;
}
.farmapos-app .fp-bottom > .pay{
  flex:0 0 125px !important;
}
@media (max-width:1100px){
  .farmapos-app .fp-sidebar{width:180px !important}
  .farmapos-app .fp-main{left:180px !important}
  .farmapos-app .fp-bottom{left:180px !important}
  .farmapos-app .fp-search{min-width:235px !important}
  .farmapos-app .fp-bottom > button{flex-basis:78px !important;font-size:12px !important}
  .farmapos-app .fp-bottom > .pay{flex-basis:105px !important}
}
@media (max-width:850px){
  .farmapos-app .fp-sidebar{width:64px !important}
  .farmapos-app .fp-main{left:64px !important}
  .farmapos-app .fp-bottom{left:64px !important}
  .farmapos-app .fp-search{min-width:170px !important}
  .farmapos-app .fp-bottom > button{flex-basis:70px !important}
  .farmapos-app .fp-bottom > .pay{flex-basis:92px !important}
}

@media (min-width:701px) and (max-width:1100px){
    .fp-sale-grid{grid-template-columns:minmax(0,1fr) 285px !important;gap:8px}
    .fp-cart-title{padding:9px 10px !important;font-size:15px !important}
    .fp-cart-items{padding:4px}
    .fp-cart-item{grid-template-columns:minmax(0,1fr) 34px 62px 22px;gap:3px;padding:7px;font-size:13px}
    .fp-cart-item small{font-size:11px}
    .fp-totals{padding:8px 10px !important;font-size:13px}
    .fp-totals .total{font-size:19px !important}
    .fp-bottom{
        grid-template-columns:minmax(300px,1fr) 125px 120px !important;
        gap:8px !important;
    }
    .fp-bottom > button:nth-of-type(1),
    .fp-bottom > button:nth-of-type(2){display:none !important}
}

/* FarmaPOS 1.0.9 - definitive tablet bottom bar */
@media (min-width:701px) and (max-width:1100px){
  .farmapos-app .fp-bottom{
    position:fixed !important;
    left:180px !important;
    right:0 !important;
    bottom:0 !important;
    height:68px !important;
    min-height:68px !important;
    display:grid !important;
    grid-template-columns:minmax(0,1fr) 92px 118px !important;
    gap:8px !important;
    padding:6px 10px !important;
    align-items:center !important;
    overflow:hidden !important;
  }

  .farmapos-app .fp-search{
    width:auto !important;
    min-width:0 !important;
    max-width:none !important;
    flex:none !important;
    height:48px !important;
    overflow:hidden !important;
  }

  .farmapos-app .fp-search input{
    min-width:0 !important;
    width:100% !important;
    font-size:14px !important;
    padding:0 4px !important;
  }

  .farmapos-app .fp-bottom > .danger,
  .farmapos-app .fp-bottom > .pay{
    width:auto !important;
    min-width:0 !important;
    max-width:none !important;
    flex:none !important;
    height:48px !important;
    margin:0 !important;
    padding:4px 5px !important;
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    white-space:nowrap !important;
    overflow:hidden !important;
  }

  .farmapos-app .fp-bottom > .pay{
    font-size:16px !important;
  }
}

@media (min-width:1101px){
  .farmapos-app .fp-bottom{
    display:grid !important;
    grid-template-columns:minmax(0,520px) 110px 140px !important;
  }
  .farmapos-app .fp-search{
    flex:none !important;
    min-width:0 !important;
  }
}

/* FarmaPOS 1.2.3 - medication center panel */
.farmapos-app .fp-product-panel{position:relative;overflow:auto;background:#fff;border-radius:8px}
.farmapos-app .fp-product-empty{min-height:100%;display:flex;align-items:center;justify-content:center;padding:24px;text-align:center}
.farmapos-app .fp-center-welcome{max-width:650px;width:100%;padding:30px}
.farmapos-app .fp-welcome-icon{font-size:54px;margin-bottom:8px}
.farmapos-app .fp-center-welcome h2{font-size:28px;margin:8px 0 10px;color:#15243a}
.farmapos-app .fp-center-welcome p{font-size:15px;color:#6d7d90;margin:0 auto 20px;line-height:1.5}
.farmapos-app .fp-search-hints{display:flex;justify-content:center;gap:8px;flex-wrap:wrap}
.farmapos-app .fp-search-hints span{border:1px solid #d9e3ee;border-radius:18px;padding:7px 12px;color:#526579;background:#f8fbfe;font-size:12px}
.farmapos-app .fp-product-card-large{padding:24px 28px;min-height:100%;box-sizing:border-box;display:flex;flex-direction:column;justify-content:flex-start}
.farmapos-app .fp-product-card-head{display:flex;justify-content:space-between;gap:20px;align-items:flex-start;border-bottom:1px solid #e5ebf2;padding-bottom:18px}
.farmapos-app .fp-product-label{font-size:11px;font-weight:800;letter-spacing:1px;color:#1688ed;margin-bottom:6px}
.farmapos-app .fp-product-card-large h2{font-size:30px;margin:0 0 6px;color:#17263a}
.farmapos-app .fp-formula-line{font-size:16px;color:#657589}
.farmapos-app .fp-price-box{min-width:125px;text-align:right}
.farmapos-app .fp-price-box small{display:block;color:#75869a;font-size:12px;margin-bottom:2px}
.farmapos-app .fp-price-box strong{font-size:30px;color:#0b9b57}
.farmapos-app .fp-detail-grid-extended{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-top:20px}
.farmapos-app .fp-detail-grid-extended>div{background:#f7f9fc;border:1px solid #e2e8ef;border-radius:7px;padding:13px 14px;min-width:0}
.farmapos-app .fp-detail-grid-extended span{display:block;font-size:11px;color:#718196;margin-bottom:5px;text-transform:uppercase;letter-spacing:.3px}
.farmapos-app .fp-detail-grid-extended b{font-size:15px;color:#203047;word-break:break-word}
.farmapos-app .fp-stock-ok{color:#0b9b57 !important}.farmapos-app .fp-stock-out{color:#d72828 !important}
.farmapos-app .fp-add-row{margin-top:auto;padding-top:24px;position:static}
.farmapos-app .fp-qty-label{font-size:12px;color:#718196;font-weight:700;margin-right:4px;align-self:center}
.farmapos-app .fp-search-results{padding:20px 24px;min-height:100%;box-sizing:border-box}
.farmapos-app .fp-results-title{display:flex;justify-content:space-between;align-items:center;padding-bottom:12px;border-bottom:1px solid #e5ebf2;color:#26384f}
.farmapos-app .fp-results-title span{font-size:12px;color:#7a8999}
.farmapos-app .fp-results-list{display:flex;flex-direction:column;gap:8px;margin-top:12px}
.farmapos-app .fp-result-item{display:grid;grid-template-columns:42px minmax(0,1fr) 80px 80px 20px;gap:10px;align-items:center;text-align:left;border:1px solid #e1e8f0;background:#fff;border-radius:8px;padding:12px;cursor:pointer}
.farmapos-app .fp-result-item:hover{border-color:#1688ed;background:#f8fbff}
.farmapos-app .fp-result-icon{font-size:24px;text-align:center}.farmapos-app .fp-result-main{min-width:0}.farmapos-app .fp-result-main b{display:block;color:#203047;font-size:15px}.farmapos-app .fp-result-main small{display:block;color:#718196;margin-top:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.farmapos-app .fp-result-stock{font-size:12px;color:#64758a}.farmapos-app .fp-result-item>strong{color:#0b9b57;text-align:right}.farmapos-app .fp-result-arrow{font-size:25px;color:#1688ed;text-align:right}
@media(max-width:900px){
 .farmapos-app .fp-product-card-large{padding:18px}.farmapos-app .fp-product-card-large h2{font-size:24px}.farmapos-app .fp-detail-grid-extended{grid-template-columns:repeat(2,minmax(0,1fr))}.farmapos-app .fp-result-item{grid-template-columns:34px minmax(0,1fr) 65px 65px 15px;padding:9px;gap:7px}
}

/* FarmaPOS 1.1.0 - compact bottom search */
@media (min-width:701px) and (max-width:1100px){
  .farmapos-app .fp-bottom{
    grid-template-columns:minmax(0,720px) 92px 118px !important;
    gap:7px !important;
    padding:6px 8px !important;
  }
  .farmapos-app .fp-search{
    max-width:720px !important;
    justify-self:start !important;
  }
}

/* FarmaPOS 1.1.1 - search width matches the main medication panel */
@media (min-width:701px) and (max-width:1100px){
  .farmapos-app .fp-bottom{
    grid-template-columns:minmax(0,1fr) 92px 118px !important;
    gap:8px !important;
    padding:6px 8px !important;
  }

  .farmapos-app .fp-search{
    width:100% !important;
    max-width:none !important;
    justify-self:stretch !important;
  }
}

/* FarmaPOS 1.1.2 - search matches the main product panel width */
@media (min-width:701px) and (max-width:1100px){
  .farmapos-app .fp-bottom{
    grid-template-columns: minmax(0, 650px) 92px 118px !important;
    justify-content: start !important;
    gap: 8px !important;
  }

  .farmapos-app .fp-search{
    width: 100% !important;
    max-width: 650px !important;
    justify-self: start !important;
  }
}

/* FarmaPOS 1.1.3 - exact compact search width */
@media (min-width:701px) and (max-width:1100px){
  .farmapos-app > .fp-bottom{
    left:180px !important;
    right:0 !important;
    height:68px !important;
    display:grid !important;
    grid-template-columns:630px 92px 118px !important;
    grid-template-rows:68px !important;
    gap:8px !important;
    padding:0 8px !important;
    align-items:center !important;
    justify-content:start !important;
  }

  .farmapos-app > .fp-bottom > .fp-search{
    width:630px !important;
    min-width:630px !important;
    max-width:630px !important;
    height:48px !important;
    margin:0 !important;
    justify-self:start !important;
  }

  .farmapos-app > .fp-bottom > .danger,
  .farmapos-app > .fp-bottom > .pay{
    width:auto !important;
    min-width:0 !important;
    max-width:none !important;
    height:48px !important;
    margin:0 !important;
  }
}

/* FarmaPOS 1.1.4 - tablet width range correction */
@media (min-width:701px) and (max-width:1400px){
  .farmapos-app .fp-bottom{
    left:180px !important;
    right:auto !important;
    width:calc(100% - 180px) !important;
    box-sizing:border-box !important;
    display:grid !important;
    grid-template-columns:640px 92px 118px !important;
    gap:8px !important;
    padding:0 8px !important;
    align-items:center !important;
    overflow:hidden !important;
  }

  .farmapos-app .fp-bottom .fp-search{
    width:640px !important;
    min-width:640px !important;
    max-width:640px !important;
    flex:0 0 640px !important;
    box-sizing:border-box !important;
    justify-self:start !important;
  }

  .farmapos-app .fp-bottom > button.danger{
    width:92px !important;
    min-width:92px !important;
    max-width:92px !important;
  }

  .farmapos-app .fp-bottom > button.pay{
    width:118px !important;
    min-width:118px !important;
    max-width:118px !important;
  }
}

/* FarmaPOS 1.1.5 - guaranteed visible action buttons */
@media (min-width:701px) and (max-width:1400px){
  .farmapos-app .fp-bottom{
    position:fixed !important;
    left:180px !important;
    right:0 !important;
    bottom:0 !important;
    width:auto !important;
    height:68px !important;
    box-sizing:border-box !important;
    display:grid !important;
    grid-template-columns:minmax(0,1fr) 96px 120px !important;
    gap:8px !important;
    padding:6px 8px !important;
    align-items:center !important;
    overflow:visible !important;
  }

  .farmapos-app .fp-bottom .fp-search{
    grid-column:1 !important;
    width:100% !important;
    min-width:0 !important;
    max-width:none !important;
    flex:none !important;
    height:48px !important;
    box-sizing:border-box !important;
    justify-self:stretch !important;
  }

  .farmapos-app .fp-bottom > button.danger{
    grid-column:2 !important;
    width:96px !important;
    min-width:96px !important;
    max-width:96px !important;
    height:48px !important;
    display:flex !important;
    visibility:visible !important;
    opacity:1 !important;
    position:static !important;
  }

  .farmapos-app .fp-bottom > button.pay{
    grid-column:3 !important;
    width:120px !important;
    min-width:120px !important;
    max-width:120px !important;
    height:48px !important;
    display:flex !important;
    visibility:visible !important;
    opacity:1 !important;
    position:static !important;
  }
}

/* FarmaPOS 1.1.6 - slightly smaller search field */
@media (min-width:701px) and (max-width:1400px){
  .farmapos-app .fp-bottom{
    grid-template-columns:minmax(0,1fr) 96px 120px !important;
    gap:8px !important;
  }

  .farmapos-app .fp-bottom .fp-search{
    width:calc(100% - 35px) !important;
    max-width:none !important;
    justify-self:start !important;
  }
}

/* FarmaPOS 1.1.7 - search field slightly smaller */
@media (min-width:701px) and (max-width:1400px){
  .farmapos-app .fp-bottom .fp-search{
    width:calc(100% - 65px) !important;
    justify-self:start !important;
  }
}
