/* Kingpark v2 — style.css */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:    #1a237e;
  --blue-lt: #e8eaf6;
  --green:   #2e7d32;
  --green-lt:#e8f5e9;
  --red:     #c62828;
  --red-lt:  #ffebee;
  --orange:  #e65100;
  --muted:   #757575;
  --bg:      #f5f5f5;
  --card:    #ffffff;
  --border:  #e0e0e0;
  --radius:  8px;
}

html { font-size: 16px; }
body { font-family: system-ui, -apple-system, sans-serif; background: var(--bg); color: #212121; line-height: 1.5; }

/* ── TIPOGRAFIE ─────────────────────────────────────────────────────────── */
h2 { font-size: 1.25rem; font-weight: 700; }
small { font-size: .8rem; }

/* ── BUTOANE ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border: none; border-radius: var(--radius);
  font-size: 1rem; font-weight: 600; cursor: pointer;
  min-height: 44px; transition: opacity .15s, box-shadow .15s;
  text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:hover:not(:disabled) { opacity: .88; }
.btn-primary  { background: var(--blue);  color: #fff; }
.btn-success  { background: var(--green); color: #fff; }
.btn-danger   { background: var(--red);   color: #fff; }
.btn-outline  { background: transparent; border: 2px solid var(--blue); color: var(--blue); }
.btn-sm       { padding: 6px 12px; font-size: .875rem; min-height: 36px; }
.btn-icon     { padding: 6px; min-height: 36px; min-width: 36px; border-radius: 50%; }

/* ── FORMS ──────────────────────────────────────────────────────────────── */
label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; font-weight: 600; color: #424242; }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=email],
select, textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius); font-size: 1rem; background: #fff;
  transition: border-color .2s;
  min-height: 44px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); }
textarea { resize: vertical; min-height: 80px; }
.field-hint { font-size: .78rem; color: var(--muted); font-weight: 400; margin-top: 2px; }

/* ── MESSAGES ───────────────────────────────────────────────────────────── */
.msg-error   { background: var(--red-lt);   color: var(--red);   border: 1px solid #ef9a9a; border-radius: var(--radius); padding: 10px 14px; font-size: .9rem; }
.msg-success { background: var(--green-lt); color: var(--green); border: 1px solid #a5d6a7; border-radius: var(--radius); padding: 10px 14px; font-size: .9rem; }
.hidden { display: none !important; }

/* ── SPINNER ────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block; width: 32px; height: 32px;
  border: 3px solid var(--border); border-top-color: var(--blue);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════════════════════
   LOGIN
═══════════════════════════════════════════════════════════════════════════ */
.login-page  { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box   { background: var(--card); border-radius: 12px; padding: 40px 36px; width: 100%; max-width: 400px; box-shadow: 0 4px 20px rgba(0,0,0,.12); }
.login-logo  { font-size: 2rem; font-weight: 800; color: var(--blue); text-align: center; margin-bottom: 8px; letter-spacing: -1px; }
.login-sub   { text-align: center; color: var(--muted); font-size: .9rem; margin-bottom: 28px; }
.login-form  { display: flex; flex-direction: column; gap: 16px; }
.show-pw-btn { background: none; border: none; cursor: pointer; padding: 4px; color: var(--muted); font-size: .85rem; align-self: flex-end; }

/* ═══════════════════════════════════════════════════════════════════════════
   APP LAYOUT
═══════════════════════════════════════════════════════════════════════════ */
.app-layout { display: flex; flex-direction: column; min-height: 100vh; }

.app-header {
  background: var(--blue); color: #fff;
  padding: 0 16px;
  display: flex; align-items: center; gap: 8px;
  position: sticky; top: 0; z-index: 100;
  min-height: 56px; flex-wrap: wrap;
}
.brand { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.5px; margin-right: 8px; flex-shrink: 0; }

.app-header nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; flex: 1; }

.nav-btn {
  background: transparent; border: none; color: rgba(255,255,255,.8);
  padding: 8px 14px; border-radius: 6px; cursor: pointer;
  font-size: .9rem; font-weight: 600; min-height: 40px;
  transition: background .15s, color .15s; white-space: nowrap;
}
.nav-btn:hover  { background: rgba(255,255,255,.15); color: #fff; }
.nav-btn.active { background: rgba(255,255,255,.2); color: #fff; }
.nav-btn.logout { color: rgba(255,255,255,.7); margin-left: auto; }
.nav-btn.categories-btn { background: rgba(255,255,255,.1); font-size: .82rem; padding: 6px 10px; }

.app-main { flex: 1; padding: 20px 16px; max-width: 1200px; width: 100%; margin: 0 auto; }

/* ── TABS ───────────────────────────────────────────────────────────────── */
.tab-section       { display: none; }
.tab-section.active { display: block; }

/* ── TOOLBAR ────────────────────────────────────────────────────────────── */
.toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.toolbar h2 { flex: 1; }

/* ── SELECTION TOOLBAR ───────────────────────────────────────────────────── */
.selection-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--blue-lt); border: 1.5px solid var(--blue);
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px;
}
.selection-toolbar span { font-size: .9rem; font-weight: 600; color: var(--blue); flex: 1; }

/* ── FILTRE CATEGORIE ───────────────────────────────────────────────────── */
/* ── BARA FILTRE PRODUSE ─────────────────────────────────────────────────── */
.filters-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px;
}
.filter-search-wrap { flex: 1; min-width: 180px; }
.filter-search-wrap input {
  width: 100%; padding: 7px 12px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: .9rem; background: var(--bg);
  transition: border-color .15s;
}
.filter-search-wrap input:focus { outline: none; border-color: var(--blue); }
.filter-price-wrap {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.filter-price-wrap input {
  width: 90px; padding: 7px 10px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: .875rem; background: var(--bg);
  transition: border-color .15s;
}
.filter-price-wrap input:focus { outline: none; border-color: var(--blue); }
.filter-label { font-size: .82rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.filter-sep   { color: var(--muted); font-size: .9rem; }
.filter-sort-wrap select {
  padding: 7px 10px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: .875rem; background: var(--bg); cursor: pointer;
  transition: border-color .15s;
}
.filter-sort-wrap select:focus { outline: none; border-color: var(--blue); }
.filter-reset-btn {
  background: var(--bg); color: var(--muted); border: 1.5px solid var(--border);
  border-radius: 8px; padding: 7px 12px; font-size: .82rem; cursor: pointer;
  transition: all .15s; white-space: nowrap; flex-shrink: 0;
}
.filter-reset-btn:hover { border-color: var(--red); color: var(--red); background: var(--red-lt); }
.products-count { font-size: .82rem; color: var(--muted); margin-bottom: 8px; }

/* ── PAGINARE ─────────────────────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 16px 0 4px; flex-wrap: wrap; }
.pg-btn {
  min-width: 36px; height: 36px; padding: 0 10px;
  border: 1.5px solid var(--border); background: var(--card);
  border-radius: 8px; font-size: .875rem; font-weight: 600;
  color: var(--text); cursor: pointer; transition: all .15s;
}
.pg-btn:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); background: var(--blue-lt); }
.pg-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.pg-btn:disabled { opacity: .35; cursor: default; }
.pg-btn.pg-nav { font-size: 1.2rem; font-weight: 400; }
.pg-dots { color: var(--muted); padding: 0 2px; line-height: 36px; }

.category-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.cat-btn {
  padding: 8px 16px; border: 1.5px solid var(--border); background: var(--card);
  border-radius: 20px; cursor: pointer; font-size: .875rem; font-weight: 600;
  color: var(--muted); transition: all .15s; min-height: 38px;
}
.cat-btn:hover  { border-color: var(--blue); color: var(--blue); }
.cat-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ═══════════════════════════════════════════════════════════════════════════
   TABEL PRODUSE
═══════════════════════════════════════════════════════════════════════════ */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
table { width: 100%; border-collapse: collapse; background: var(--card); min-width: 700px; }
thead { background: var(--blue); color: #fff; }
th { padding: 12px 10px; text-align: left; font-size: .85rem; font-weight: 700; white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: .9rem; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }

.td-nr     { text-align: center; color: var(--muted); font-size: .8rem; width: 40px; }
.td-chk    { width: 36px; text-align: center; }
.td-cat span { background: var(--blue-lt); color: var(--blue); padding: 2px 10px; border-radius: 12px; font-size: .78rem; font-weight: 700; }
.td-price  { font-weight: 700; color: var(--blue); white-space: nowrap; }
.td-actions { white-space: nowrap; }
.td-actions .btn { margin: 2px; }

/* Checkbox styling */
.chk-product, #chk-select-all {
  width: 18px; height: 18px; accent-color: var(--blue); cursor: pointer;
}

.loading-row td, .empty-row td { text-align: center; padding: 40px; color: var(--muted); }

/* ── IMAGINI IN TABEL (scroll orizontal) ────────────────────────────────── */
.img-row { display: flex; gap: 6px; overflow-x: auto; max-width: 180px; padding-bottom: 2px; }
.img-row img {
  width: 48px; height: 48px; object-fit: cover; border-radius: 4px;
  cursor: pointer; flex-shrink: 0; border: 1px solid var(--border);
  transition: opacity .15s;
}
.img-row img:hover { opacity: .8; }
.img-placeholder { width: 48px; height: 48px; background: var(--bg); border: 1px dashed var(--border); border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }

/* ── PROGRESS BAR UPLOAD ─────────────────────────────────────────────────── */
.upload-progress-wrap { margin-top: 10px; }
.upload-progress-track { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.upload-progress-bar   { height: 100%; background: var(--blue); width: 0; transition: width .2s; border-radius: 4px; }
.upload-progress-label { font-size: .8rem; color: var(--muted); margin-top: 4px; text-align: right; }

/* ═══════════════════════════════════════════════════════════════════════════
   SHARE LINKS GRID
═══════════════════════════════════════════════════════════════════════════ */
.shares-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.share-card  {
  background: var(--card); border-radius: var(--radius); padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08); border: 1px solid var(--border);
}
.share-name  { font-weight: 700; font-size: 1rem; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.share-meta  { display: flex; flex-direction: column; gap: 3px; font-size: .82rem; color: var(--muted); margin-bottom: 10px; }
.share-url   { font-size: .78rem; color: var(--muted); word-break: break-all; margin-bottom: 10px; background: var(--bg); padding: 6px 8px; border-radius: 4px; }
.share-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.share-actions .btn { flex: 1 1 auto; text-align: center; justify-content: center; white-space: nowrap; }
.share-views   { font-size: .78rem; font-weight: 600; color: var(--muted); }

.badge-active  { background: var(--green-lt); color: var(--green); padding: 2px 8px; border-radius: 10px; font-size: .75rem; font-weight: 700; }
.badge-expired { background: var(--red-lt);   color: var(--red);   padding: 2px 8px; border-radius: 10px; font-size: .75rem; font-weight: 700; }
.badge-perm    { background: var(--blue-lt);  color: var(--blue);  padding: 2px 8px; border-radius: 10px; font-size: .75rem; font-weight: 700; }
.badge-nou     { position: absolute; top: 4px; right: 4px; background: #e53935; color: #fff; padding: 1px 6px; border-radius: 8px; font-size: .65rem; font-weight: 800; letter-spacing: .3px; z-index: 1; }

/* ── PICKER PRODUSE (in modal share) ────────────────────────────────────── */
.product-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; max-height: 300px; overflow-y: auto; padding: 4px; }
.picker-card {
  border: 2px solid var(--border); border-radius: var(--radius); padding: 8px;
  cursor: pointer; text-align: center; transition: all .15s; background: var(--card);
  position: relative;
}
.picker-card:hover    { border-color: var(--blue); }
.picker-card.selected { border-color: var(--green); background: var(--green-lt); }
.picker-card img, .picker-card .no-img {
  width: 80px; height: 80px; object-fit: cover; border-radius: 4px;
  margin: 0 auto 6px; display: block;
}
.picker-card .no-img  { background: var(--bg); font-size: 2rem; line-height: 80px; }
.picker-card .p-name  { font-size: .78rem; font-weight: 600; line-height: 1.2; word-break: break-word; }
.picker-card .p-price { font-size: .75rem; color: var(--blue); font-weight: 700; margin-top: 2px; }
.picker-card .p-cat   { font-size: .7rem; color: var(--muted); }
.picker-selected-count { font-size: .85rem; color: var(--muted); font-weight: normal; }

/* ═══════════════════════════════════════════════════════════════════════════
   ADMINI TAB
═══════════════════════════════════════════════════════════════════════════ */
.role-badge-admin   { background: #fce4ec; color: #880e4f; padding: 2px 8px; border-radius: 10px; font-size: .75rem; font-weight: 700; }
.role-badge-manager { background: var(--blue-lt); color: var(--blue); padding: 2px 8px; border-radius: 10px; font-size: .75rem; font-weight: 700; }

/* ── CATEGORII LIST (in modal) ───────────────────────────────────────────── */
.cat-list-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card); margin-bottom: 8px;
}
.cat-list-item span { font-weight: 600; }
.cat-add-row { display: flex; gap: 8px; margin-top: 12px; }
.cat-add-row input { flex: 1; }

/* ═══════════════════════════════════════════════════════════════════════════
   MODALE
═══════════════════════════════════════════════════════════════════════════ */
dialog {
  border: none; border-radius: 12px; padding: 0;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  width: 90vw; max-width: 560px;
  /* CENTRAT: */
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  max-height: 90vh;
  overflow-y: auto;
}
dialog::backdrop { background: rgba(0,0,0,.45); }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--card); z-index: 1;
  border-radius: 12px 12px 0 0;
}
.modal-header h2 { font-size: 1.1rem; }
.modal-close {
  background: none; border: none; font-size: 1.5rem; cursor: pointer;
  color: var(--muted); line-height: 1; padding: 4px; border-radius: 4px;
}
.modal-close:hover { background: var(--bg); }
.modal-body   { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--border);
  position: sticky; bottom: 0; background: var(--card);
  border-radius: 0 0 12px 12px;
}

.pdf-modal-body .category-filters { margin-bottom: 0; }

/* ── IMAGINI EXISTENTE (in modal produs) ────────────────────────────────── */
.images-scroll { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; flex-wrap: wrap; }
.img-thumb-wrap { position: relative; flex-shrink: 0; }
.img-thumb-wrap img { width: 100px; height: 100px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); display: block; }
.del-img-btn {
  position: absolute; top: -6px; right: -6px;
  background: var(--red); color: #fff; border: none; border-radius: 50%;
  width: 22px; height: 22px; font-size: .75rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LIGHTBOX
═══════════════════════════════════════════════════════════════════════════ */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.88);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; cursor: pointer;
}
.lightbox img { max-width: 90vw; max-height: 90vh; object-fit: contain; border-radius: 4px; }
.lightbox-close {
  position: absolute; top: 16px; right: 20px;
  background: none; border: none; color: #fff; font-size: 2rem;
  cursor: pointer; line-height: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PAGINA PUBLICA SHARE
═══════════════════════════════════════════════════════════════════════════ */
.share-page { background: var(--bg); min-height: 100vh; }

.share-header {
  background: var(--blue); color: #fff; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
}
.share-header .brand { font-size: 1.4rem; font-weight: 800; }
.share-header-meta   { font-size: .85rem; color: rgba(255,255,255,.8); text-align: right; }

.share-content-wrap { max-width: 1100px; margin: 0 auto; padding: 20px 16px; }

/* Modulul Note */
.note-module {
  background: var(--card); border-left: 4px solid var(--blue);
  border-radius: var(--radius); padding: 16px 20px;
  margin-bottom: 20px; box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.note-module h3 { font-size: .85rem; color: var(--muted); font-weight: 600; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .05em; }
.note-module p  { font-size: 1rem; color: #212121; line-height: 1.6; white-space: pre-line; }

.share-expired, .share-not-found {
  text-align: center; padding: 60px 20px;
}
.share-expired h2   { color: var(--red); margin-bottom: 8px; }
.share-not-found h2 { color: var(--muted); margin-bottom: 8px; }

.share-filters { margin-bottom: 14px; }

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  .app-header { padding: 0 10px; min-height: 52px; }
  .nav-btn    { padding: 6px 10px; font-size: .82rem; }
  .app-main   { padding: 14px 10px; }
  dialog      { width: 95vw; max-height: 95vh; }
  .modal-body { padding: 14px; }
  .shares-grid { grid-template-columns: 1fr; }
  .share-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .share-actions .btn { flex: none; width: 100%; }
  .product-picker { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  table { min-width: 580px; }
}
