/* ==========================================================================
   TBNWL Frontend (Native Wishlist) –  CSS
   ========================================================================== */

   :root{
    /* Brand / UI */
    --tbnwl-green: #66ad44;
    --tbnwl-green-strong: #18b04a;
    --tbnwl-danger: #ef4444;
    --tbnwl-warn: #f59e0b;
  
    /* Neutral */
    --tbnwl-text: #1f2937;
    --tbnwl-muted: #6b7280;
    --tbnwl-border: rgba(0,0,0,.08);
    --tbnwl-border-strong: #d1d5db;
    --tbnwl-bg: #fff;
    --tbnwl-bg-soft: rgba(0,0,0,.02);
  
    /* Effects */
    --tbnwl-radius: 14px;
    --tbnwl-radius-pill: 999px;
    --tbnwl-shadow: 0 10px 24px rgba(0,0,0,.06);
    --tbnwl-shadow-strong: 0 20px 60px rgba(0,0,0,.22);
  }
  
  /* ==========================================================================
     Base helpers
     ========================================================================== */
  
  .tbnwl-muted{ color: var(--tbnwl-muted); }
  
  /* Wrapper */
  .tbnwl-wrap{
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    background: var(--tbnwl-bg);
  }
  
  .tbnwl-title{ margin: 0 0 12px; }
  .tbnwl-empty{ color: var(--tbnwl-muted); margin: 0; }
  
  /* ==========================================================================
     Header icon + badge (menu)
     ========================================================================== */
  
  .tbnwl-header{
    display:inline-flex;
    align-items:center;
    gap:8px;
    position:relative;
    text-decoration:none;
  }
  
  .tbnwl-header-icon{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    font-size:18px;
    line-height:1;
  }
  
  .tbnwl-header-title{
    line-height:1;
  }
  
  .tbnwl-header-badge{
    position:absolute;
    top:-6px;
    right:-8px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-width:18px;
    height:18px;
    padding:0 6px;
    border-radius: var(--tbnwl-radius-pill);
    font-size:12px;
    font-weight:800;
    line-height:1;
    background: var(--tbnwl-green);
    color:#fff;
  }
  
  .tbnwl-menu-item{
    display:flex;
    align-items:center;
  }
  
  /* ==========================================================================
     Buttons / inputs (unifikace)
     ========================================================================== */
  
  .tbnwl-btn,
  .tbnwl-remove,
  .tbnwl-add-one,
  .tbnwl-add-all,
  .tbnwl-modal__toggle,
  .tbnwl-modal__create{
    padding:10px 12px;
    border-radius: 10px;
    border:1px solid var(--tbnwl-border-strong);
    background:#fff;
    cursor:pointer;
  }
  
  .tbnwl-btn[disabled],
  .tbnwl-add-one[disabled],
  .tbnwl-add-all[disabled],
  .tbnwl-modal__toggle[disabled],
  .tbnwl-modal__create[disabled]{
    opacity:.6;
    cursor:not-allowed;
  }
  
  .tbnwl-cart{
    display:inline-block;
    padding:10px 12px;
    border-radius:10px;
    border:1px solid var(--tbnwl-border-strong);
    text-decoration:none;
    background:#fff;
  }
  
  /* Qty + note inputs */
  .tbnwl-qty{
    width:72px;
    padding:8px 10px;
    border-radius:10px;
    border:1px solid var(--tbnwl-border-strong);
  }
  
  .tbnwl-note{
    width:100%;
    min-width:160px;
    padding:8px 10px;
    border-radius:10px;
    border:1px solid var(--tbnwl-border-strong);
  }
  
  /* ==========================================================================
     Filter bar
     ========================================================================== */
  
  .tbnwl-filterbar{
    display:flex;
    gap:12px;
    align-items:center;
    justify-content:flex-start;
    flex-wrap:wrap;
    margin: 10px 0 12px;
  }
  
  .tbnwl-filterbar label{
    display:flex;
    gap:8px;
    align-items:center;
    font-size:14px;
  }
  
  .tbnwl-filterbar select{
    padding:8px 10px;
    border-radius:10px;
    border:1px solid var(--tbnwl-border-strong);
    background:#fff;
  }
  
  /* ==========================================================================
     Wishlist table
     ========================================================================== */
  
  .tbnwl-table{
    width:100%;
    border-collapse:collapse;
    margin-top:10px;
  }
  
  .tbnwl-table th,
  .tbnwl-table td{
    padding:10px;
    border-bottom:1px solid #f1f5f9;
  }
  
  .tbnwl-table th{
    text-align:left;
    color:#111827;
  }
  
  /* první sloupec: drag + img */
  .tbnwl-first{
    display:flex;
    align-items:center;
    gap:10px;
  }
  
  /* drag handle */
  .tbnwl-drag{
    cursor:grab;
    user-select:none;
    font-weight:700;
    opacity:.55;
  }
  .tbnwl-drag:active{
    cursor:grabbing;
    opacity:.9;
  }
  
  /* Badge (stav/sklad) */
  .tbnwl-badge{
    display:inline-block;
    padding:6px 10px;
    border-radius: var(--tbnwl-radius-pill);
    font-size:12px;
    border:1px solid var(--tbnwl-border-strong);
  }
  .tbnwl-badge.ok{ border-color: var(--tbnwl-green); color:#2f6b18; }
  .tbnwl-badge.warn{ border-color: var(--tbnwl-warn); color:#92400e; }
  
  /* ==========================================================================
     Tabs toolbar (scrollable)
     ========================================================================== */
  
  .tbnwl-toolbar{
    display:flex;
    align-items:center;
    gap:12px;
    flex-wrap:wrap;
    margin:12px 0 16px;
  }
  
  .tbnwl-tabsbar{
    display:flex;
    align-items:center;
    gap:10px;
    width:100%;
    padding:10px 12px;
    background:#fff;
    border:1px solid var(--tbnwl-border);
    border-radius: var(--tbnwl-radius);
    box-shadow: var(--tbnwl-shadow);
  
    /* důležité: NECH overflow visible tady */
    overflow: visible;
  }
  
  /* !!! FIX: em wrapper z tématu – přestane měnit layout/taby */
  .tbnwl-tabsbar em{ font-style: normal; }
  
  .tbnwl-tabswrap{
    flex:1;
    min-width:0;
  
    /* scroll jen v X; Y ořežeme a uděláme prostor nahoře */
    overflow-x:auto;
    overflow-y:hidden;
  
    padding-top:7px; /* prostor pro hover ikonky */
    -webkit-overflow-scrolling:touch;
    scroll-behavior:smooth;
    scrollbar-width: thin;
  }
  
  .tbnwl-tabs{
    display:flex;
    align-items:center;
    gap:8px;
    padding:2px;
    min-width:max-content;
  }
  
  /* Tab wrapper: kvůli hover akcím */
  .tbnwl-tabwrap{
    position:relative;
    display:inline-flex;
    align-items:center;
    z-index:1;
  }
  
  .tbnwl-tabwrap:hover{ z-index:20; }
  
  /* Samotný tab */
  .tbnwl-tab{
    display:inline-flex;
    align-items:center;
    gap:10px;
  
    padding:9px 12px;
    border-radius: var(--tbnwl-radius-pill);
    border:1px solid var(--tbnwl-border);
    background: var(--tbnwl-bg-soft);
    color: var(--tbnwl-text);
  
    font-weight:600;
    line-height:1;
    cursor:pointer;
    white-space:nowrap;
    user-select:none;
  
    /* tab posuneme dolů pod prostor pro ikonky */
    margin-top:10px;
  
    transition: transform .12s ease, background .12s ease, border-color .12s ease, box-shadow .12s ease;
  
    /* přebití theme/button stylů */
    box-shadow:none;
    outline:none;
  }
  
  .tbnwl-tab:hover{
    background: rgba(0,0,0,.04);
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(0,0,0,.08);
  }
  
  .tbnwl-tab.is-active{
    background: var(--tbnwl-green-strong);
    border-color: var(--tbnwl-green-strong);
    color:#fff;
    box-shadow: 0 10px 22px rgba(0,0,0,.12);
  }

  /* aktivní tab – is-active je na .tbnwl-tabwrap, ne na buttonu */
  .tbnwl-tabwrap.is-active > em > .tbnwl-tab,
  .tbnwl-tabwrap.is-active .tbnwl-tab{
    background: rgba(102, 173, 68, 0.14);   /* jemná zelená */
    border-color: rgba(102, 173, 68, 0.35);
    color: #1f2937;
    box-shadow: 0 8px 18px rgba(102,173,68,.18);
  }

  .tbnwl-tabwrap.is-active .tbnwl-tab__cnt{
    background: rgba(102,173,68,.22);
    color:#1f2937;
  }
  
  .tbnwl-tab__name{
    max-width:240px;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  
  .tbnwl-tab__cnt{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-width:22px;
    height:22px;
    padding:0 8px;
    border-radius: var(--tbnwl-radius-pill);
    font-size:12px;
    font-weight:800;
    background: rgba(0,0,0,.08);
    color: rgba(0,0,0,.70);
  }
  
  .tbnwl-tab.is-active .tbnwl-tab__cnt{
    background: rgba(255,255,255,.22);
    color:#fff;
  }
  
  /* Pravý blok ikon v toolbaru */
  .tbnwl-actionsbar{
    display:flex;
    align-items:center;
    gap:8px;
    flex:0 0 auto;
  }
  
  .tbnwl-iconbtn{
    width:38px;
    height:38px;
    border-radius:12px;
    border:1px solid var(--tbnwl-border);
    background:#fff;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
    transition: transform .12s ease, background .12s ease, box-shadow .12s ease, border-color .12s ease;
  }
  
  .tbnwl-iconbtn:hover{
    background: rgba(0,0,0,.03);
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(0,0,0,.08);
  }
  .tbnwl-iconbtn:active{
    transform: translateY(0);
    box-shadow:none;
  }
  
  .tbnwl-iconbtn .dashicons{
    font-size:18px;
    width:18px;
    height:18px;
  }
  
  /* Mobile */
  @media (max-width: 640px){
    .tbnwl-tabsbar{ flex-wrap:wrap; }
    .tbnwl-actionsbar{ width:100%; justify-content:flex-end; }
    .tbnwl-tab__name{ max-width:160px; }
  }
  
  /* ==========================================================================
     Tab hover actions (rename/share/delete) – zobrazit jen na hover
     ========================================================================== */
  
  .tbnwl-tab-actions{
    position: absolute;
    top:-10px;
    right: 0px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-2px);
    transition: opacity .15s ease, transform .15s ease;
  }
  
  .tbnwl-tabwrap:hover .tbnwl-tab-actions{
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }
  
  /* malé kulaté action ikonky */
  .tbnwl-tab-action{
    width:22px;
    height:22px;
    border-radius: var(--tbnwl-radius-pill);
    border:1px solid #e6e8eb;
    background:#fff;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
    box-shadow: 0 8px 18px rgba(0,0,0,.10);
    padding:0;
  }
  
  .tbnwl-tab-action:hover{
    filter: brightness(.98);
    box-shadow: 0 10px 22px rgba(0,0,0,.14);
  }
  
  .tbnwl-tab-action .dashicons{
    font-size:14px;
    width:14px;
    height:14px;
    line-height:14px;
    opacity:.9;
  }
  
  /* jemné barevné odlišení akcí */
  .tbnwl-tab-rename{ border-color:#dbeafe; background:#eff6ff; }
  .tbnwl-tab-share{  border-color:#e9d5ff; background:#f5f3ff; }
  .tbnwl-tab-del{    border-color:#fecaca; background:#fff1f2; }
  
  /* ==========================================================================
     Toasts – top stacked (100px from top, stacking down)
     ========================================================================== */
  
  .tbnwl-toast-wrap{
    position:fixed;
    top:100px;
    right:24px;
    z-index:99999;
    display:flex;
    flex-direction:column;
    gap:10px;
    pointer-events:none;
  }
  
  .tbnwl-toast{
    min-width:260px;
    max-width:420px;
    padding:12px 16px;
    border-radius: 14px;
    color:#fff;
    font-weight:600;
    font-size:14px;
    box-shadow: 0 14px 30px rgba(0,0,0,.25);
    opacity:0;
    transform: translateY(-10px);
    transition: all .25s ease;
  }
  
  .tbnwl-toast.is-in{
    opacity:1;
    transform: translateY(0);
  }
  
  .tbnwl-toast--ok{
    background: linear-gradient(135deg, #16a34a, #22c55e);
  }
  
  .tbnwl-toast--err{
    background: linear-gradient(135deg, #dc2626, #ef4444);
  }
  
  /* ==========================================================================
     Modal: product -> lists
     ========================================================================== */
  
  .tbnwl-modal{ position:fixed; inset:0; z-index:99999; }
  .tbnwl-modal__backdrop{ position:absolute; inset:0; background:rgba(0,0,0,.35); }
  
  .tbnwl-modal__card{
    position:relative;
    width:min(520px, calc(100% - 28px));
    margin:8vh auto 0;
    background:#fff;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    overflow:hidden;
  }
  
  .tbnwl-modal__head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:14px 14px;
    border-bottom:1px solid #eef2f7;
  }
  
  .tbnwl-modal__title{ font-weight:700; }
  
  .tbnwl-modal__close{
    border:0;
    background:transparent;
    cursor:pointer;
    font-size:16px;
  }
  
  .tbnwl-modal__body{ padding:14px; }
  
  .tbnwl-modal__row{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    padding:10px 0;
    border-bottom:1px solid #f1f5f9;
  }
  
  .tbnwl-modal__name{ font-weight:600; }
  
  .tbnwl-modal__toggle.is-in{ border-color: var(--tbnwl-danger); color:#b91c1c; }
  .tbnwl-modal__toggle.is-out{ border-color: var(--tbnwl-green); color:#2f6b18; }
  
  .tbnwl-modal__new{
    display:flex;
    gap:8px;
    margin-top:12px;
  }
  
  .tbnwl-modal__input{
    flex:1;
    padding:10px 12px;
    border-radius:10px;
    border:1px solid var(--tbnwl-border-strong);
  }
  
  .tbnwl-modal__msg{
    margin-top:12px;
    padding:10px 12px;
    border-radius:10px;
    background:#f0f9ff;
    border:1px solid #cfe8ff;
    color:#0b4a6f;
  }
  
  /* ==========================================================================
     UI modal (alert/confirm/prompt) – hezká náhrada za native dialogs
     ========================================================================== */
  
  .tbnwl-uimodal{
    position:fixed;
    inset:0;
    z-index:999999;
  }
  
  .tbnwl-uimodal__backdrop{
    position:absolute;
    inset:0;
    background: rgba(10, 15, 20, .45);
    backdrop-filter: blur(3px);
  }
  
  .tbnwl-uimodal__card{
    position:absolute;
    left:50%;
    top:14%;
    transform: translateX(-50%);
    width: min(520px, calc(100% - 28px));
    background:#fff;
    border-radius:16px;
    box-shadow: var(--tbnwl-shadow-strong);
    overflow:hidden;
  }
  
  .tbnwl-uimodal__head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:14px 16px;
    border-bottom:1px solid #eef0f2;
  }
  
  .tbnwl-uimodal__title{
    font-weight:700;
    font-size:16px;
  }
  
  .tbnwl-uimodal__x{
    border:0;
    background:transparent;
    cursor:pointer;
    width:36px;
    height:36px;
    border-radius:10px;
  }
  
  .tbnwl-uimodal__x:hover{ background:#f4f6f8; }
  
  .tbnwl-uimodal__body{ padding:14px 16px 8px; }
  
  .tbnwl-uimodal__msg{
    color:#222;
    line-height:1.45;
    font-size:14px;
  }
  
  .tbnwl-uimodal__inputwrap{ margin-top:12px; }
  
  .tbnwl-uimodal__input{
    width:100%;
    border:1px solid #d0d7de;
    border-radius:12px;
    padding:10px 12px;
    outline:none;
  }
  
  .tbnwl-uimodal__input:focus{
    border-color: var(--tbnwl-green);
    box-shadow: 0 0 0 3px rgba(102,173,68,.18);
  }
  
  .tbnwl-uimodal__foot{
    display:flex;
    justify-content:flex-end;
    gap:10px;
    padding:12px 16px 16px;
  }
  
  .tbnwl-uimodal__btn{
    border:1px solid #d0d7de;
    background:#fff;
    border-radius:12px;
    padding:10px 12px;
    cursor:pointer;
    font-weight:600;
  }
  
  .tbnwl-uimodal__btn:hover{ background:#f7f9fb; }
  
  .tbnwl-uimodal__ok{
    background: var(--tbnwl-green);
    border-color: var(--tbnwl-green);
    color:#fff;
  }
  
  .tbnwl-uimodal__ok:hover{ filter: brightness(.98); }
  
  .tbnwl-uimodal__ok.is-destructive{
    background:#e24b4b;
    border-color:#e24b4b;
  }
  
  /* ==========================================================================
     Link varianta (archive + detail) – “odkaz s ikonou”
     ========================================================================== */
  
  a.tbnwl-link{
    display:inline-flex;
    align-items:center;
    gap:6px;
    text-decoration:none;
    font-weight:600;
    border:0;
    background:transparent;
    padding:0;
    box-shadow:none;
  }
  
  a.tbnwl-link:hover{ text-decoration:underline; }
  
  a.tbnwl-link .tbnwl-link__icon{
    font-size:18px;
    width:18px;
    height:18px;
    line-height:18px;
    color:#1aa34a;
  }
  
  a.tbnwl-link[data-state="in"] .tbnwl-link__icon{
    color:#0f7f35;
  }
  
  /* ==========================================================================
     Sortable (jQuery UI) – aby se při drag nerozpadal řádek
     ========================================================================== */
  
  .tbnwl-sortable .ui-sortable-helper{
    display: table;
    width: 100%;
    box-shadow: 0 12px 30px rgba(0,0,0,.12);
    border-radius: 12px;
    background: #fff;
  }
  
  .tbnwl-sortable .ui-sortable-helper td{
    display: table-cell;
    vertical-align: middle;
  }
  
  .tbnwl-sort-placeholder,
  .tbnwl-sortable .ui-sortable-placeholder{
    background: rgba(102,173,68,.10);
    border: 2px dashed rgba(102,173,68,.35);
    visibility: visible !important;
  }
  
  .tbnwl-sort-placeholder td,
  .tbnwl-sortable .ui-sortable-placeholder td{
    padding: 12px !important;
  }
  
  /* ==========================================================================
     Progress overlay – bez blur, vystředěný
     ========================================================================== */
  
  #tbnwl-progress.tbnwl-progress{
    position: fixed;
    inset: 0;
    z-index: 999999;         /* nad vším */
    display: none;           /* JS přepíná show/hide */
  }
  
  #tbnwl-progress.tbnwl-progress.is-on{
    display: block;
  }
  
  #tbnwl-progress .tbnwl-progress__backdrop{
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.22); /* jemné ztmavení, žádný blur */
  }
  
  #tbnwl-progress .tbnwl-progress__card{
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
  
    display: inline-flex;
    align-items: center;
    gap: 12px;
  
    padding: 14px 16px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid rgba(0,0,0,.08);
    box-shadow: 0 18px 50px rgba(0,0,0,.22);
  
    min-width: 240px;
    justify-content: center;
  }
  
  #tbnwl-progress .tbnwl-progress__text{
    font-weight: 700;
    font-size: 14px;
    color: #111827;
    white-space: nowrap;
  }
  
  #tbnwl-progress .tbnwl-progress__spinner{
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,.18);
    border-top-color: rgba(0,0,0,.60);
    animation: tbnwlSpin .75s linear infinite;
  }
  
  @keyframes tbnwlSpin{
    to { transform: rotate(360deg); }
  }
  
  @media (max-width: 640px){
    #tbnwl-progress .tbnwl-progress__card{
      width: min(320px, calc(100% - 28px));
      min-width: 0;
    }
  }