/* =====================================================================
   Al Mutlaq CRM — Web Catalogs & Promotion Studio Styles
   ===================================================================== */

/* ---- Scoped to CRM (inert when accounting full-screen is active) ---- */
body:not(.acc-fullscreen) {

  /* ---- Catalog Gallery Grid ---- */
  .cat-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 18px;
    margin-top: 14px;
  }

  .cat-card {
    background: var(--card, #fff);
    border: 1px solid var(--line, #e3e6ef);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  }

  .cat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.07);
    border-color: #cbd5e1;
  }

  .cat-card__cover {
    height: 150px;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    padding: 14px;
  }

  .cat-card__cover-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.65;
    transition: transform 0.3s ease;
  }

  .cat-card:hover .cat-card__cover-img {
    transform: scale(1.04);
  }

  .cat-card__cover-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.85) 0%, rgba(15, 23, 42, 0.2) 60%, transparent 100%);
  }

  .cat-card__theme-pill {
    position: absolute;
    top: 12px;
    inset-inline-start: 12px;
    z-index: 2;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
  }

  .cat-card__status-pill {
    position: absolute;
    top: 12px;
    inset-inline-end: 12px;
    z-index: 2;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
  }

  .cat-card__status-pill.is-pub {
    background: #e8f6ee;
    color: #0b6b38;
    border: 1px solid #a3e6be;
  }

  .cat-card__status-pill.is-draft {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #cbd5e1;
  }

  .cat-card__cover-content {
    position: relative;
    z-index: 2;
    color: #fff;
  }

  .cat-card__title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 3px;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  }

  .cat-card__sub {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
  }

  .cat-card__body {
    padding: 14px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .cat-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--ink-mute, #676879);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line, #e3e6ef);
  }

  .cat-card__meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
  }

  .cat-card__meta-item b {
    color: var(--ink, #1f2540);
    font-size: 13px;
  }

  .cat-card__link-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
  }

  .cat-card__link-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--blue, #0073ea);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
  }

  .cat-card__acts {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 6px;
  }

  .cat-btn-wa {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    border: 0;
    border-radius: 9px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
    transition: all 0.18s ease;
  }
  .cat-btn-wa:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  }

  .cat-btn-edit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
  }
  .cat-btn-edit:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #cbd5e1;
    transform: translateY(-1px);
  }

  /* ---- Studio Split Screen Builder ---- */
  .cat-studio {
    display: grid;
    grid-template-columns: minmax(420px, 1.2fr) minmax(360px, 1fr);
    gap: 20px;
    align-items: start;
    margin-top: 14px;
  }

  .cat-studio__editor {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .cat-studio__preview-wrap {
    position: sticky;
    top: 70px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--card, #fff);
    border: 1px solid var(--line, #e3e6ef);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  }

  .cat-studio__preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line, #e3e6ef);
  }

  .cat-device-toggles {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 8px;
  }

  .cat-device-btn {
    border: 0;
    background: transparent;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .cat-device-btn.is-active {
    background: #fff;
    color: var(--ink, #1f2540);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  }

  /* ---- Device Frame Simulator ---- */
  .cat-simulator {
    display: flex;
    justify-content: center;
    background: #0f172a;
    padding: 20px;
    border-radius: 12px;
    overflow: hidden;
    min-height: 600px;
  }

  .cat-simulator__mobile {
    width: 360px;
    height: 680px;
    background: #fff;
    border-radius: 36px;
    border: 10px solid #1e293b;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
  }

  .cat-simulator__notch {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 140px;
    height: 18px;
    background: #1e293b;
    border-bottom-left-radius: 14px;
    border-bottom-right-radius: 14px;
    z-index: 10;
  }

  .cat-simulator__iframe {
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
  }

  .cat-simulator__desktop {
    width: 100%;
    height: 680px;
    background: #fff;
    border-radius: 10px;
    border: 1px solid #334155;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  /* ---- Studio Sections & Cards ---- */
  .cat-sec {
    background: var(--card, #fff);
    border: 1px solid var(--line, #e3e6ef);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .cat-sec__h {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2px;
  }

  .cat-sec__title {
    font-size: 14px;
    font-weight: 700;
    color: var(--ink, #1f2540);
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .cat-sec__desc {
    font-size: 12px;
    color: var(--ink-mute, #676879);
    margin: 0;
  }

  /* ---- Theme Selector Swatches ---- */
  .cat-themes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
  }

  .cat-theme-opt {
    border: 2px solid var(--line, #e3e6ef);
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: border-color 0.15s ease, transform 0.15s ease;
  }

  .cat-theme-opt:hover {
    border-color: #94a3b8;
  }

  .cat-theme-opt.is-selected {
    border-color: var(--blue, #0073ea);
    background: rgba(0, 115, 234, 0.04);
  }

  .cat-theme-opt__preview {
    height: 38px;
    border-radius: 6px;
    display: flex;
    overflow: hidden;
  }

  .cat-theme-opt__name {
    font-size: 12px;
    font-weight: 700;
    color: var(--ink, #1f2540);
  }

  /* ---- Product Item in Builder ---- */
  .cat-prods-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .cat-prod-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
    transition: background 0.15s ease;
  }

  .cat-prod-item:hover {
    background: #f1f5f9;
  }

  .cat-prod-item__handle {
    cursor: grab;
    color: #94a3b8;
  }

  .cat-prod-item__thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
    flex-shrink: 0;
  }

  .cat-prod-item__info {
    flex: 1;
    min-width: 0;
  }

  .cat-prod-item__title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink, #1f2540);
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .cat-prod-item__sub {
    font-size: 11.5px;
    color: var(--ink-mute, #676879);
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .cat-prod-item__price {
    font-weight: 700;
    color: #0b6b38;
  }

  .cat-prod-item__old-price {
    text-decoration: line-through;
    color: #94a3b8;
  }

  .cat-badge-chip {
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    background: #fee2e2;
    color: #dc2626;
    letter-spacing: 0.03em;
  }

  .cat-prod-item__acts {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  /* ---- Buttons and affordances ---- */
  .cat-btn-wa {
    background: var(--wa-green, #128C4A);
    color: #fff;
    font-weight: 700;
    border: 0;
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    transition: background 0.15s ease;
  }

  .cat-btn-wa:hover {
    background: var(--wa-green-ink, #0b6b38);
  }

  /* ---- Inventory Importer Grid ---- */
  .cat-inv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
    max-height: 420px;
    overflow-y: auto;
    padding: 4px;
  }

  .cat-inv-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: border-color 0.15s ease, background 0.15s ease;
  }

  .cat-inv-card:hover {
    border-color: var(--blue, #0073ea);
    background: #f0f7ff;
  }

  .cat-inv-card.is-selected {
    border-color: #0b6b38;
    background: #f0fdf4;
  }

  .cat-inv-card__name {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink, #1f2540);
  }

  .cat-inv-card__sku {
    font-size: 11.5px;
    color: var(--ink-mute, #676879);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  }

  .cat-inv-card__price {
    font-size: 13px;
    font-weight: 700;
    color: var(--blue, #0073ea);
    margin-top: 4px;
  }

  /* ---- Unified Toolbar & Action Buttons ---- */
  .cat-tb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 36px;
    padding: 0 15px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    outline: none;
    user-select: none;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-sizing: border-box;
  }

  .cat-tb-btn svg {
    flex-shrink: 0;
    transition: transform 0.18s ease;
  }

  /* Secondary / Import Button */
  .cat-tb-btn--import,
  .pill-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #cbd5e1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-sizing: border-box;
  }

  .cat-tb-btn--import {
    background: #f0f7ff;
    color: #0073ea;
    border: 1px solid #bae0ff;
    box-shadow: 0 1px 2px rgba(0, 115, 234, 0.08);
  }

  .cat-tb-btn--import:hover {
    transform: translateY(-1.5px);
    background: #e6f4ff;
    border-color: #0073ea;
    color: #0060c4;
    box-shadow: 0 4px 12px rgba(0, 115, 234, 0.16);
  }

  .pill-btn:hover {
    transform: translateY(-1.5px);
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
  }

  .cat-tb-btn--import:active,
  .pill-btn:active {
    transform: translateY(0.5px) scale(0.98);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  }

  /* Primary Button */
  .cat-tb-btn--primary {
    background: linear-gradient(180deg, #007ae8 0%, #0066d6 100%);
    color: #ffffff !important;
    border: 1px solid rgba(0, 85, 185, 0.4);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 115, 234, 0.28);
  }

  .cat-tb-btn--primary:hover {
    transform: translateY(-1.5px);
    filter: brightness(1.04);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.06), 0 8px 20px rgba(0, 115, 234, 0.35);
  }

  .cat-tb-btn--primary:active {
    transform: translateY(0.5px) scale(0.98);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 2px 6px rgba(0, 115, 234, 0.2);
  }

  .pill-btn--import {
    background: #f0f7ff;
    color: #0073ea;
    border-color: #bae0ff;
  }

  /* ---- Redesigned Import HTML Modal ---- */
  .mdl--import-html {
    max-width: 600px !important;
    width: min(600px, 94vw) !important;
  }

  .imp-header {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
  }

  .imp-header__icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: #eff6ff;
    color: #0073ea;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .imp-header__text {
    flex: 1;
    min-width: 0;
  }

  .imp-header__title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--ink, #1f2540);
  }

  .imp-header__sub {
    margin: 2px 0 0;
    font-size: 12.5px;
    color: var(--ink-mute, #676879);
  }

  .imp-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 20px 16px;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
  }

  .imp-dropzone:hover {
    border-color: #0073ea;
    background: #f0f7ff;
    transform: translateY(-1px);
  }

  .imp-dropzone__icon {
    color: #0073ea;
    margin-bottom: 2px;
  }

  .imp-dropzone__title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink, #1f2540);
  }

  .imp-dropzone__sub {
    font-size: 11.5px;
    color: var(--ink-mute, #676879);
  }

  .imp-dropzone__pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #eff6ff;
    color: #0073ea;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 99px;
    margin-top: 4px;
    border: 1px solid #bfdbfe;
  }

  .imp-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0 12px;
  }

  .imp-divider__line {
    flex: 1;
    height: 1px;
    background: #e2e8f0;
  }

  .imp-divider__text {
    font-size: 10.5px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.6px;
  }

  .imp-code-ta {
    width: 100%;
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11.5px;
    line-height: 1.45;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #334155;
    background: #0f172a;
    color: #38bdf8;
    box-sizing: border-box;
    resize: vertical;
    min-height: 105px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
  }

  .imp-code-ta:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25);
  }

  .imp-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
  }

  .imp-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .imp-field label {
    font-size: 11.5px;
    font-weight: 600;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 5px;
  }

  .imp-field label svg {
    color: #0073ea;
  }

  .imp-field input {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    font-size: 13px;
    color: var(--ink, #1f2540);
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
  }

  .imp-field input:focus {
    border-color: #0073ea;
    box-shadow: 0 0 0 3px rgba(0, 115, 234, 0.14);
  }

  .cat-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 24px 16px;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  .cat-dropzone:hover {
    border-color: #0073ea;
    background: #0073ea0a;
  }

  .cat-code-editor-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .cat-code-editor {
    width: 100%;
    height: 480px;
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    line-height: 1.5;
    padding: 14px;
    background: #0f172a;
    color: #38bdf8;
    border: 1px solid #1e293b;
    border-radius: 12px;
    tab-size: 2;
    resize: vertical;
    outline: none;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.5);
  }
  .cat-code-editor:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
  }

  .cat-code-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    background: #1e293b;
    padding: 8px 12px;
    border-radius: 8px;
    color: #e2e8f0;
  }

  .cat-code-tag-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
  }
  .cat-code-tag-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
  }

  /* ---- Mobile responsive ---- */
  @media (max-width: 980px) {
    .cat-studio {
      grid-template-columns: 1fr;
    }

    .cat-studio__preview-wrap {
      position: static;
    }
  }
}
