/*
 * TradeBridge layer on top of admin.css: brand colours from the storefront
 * (navy #0a1a33, blue #1a73f0) plus the CMS-specific widgets.
 */
:root,
[data-coreui-theme="light"] {
    --adm-ink: #0a1a33;
    --adm-ink-2: #10264a;
    --adm-brand: #1a73f0;
    --adm-brand-strong: #0f5fd0;
    --adm-brand-soft: #e8f1fe;
    --cui-primary-rgb: 26, 115, 240;
    --cui-link-color-rgb: 26, 115, 240;
}
[data-coreui-theme="dark"] {
    --adm-brand: #4f95ff;
    --adm-brand-strong: #7ab0ff;
    --adm-brand-soft: rgba(79, 149, 255, 0.16);
    --cui-primary-rgb: 79, 149, 255;
    --cui-link-color-rgb: 79, 149, 255;
}

/* Login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 10% -10%, #1a73f033, transparent 60%), radial-gradient(900px 500px at 110% 110%, #3fd6ea22, transparent 60%), var(--adm-ink); }
.login-card { width: 100%; max-width: 420px; background: var(--adm-card); border-radius: 18px; padding: 36px 32px; box-shadow: var(--adm-shadow-lg); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-brand img { width: 44px; height: 44px; }
.login-brand strong { display: block; font-family: var(--adm-display); font-size: 1.2rem; color: var(--adm-ink); }
[data-coreui-theme="dark"] .login-brand strong { color: #fff; }
.login-brand small { color: var(--adm-muted); }

/* Image upload widget */
.image-upload__drop { display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; border: 2px dashed var(--cui-border-color); border-radius: 10px; background: var(--cui-tertiary-bg); min-height: 140px; padding: 14px; cursor: pointer; text-align: center; transition: border-color .15s ease, background-color .15s ease; margin: 0; }
.image-upload__drop:hover, .image-upload__drop.is-dragover { border-color: var(--cui-primary); background: rgba(var(--cui-primary-rgb), .06); }
.image-upload__placeholder { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--cui-secondary-color); }
.image-upload__placeholder i { font-size: 26px; color: var(--cui-primary); }
.image-upload__cta { font-size: .875rem; font-weight: 500; color: var(--cui-body-color); }
.image-upload__preview-wrap { width: 100%; display: flex; justify-content: center; }
.image-upload__preview { max-width: 100%; max-height: 170px; border-radius: 8px; object-fit: contain; }
.image-upload__remove { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%; border: none; background: rgba(220,53,69,.9); color: #fff; display: flex; align-items: center; justify-content: center; font-size: .8rem; z-index: 2; }
.image-upload__remove:hover { background: #dc3545; }

/* Repeater rows (specs, notes) */
.repeater-row { display: flex; gap: 8px; align-items: flex-start; padding: 10px; border: 1px solid var(--cui-border-color); border-radius: 10px; background: var(--cui-card-bg); margin-bottom: 8px; }
.repeater-row > .flex-grow-1 { min-width: 0; }
.repeater.is-empty .repeater-empty { display: block; }
.repeater-empty { display: none; padding: 14px; border: 1px dashed var(--cui-border-color); border-radius: 10px; text-align: center; color: var(--cui-secondary-color); font-size: 13px; margin-bottom: 8px; }
.drag-handle { cursor: grab; color: var(--cui-secondary-color); padding: 6px 4px; line-height: 1; }
.drag-handle:active { cursor: grabbing; }
.sortable-ghost { opacity: .45; background: var(--adm-brand-soft) !important; }

/* Icon select with preview */
.icon-select { display: flex; align-items: center; gap: 8px; }
.icon-select .icon-preview { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 8px; display: grid; place-items: center; background: var(--adm-brand-soft); color: var(--adm-brand); font-size: 18px; }

/* Page editor: section side navigation */
.page-editor { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.section-nav { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; padding: 10px; background: var(--adm-card, var(--cui-body-bg)); border: 1px solid var(--cui-border-color); border-radius: 14px; max-height: calc(100vh - 110px); overflow-y: auto; }
.section-nav-title { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--cui-secondary-color); padding: 4px 10px 8px; }
.section-nav a { padding: 8px 10px; border-radius: 8px; color: var(--cui-secondary-color); text-decoration: none; display: flex; gap: 10px; align-items: center; line-height: 1.3; }
.section-nav a i { flex: 0 0 16px; font-size: 15px; text-align: center; opacity: .8; }
.section-nav a span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-nav a.is-active i { opacity: 1; }
.page-section-title { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
.page-section-title i { color: var(--adm-brand); font-size: 16px; }
.section-nav a:hover { background: var(--adm-hover); color: var(--cui-body-color); }
.section-nav a.is-active { background: var(--adm-brand-soft); color: var(--adm-brand); font-weight: 600; }
.page-section { scroll-margin-top: 90px; }
.page-section .card-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.list-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.list-link { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--cui-border-color); background: var(--cui-tertiary-bg); text-decoration: none; color: var(--cui-body-color); font-size: 13.5px; }
.list-link:hover { border-color: var(--adm-brand); color: var(--adm-brand); }
.list-link .badge { font-weight: 600; }
.items-inline { border: 1px solid var(--cui-border-color); border-radius: 10px; padding: 10px 12px 4px; background: var(--cui-tertiary-bg); }
.items-inline + .items-inline { margin-top: 12px; }
.items-inline-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
.items-inline-head i { color: var(--adm-brand); }
.items-inline .table { --cui-table-bg: transparent; }
.items-inline .table > :not(caption) > * > * { padding-top: 6px; padding-bottom: 6px; }
.items-inline .empty-row { padding: 18px 8px; }
.settings-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--cui-border-color); margin-bottom: 20px; overflow-x: auto; }
.settings-tabs a { padding: 9px 14px; color: var(--cui-secondary-color); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: 14px; display: inline-flex; gap: 8px; align-items: center; }
.settings-tabs a:hover { color: var(--cui-body-color); }
.settings-tabs a.is-active { color: var(--adm-brand); border-bottom-color: var(--adm-brand); font-weight: 600; }
@media (max-width: 1279.98px) {
    /* Not enough room for a side menu next to the admin sidebar: show the sections as a scrollable tab bar. */
    .page-editor { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .section-nav { top: 64px; z-index: 15; flex-direction: row; overflow-x: auto; overflow-y: hidden; max-height: none; padding: 6px; gap: 4px; scrollbar-width: none; box-shadow: 0 8px 20px -16px rgba(11, 19, 36, .35); }
    .section-nav-title { display: none; }
    .section-nav a { white-space: nowrap; flex: 0 0 auto; padding: 7px 12px; }
    .section-nav a span { overflow: visible; }
    .page-section { scroll-margin-top: 130px; }
}

/* Cards of pages / lists */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tile { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border: 1px solid var(--cui-border-color); border-radius: 14px; background: var(--cui-card-bg); text-decoration: none; color: var(--cui-body-color); transition: border-color .15s, box-shadow .15s, transform .15s; }
.tile:hover { border-color: var(--adm-brand); box-shadow: var(--adm-shadow); transform: translateY(-1px); color: var(--cui-body-color); }
.tile-icon { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 10px; display: grid; place-items: center; background: var(--adm-brand-soft); color: var(--adm-brand); font-size: 18px; }
.tile strong { display: block; font-weight: 600; color: var(--cui-emphasis-color); }
.tile small { display: block; color: var(--cui-secondary-color); font-size: 12.5px; margin-top: 2px; }
.tile-group-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--cui-secondary-color); margin: 22px 0 10px; }
.tile-group-title:first-child { margin-top: 0; }

/* Inbox */
.inbox-row-new td:first-child { box-shadow: inset 3px 0 0 var(--adm-brand); }
.inbox-row-new .inbox-name { font-weight: 700; }
.detail-list { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.detail-list dt { color: var(--cui-secondary-color); font-weight: 500; font-size: 13px; }
.detail-list dd { margin: 0; word-break: break-word; }
.pre-wrap { white-space: pre-wrap; }
.parts-box { white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; background: var(--cui-tertiary-bg); border: 1px solid var(--cui-border-color); border-radius: 10px; padding: 14px; margin: 0; }

.product-thumb { width: 48px; height: 48px; object-fit: contain; border-radius: 8px; background: #fff; box-shadow: 0 0 0 1px var(--cui-border-color); }
.product-thumb.is-fallback { object-fit: cover; opacity: .55; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: #22c55e; }
.status-dot.is-off { background: #f59e0b; }
.chip-list { display: flex; flex-wrap: wrap; gap: 4px; }
.chip-list .badge { font-weight: 500; }
.form-switch .form-check-input { cursor: pointer; }
.hint-hl { font-size: 12px; color: var(--cui-secondary-color); }
