:root{--md-orange:#f58220;--md-orange-dark:#d96c10;--md-dark:#1f2933;--md-light:#fff7ef}
body{background:#f6f7fb;color:#1f2933;font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif}
.auth-bg{min-height:100vh;background:linear-gradient(135deg,var(--md-orange),#ffb36b);display:flex;align-items:center;justify-content:center}
.login-card{width:100%;max-width:430px;border:0;border-radius:22px;box-shadow:0 18px 50px rgba(0,0,0,.18)}
.login-hint{background:#fff7ef;border:1px solid rgba(245,130,32,.28);border-radius:14px;padding:12px 14px;color:#7a3f0a;font-size:14px}
.login-hint code{color:#d96c10;background:rgba(245,130,32,.10);padding:2px 6px;border-radius:6px}
.sidebar{width:265px;height:100vh;background:#111827;color:#fff;position:fixed;left:0;top:0;z-index:20;overflow-y:auto;overflow-x:hidden;padding-bottom:20px}
.sidebar .brand{padding:22px 24px;font-size:20px;font-weight:800;border-bottom:1px solid rgba(255,255,255,.08)}
.sidebar a{display:block;color:#d1d5db;text-decoration:none;padding:11px 24px;border-left:4px solid transparent;font-size:15px}
.sidebar a:hover,.sidebar a.active{color:#fff;background:rgba(245,130,32,.15);border-left-color:var(--md-orange)}
.sidebar::-webkit-scrollbar{width:8px}.sidebar::-webkit-scrollbar-thumb{background:rgba(255,255,255,.22);border-radius:10px}.sidebar::-webkit-scrollbar-thumb:hover{background:rgba(255,255,255,.35)}
.main{margin-left:265px;min-height:100vh}
.topbar{height:64px;background:#fff;border-bottom:1px solid #e5e7eb;display:flex;align-items:center;justify-content:space-between;padding:0 24px;position:sticky;top:0;z-index:10}
.content{padding:24px}.card{border:0;border-radius:18px;box-shadow:0 8px 28px rgba(15,23,42,.06)}
.btn-primary{background:var(--md-orange);border-color:var(--md-orange)}.btn-primary:hover{background:var(--md-orange-dark);border-color:var(--md-orange-dark)}
.text-primary{color:var(--md-orange)!important}.badge-orange{background:var(--md-light);color:var(--md-orange-dark)}
.form-control:focus,.form-select:focus{border-color:var(--md-orange);box-shadow:0 0 0 .2rem rgba(245,130,32,.18)}
.table img.thumb{width:54px;height:54px;object-fit:contain;border-radius:10px;background:#fff;border:1px solid #eee}.page-title{font-weight:800;margin:0}
.action-btns .btn{margin-right:5px}.toast-container{z-index:3000}.required:after{content:' *';color:#dc3545}
@media(max-width:900px){.sidebar{position:relative;width:100%;height:auto;max-height:none;overflow:visible}.main{margin-left:0}.topbar{position:relative}}
.rich-editor-wrapper{border:1px solid #dee2e6;border-radius:.375rem;background:#fff;overflow:hidden}
.rich-toolbar{padding:.35rem;border-bottom:1px solid #edf0f2;background:#fafafa;display:flex;flex-wrap:wrap;gap:.25rem}
.rich-editable{min-height:110px;padding:.75rem;outline:none;background:#fff}
.rich-editable:focus{box-shadow:0 0 0 .2rem rgba(245,130,32,.12) inset}
.spec-rich + .rich-editor-wrapper .rich-editable{min-height:70px}

.ratio-4-3 { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.ratio-4-5 { aspect-ratio: 4 / 5; object-fit: contain; width: 100%; background:#fff; }
.thumb { aspect-ratio: 4 / 3; object-fit: cover; }
.product-main-preview { aspect-ratio: 4 / 5; object-fit: contain; width: 100%; max-width: 360px; border-radius: 16px; background:#fff; }
.gallery-preview { aspect-ratio: 4 / 3; object-fit: contain; width: 100%; border-radius: 12px; background:#fff; }

.ratio-1-1 { aspect-ratio: 1 / 1; object-fit: cover; width: 100%; }
.catalogue-cover-preview { aspect-ratio: 1 / 1; object-fit: cover; width: 100%; max-width: 220px; border-radius: 16px; border:1px solid #eee; background:#fff; }
.pdf-chip{display:inline-flex;align-items:center;gap:.4rem;padding:.35rem .6rem;border-radius:999px;background:#fff7ef;color:#d96c10;text-decoration:none;font-weight:600}

/* Product preview ratios */
.product-main-preview{aspect-ratio:4/5;object-fit:contain;width:100%;max-height:520px;}
.feature-card .feature-img{aspect-ratio:4/5;object-fit:cover;width:100%;background:#fff;}
.gallery-preview{aspect-ratio:4/3;object-fit:contain;width:100%;}


/* Improved fixed-ratio crop modal */
.image-crop-dialog{max-width:min(1120px,96vw)}
.image-crop-content{border:0;border-radius:18px;overflow:hidden}
.cropper-shell{
  width:100%;
  margin:0 auto;
  height:min(68vh,620px);
  max-width:920px;
  background:#f3f4f6;
  border:1px dashed #d8dee6;
  border-radius:14px;
  overflow:hidden;
  display:flex;
  align-items:center;
  justify-content:center;
}
.cropper-shell.crop-ratio-wide{max-width:920px;height:min(62vh,560px)}
.cropper-shell.crop-ratio-tall{max-width:620px;height:min(70vh,660px)}
.cropper-shell.crop-ratio-square{max-width:680px;height:min(68vh,650px)}
.cropper-shell img{display:block;max-width:100%;max-height:100%;}
.cropper-container{margin:0 auto;}
.cropper-view-box,.cropper-face{outline-color:var(--md-orange)!important;}
.cropper-line,.cropper-point{background-color:var(--md-orange,#f58220)!important;}
.cropper-dashed{border-color:rgba(255,255,255,.65)!important;}
.crop-tools .btn{min-width:72px}
.image-zoom-wrap{
  display:inline-flex;
  position:relative;
  align-items:center;
  justify-content:center;
  border-radius:10px;
  overflow:hidden;
  cursor:zoom-in;
}
.image-zoom-wrap .thumb{display:block;transition:transform .18s ease, filter .18s ease;}
.image-zoom-wrap::after{
  content:'🔍';
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  opacity:0;
  color:#fff;
  font-size:18px;
  background:rgba(17,24,39,.42);
  transition:opacity .18s ease;
  pointer-events:none;
}
.image-zoom-wrap:hover .thumb{transform:scale(1.05);filter:brightness(.78);}
.image-zoom-wrap:hover::after{opacity:1;}
.image-zoom-wrap:focus-within{outline:2px solid var(--md-orange);outline-offset:2px;}
.image-preview-large{max-height:72vh;object-fit:contain;background:#fff;}
@media(max-width:768px){.cropper-shell,.cropper-shell.crop-ratio-wide,.cropper-shell.crop-ratio-tall,.cropper-shell.crop-ratio-square{max-width:100%;height:60vh}.crop-tools{flex-wrap:wrap}.crop-tools .btn{min-width:auto}}


/* Searchable Select2 styling */
.select2-container { width: 100% !important; font-size: .95rem; }
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
  min-height: 38px;
  border: 1px solid #dee2e6;
  border-radius: .5rem;
  padding: 2px 6px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 32px;
  padding-left: 4px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 36px; }
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--multiple {
  border-color: var(--md-orange);
  box-shadow: 0 0 0 .2rem rgba(245,130,32,.15);
}
.select2-dropdown { border-color: #dee2e6; border-radius: .5rem; overflow: hidden; z-index: 2000; }
.select2-container--default .select2-results__option--highlighted[aria-selected] { background-color: var(--md-orange); }
.select2-search--dropdown .select2-search__field {
  border: 1px solid #dee2e6;
  border-radius: .4rem;
  outline: none;
  padding: .4rem .55rem;
}
.select2-search--dropdown .select2-search__field:focus { border-color: var(--md-orange); }
.select2-container--default .select2-selection--multiple .select2-selection__choice {
  background: rgba(245,130,32,.12);
  border-color: rgba(245,130,32,.35);
  border-radius: 999px;
  padding: 2px 8px;
}

/* Bulk import/export preview */
.import-preview-table-wrap{max-height:560px;overflow:auto;border:1px solid rgba(0,0,0,.06);border-radius:12px}
.import-preview-table th{position:sticky;top:0;background:#fff;z-index:2;white-space:nowrap;font-size:12px}
.import-preview-table td{font-size:12px;min-width:110px;max-width:260px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.import-preview-table td:nth-child(3){min-width:220px;max-width:360px;white-space:normal}
.import-preview-card .badge{font-size:12px;padding:.55em .75em}

/* Brand logos */
.brand-logo-wrap{display:flex;align-items:center;min-height:86px}
.sidebar-logo{max-width:210px;max-height:68px;object-fit:contain;display:block}
.login-logo{max-width:280px;max-height:135px;object-fit:contain;background:#111827;border-radius:18px;padding:14px;box-shadow:0 12px 28px rgba(17,24,39,.18)}
.logo-preview{max-width:190px;max-height:86px;object-fit:contain;border:1px solid #374151;border-radius:10px;background:#111827;padding:8px}
.favicon-preview{width:42px;height:42px;object-fit:contain;border:1px solid #e5e7eb;border-radius:10px;background:#fff;padding:6px}

/* Phase 2.7 - Product edit media gallery */
.product-media-card { border-radius: 14px; overflow: hidden; }
.product-media-thumb { background: #f8f9fa; aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.product-media-preview { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-media-placeholder { width: 100%; height: 100%; min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #6c757d; background: linear-gradient(135deg, #f8f9fa, #e9ecef); }
.video-preview-wrap { position: relative; width: 100%; height: 100%; }
.play-badge { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); width: 42px; height: 42px; border-radius: 999px; background: rgba(0,0,0,.62); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; padding-left: 3px; }
.product-existing-media-block .badge.text-bg-light { border: 1px solid #dee2e6; color: #495057 !important; }

/* Phase 2.7.1 - Inline media editing on product page */
.inline-media-editor{border:1px solid #e9ecef;border-radius:12px;background:#fffaf5;padding:10px;margin-top:10px}
.inline-media-editor .form-label{font-weight:600;color:#495057}
.product-media-card .card-footer .btn{white-space:nowrap}
@media(max-width:768px){.product-media-card .card-footer{gap:.35rem}.product-media-card .card-footer .btn{flex:1 1 auto}}

/* Phase 2.8.1 - compact product edit media thumbnails */
.product-existing-media-block #existingMediaGrid{align-items:stretch}
.product-existing-media-block .product-media-card{border-radius:12px;overflow:hidden;box-shadow:0 1px 4px rgba(15,23,42,.06)}
.product-existing-media-block .product-media-thumb{height:96px;aspect-ratio:auto;background:#f8f9fa;display:flex;align-items:center;justify-content:center;overflow:hidden}
.product-existing-media-block .product-media-preview-btn{border:0;background:transparent;padding:0;width:100%;height:100%;display:block;position:relative;cursor:pointer}
.product-existing-media-block .product-media-preview{width:100%;height:100%;object-fit:cover;display:block}
.product-existing-media-block .product-media-placeholder{min-height:96px;height:96px;font-size:.78rem}
.product-existing-media-block .card-body{font-size:.82rem}
.product-existing-media-block .card-body .badge{font-size:.68rem}
.product-existing-media-block .card-footer .btn{font-size:.72rem;padding:.22rem .38rem}
.product-media-large-preview{min-height:180px;background:#f8f9fa;border-radius:12px;display:flex;align-items:center;justify-content:center}
.product-media-large-preview img{max-height:78vh;object-fit:contain}
.product-media-large-preview video{max-height:78vh;background:#000}
@media(max-width:768px){.product-existing-media-block .product-media-thumb{height:82px}.product-existing-media-block .card-body{font-size:.78rem}}

/* Phase 2.8.2 - Product media role-wise rows */
.product-media-role-section{
  border:1px solid #e9ecef;
  border-radius:14px;
  background:#fff;
  padding:12px;
  margin-bottom:12px;
}
.product-media-role-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding-bottom:10px;
  margin-bottom:10px;
  border-bottom:1px solid #f1f3f5;
}
.product-media-role-row{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  align-items:stretch;
}
.product-media-role-item{
  flex:0 0 145px;
  max-width:145px;
}
.product-media-role-item .inline-media-editor{
  position:relative;
  z-index:2;
}
.product-media-role-item .inline-media-editor .row>[class*='col-']{
  width:100%;
}
.product-media-role-item .inline-media-editor .pt-4{
  padding-top:.25rem!important;
}
@media(max-width:768px){
  .product-media-role-header{flex-direction:column;align-items:flex-start}
  .product-media-role-item{flex:0 0 calc(50% - 6px);max-width:calc(50% - 6px)}
}


/* PIM sidebar industrial accordion polish */
:root{
  --pim-sidebar-bg:#0b1220;
  --pim-sidebar-panel:#111a2b;
  --pim-sidebar-panel-soft:#0f1727;
  --pim-sidebar-border:rgba(148,163,184,.14);
  --pim-sidebar-text:#dbe4f0;
  --pim-sidebar-muted:#8795a8;
  --pim-sidebar-active:#f58220;
}
.sidebar{
  width:280px;
  background:
    radial-gradient(circle at 12% 0%,rgba(245,130,32,.12),transparent 26%),
    linear-gradient(180deg,#0b1220 0%,#08101d 100%);
  border-right:1px solid rgba(255,255,255,.06);
  padding:0 14px 22px;
  box-shadow:14px 0 40px rgba(2,6,23,.10);
}
.main{
  margin-left:280px;
}
.sidebar .brand{
  margin:0 -14px 14px;
  padding:24px 18px 22px;
  min-height:116px;
  justify-content:center;
  border-bottom:1px solid var(--pim-sidebar-border);
  background:linear-gradient(180deg,#101827 0%,#0b1220 100%);
}
.sidebar-logo{
  max-width:205px;
  max-height:76px;
  object-fit:contain;
}
.sidebar a{
  border-left:0;
}
.sidebar-main-link{
  margin:0 0 12px;
  padding:13px 15px;
  border-radius:14px;
  color:var(--pim-sidebar-text);
  background:rgba(255,255,255,.035);
  border:1px solid var(--pim-sidebar-border);
  font-size:14px;
  font-weight:850;
  letter-spacing:-.01em;
  box-shadow:0 10px 24px rgba(2,6,23,.10);
}
.sidebar-main-link:hover,
.sidebar-main-link.active{
  color:#fff;
  background:linear-gradient(135deg,rgba(245,130,32,.95),rgba(217,108,16,.95));
  border-color:rgba(245,130,32,.65);
  box-shadow:0 16px 34px rgba(245,130,32,.22);
}
.sidebar-group{
  margin:8px 0;
  border:1px solid var(--pim-sidebar-border);
  border-radius:16px;
  background:rgba(255,255,255,.025);
  box-shadow:0 10px 26px rgba(2,6,23,.08);
  overflow:hidden;
}
.sidebar-group[open]{
  background:rgba(255,255,255,.04);
  border-color:rgba(245,130,32,.24);
}
.sidebar-group-title{
  list-style:none!important;
  cursor:pointer;
  user-select:none;
  padding:13px 15px;
  color:#ecf2fb;
  background:transparent;
  font-size:12px;
  font-weight:900;
  line-height:1.2;
  letter-spacing:.075em;
  text-transform:uppercase;
  display:flex!important;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  border:0;
  outline:0;
}
.sidebar-group-title::-webkit-details-marker{
  display:none!important;
}
.sidebar-group-title::marker{
  content:""!important;
  display:none!important;
}
.sidebar-group-title span{
  display:flex;
  align-items:center;
  gap:10px;
}
.sidebar-group-title span:before{
  content:"";
  width:8px;
  height:8px;
  border-radius:999px;
  background:rgba(148,163,184,.72);
  box-shadow:0 0 0 4px rgba(148,163,184,.08);
}
.sidebar-group-title:after{
  content:"";
  width:9px;
  height:9px;
  flex:0 0 9px;
  border-right:2px solid rgba(219,228,240,.78);
  border-bottom:2px solid rgba(219,228,240,.78);
  transform:rotate(45deg);
  transition:transform .18s ease, border-color .18s ease;
  margin-top:-5px;
}
.sidebar-group[open] .sidebar-group-title{
  color:#fff;
  background:linear-gradient(90deg,rgba(245,130,32,.16),rgba(245,130,32,0));
}
.sidebar-group[open] .sidebar-group-title span:before{
  background:var(--pim-sidebar-active);
  box-shadow:0 0 0 4px rgba(245,130,32,.13);
}
.sidebar-group[open] .sidebar-group-title:after{
  transform:rotate(225deg);
  margin-top:4px;
  border-color:#fff;
}
.sidebar-group-title:hover{
  color:#fff;
  background:rgba(245,130,32,.10);
}
.sidebar-group-panel{
  padding:4px 8px 10px;
  border-top:1px solid rgba(255,255,255,.055);
}
.sidebar-child-link{
  margin:3px 0;
  padding:10px 12px 10px 30px;
  border-radius:12px;
  color:#c7d2e3;
  font-size:14px;
  line-height:1.25;
  border-left:0;
  background:transparent;
  position:relative;
  transition:background .16s ease,color .16s ease,transform .16s ease;
}
.sidebar-child-link:before{
  content:"";
  position:absolute;
  left:13px;
  top:50%;
  width:5px;
  height:5px;
  border-radius:999px;
  background:rgba(148,163,184,.58);
  transform:translateY(-50%);
}
.sidebar-child-link:hover{
  color:#fff;
  background:rgba(255,255,255,.07);
  transform:translateX(2px);
}
.sidebar-child-link.active{
  color:#fff;
  background:linear-gradient(90deg,rgba(245,130,32,.26),rgba(245,130,32,.08));
  box-shadow:inset 3px 0 0 var(--pim-sidebar-active);
  font-weight:800;
}
.sidebar-child-link.active:before,
.sidebar-child-link:hover:before{
  background:var(--pim-sidebar-active);
}
.sidebar::-webkit-scrollbar{
  width:7px;
}
.sidebar::-webkit-scrollbar-track{
  background:rgba(255,255,255,.025);
}
.sidebar::-webkit-scrollbar-thumb{
  background:rgba(148,163,184,.28);
  border-radius:999px;
}
.sidebar::-webkit-scrollbar-thumb:hover{
  background:rgba(245,130,32,.46);
}
.topbar{
  height:70px;
  box-shadow:0 10px 30px rgba(15,23,42,.04);
}
@media(max-width:900px){
  .sidebar{
    width:100%;
    padding:0 12px 16px;
  }
  .main{
    margin-left:0;
  }
  .sidebar .brand{
    margin:0 -12px 12px;
    min-height:92px;
  }
}

/* Modal searchable dropdown fixes */
.modal-dialog-scrollable .modal-body{overflow-y:auto;}
.select2-dropdown{z-index:1065;}
.select2-container--open{z-index:1066;}
.modal-body .select2-container .select2-selection--multiple{min-height:42px;}
.modal-body .select2-results__options{max-height:260px;overflow-y:auto;}
