/**
 * @copyright  (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
 * @copyright  (C) 2026 JoomlaWorks Ltd. and this project's contributors
 * @license    GNU General Public License version 2 or later; see LICENSE.md
 */

/* Base rules under :where() (no specificity): a template's own styles win, whatever the order the stylesheets load in */

/* --- System messages --- */
:where(#system-message) {margin-bottom:10px;padding:0;}
:where(#system-message > dt) {font-weight:bold;display:none;}
:where(#system-message > dd) {margin:0;font-weight:bold;text-indent:30px;}
:where(#system-message > dd > ul) {color:#0055bb;background-position:4px top;background-size:24px 24px;background-repeat:no-repeat;margin-bottom:10px;list-style:none;padding:10px;border-top:3px solid #84a7db;border-bottom:3px solid #84a7db;}
:where(#system-message > dd > ul > li) {line-height:1.5em;}
:where(#system-message > .message > ul) {background-color:#c3d2e5;background-image:url(../images/icons/notice-info.svg);}
:where(#system-message > .error > ul),
:where(#system-message > .warning > ul),
:where(#system-message > .notice > ul) {color:#c00;}
:where(#system-message > .error > ul) {background-color:#e6c0c0;background-image:url(../images/icons/notice-alert.svg);border-color:#de7a7b;}
:where(#system-message > .warning > ul) {background-color:#e6c8a6;background-image:url(../images/icons/notice-note.svg);border-color:#ffbb00;}
:where(#system-message > .notice > ul) {background-color:#efe7b8;background-image:url(../images/icons/notice-note.svg);border-color:#f0dc7e;}

/* --- Content --- */
:where(.system-unpublished),
:where(tr.system-unpublished) {background:#e8edf1;border-top:4px solid #c4d3df;border-bottom:4px solid #c4d3df;}
:where(span.highlight) {background-color:#ffffcc;font-weight:bold;padding:1px 0;}

/* --- Forms --- */
:where(.invalid) {border-color:#ff0000;}
:where(label.invalid) {color:#ff0000;}

/* --- Tooltips and popovers (CMS.tip, in Bootstrap 2's markup and look; templates styling them win) --- */
:where(.tooltip) {position:absolute;z-index:1030;display:block;font-size:11px;line-height:1.4;opacity:0;}
:where(.tooltip.in) {opacity:0.8;}
:where(.tooltip.top) {margin-top:-3px;padding:5px 0;}
:where(.tooltip.right) {margin-left:3px;padding:0 5px;}
:where(.tooltip.bottom) {margin-top:3px;padding:5px 0;}
:where(.tooltip.left) {margin-left:-3px;padding:0 5px;}
:where(.tooltip-inner) {max-width:200px;padding:8px;color:#fff;text-align:center;text-decoration:none;background-color:#000;border-radius:4px;}
:where(.tooltip-arrow) {position:absolute;width:0;height:0;border-color:transparent;border-style:solid;}
:where(.tooltip.top .tooltip-arrow) {bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000;}
:where(.tooltip.right .tooltip-arrow) {top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000;}
:where(.tooltip.left .tooltip-arrow) {top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000;}
:where(.tooltip.bottom .tooltip-arrow) {top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000;}
:where(.popover) {position:absolute;top:0;left:0;z-index:1010;display:none;max-width:276px;padding:1px;text-align:left;white-space:normal;background-color:#fff;background-clip:padding-box;border:1px solid rgba(0, 0, 0, 0.2);border-radius:6px;box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);}
:where(.popover.top) {margin-top:-10px;}
:where(.popover.right) {margin-left:10px;}
:where(.popover.bottom) {margin-top:10px;}
:where(.popover.left) {margin-left:-10px;}
:where(.popover-title) {margin:0;padding:8px 14px;font-size:14px;font-weight:normal;line-height:18px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0;}
:where(.popover-title:empty) {display:none;}
:where(.popover-content) {padding:9px 14px;}
:where(.popover .arrow),
:where(.popover .arrow::after) {position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid;}
:where(.popover .arrow) {border-width:11px;}
:where(.popover .arrow::after) {border-width:10px;content:"";}
:where(.popover.top .arrow) {left:50%;bottom:-11px;margin-left:-11px;border-bottom-width:0;border-top-color:rgba(0, 0, 0, 0.25);}
:where(.popover.top .arrow::after) {bottom:1px;margin-left:-10px;border-bottom-width:0;border-top-color:#fff;}
:where(.popover.right .arrow) {top:50%;left:-11px;margin-top:-11px;border-left-width:0;border-right-color:rgba(0, 0, 0, 0.25);}
:where(.popover.right .arrow::after) {left:1px;bottom:-10px;border-left-width:0;border-right-color:#fff;}
:where(.popover.bottom .arrow) {left:50%;top:-11px;margin-left:-11px;border-top-width:0;border-bottom-color:rgba(0, 0, 0, 0.25);}
:where(.popover.bottom .arrow::after) {top:1px;margin-left:-10px;border-top-width:0;border-bottom-color:#fff;}
:where(.popover.left .arrow) {top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:rgba(0, 0, 0, 0.25);}
:where(.popover.left .arrow::after) {right:1px;bottom:-10px;border-right-width:0;border-left-color:#fff;}

/* --- Module preview (?tp=1: the module chrome outline shows each module's position and style) --- */
.mod-preview {margin:8px 0;border-radius:1px;background:rgba(100, 100, 100, 0.08);box-shadow:0 0 0 4px #f4f4f4, 0 0 0 5px rgba(100, 100, 100, 0.2);}
.mod-preview-info {margin-bottom:5px;padding:4px 6px;border-radius:3px;background-color:#33373f;box-shadow:0 -10px 20px rgba(0, 0, 0, 0.2) inset;color:#fff;font:0.75rem/1rem Arial, sans-serif;}
.mod-preview-info span {color:#ccc;font-weight:bold;}
.mod-preview-wrapper {margin-bottom:0.5rem;}

/* --- System pages: tokens (body.tmpl-error, body.tmpl-offline; light, dark as the device is) --- */
body.tmpl-error,
body.tmpl-offline {
    --sys-bg:          #f6f6f7;
    --sys-card:        #ffffff;
    --sys-fg:          #09090b;
    --sys-muted:       #63636b;
    --sys-border:      #e4e4e7;
    --sys-primary:     #18181b;
    --sys-on-primary:  #fafafa;
    --sys-ring:        #3b82f6;
    --sys-danger:      #b91c1c;
    color-scheme:      light;
}

@media (prefers-color-scheme:dark) {
    body.tmpl-error,
    body.tmpl-offline {--sys-bg:#09090b;--sys-card:#18181b;--sys-fg:#fafafa;--sys-muted:#a1a1aa;--sys-border:#2e2e33;--sys-primary:#fafafa;--sys-on-primary:#18181b;--sys-ring:#60a5fa;--sys-danger:#f87171;color-scheme:dark;}
}

/* --- System pages: shared parts (.sys-*) --- */
body.tmpl-error,
body.tmpl-offline {box-sizing:border-box;margin:0;min-height:100vh;background:var(--sys-bg);color:var(--sys-fg);font:16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;-webkit-text-size-adjust:100%;text-size-adjust:100%;}
:is(body.tmpl-error, body.tmpl-offline) *,
:is(body.tmpl-error, body.tmpl-offline) *::before,
:is(body.tmpl-error, body.tmpl-offline) *::after {box-sizing:border-box;}
:is(body.tmpl-error, body.tmpl-offline) .sys-card {padding:40px 32px;border:1px solid var(--sys-border);border-radius:16px;background:var(--sys-card);box-shadow:0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);}
:is(body.tmpl-error, body.tmpl-offline) .sys-title {margin:0 0 8px;font-size:24px;line-height:1.25;font-weight:700;letter-spacing:-0.01em;}
:is(body.tmpl-error, body.tmpl-offline) label {display:block;margin:0 0 6px;font-size:14px;font-weight:600;}
:is(body.tmpl-error, body.tmpl-offline) input:not([type="hidden"]) {width:100%;height:44px;margin:0;padding:0 12px;border:1px solid var(--sys-border);border-radius:8px;background:var(--sys-card);color:var(--sys-fg);font:inherit;}
:is(body.tmpl-error, body.tmpl-offline) input:focus-visible,
:is(body.tmpl-error, body.tmpl-offline) .sys-button:focus-visible,
:is(body.tmpl-error, body.tmpl-offline) a:focus-visible,
:is(body.tmpl-error, body.tmpl-offline) summary:focus-visible {outline:2px solid var(--sys-ring);outline-offset:2px;}
:is(body.tmpl-error, body.tmpl-offline) .sys-button {display:inline-flex;align-items:center;justify-content:center;height:44px;padding:0 18px;border:1px solid var(--sys-border);border-radius:8px;background:var(--sys-card);color:var(--sys-fg);font:inherit;font-weight:600;text-decoration:none;white-space:nowrap;cursor:pointer;}
:is(body.tmpl-error, body.tmpl-offline) .sys-button:hover {border-color:var(--sys-muted);}
:is(body.tmpl-error, body.tmpl-offline) .sys-button-primary {border-color:var(--sys-primary);background:var(--sys-primary);color:var(--sys-on-primary);}
:is(body.tmpl-error, body.tmpl-offline) .sys-button-primary:hover {opacity:0.9;border-color:var(--sys-primary);}

/* --- Error page (body.tmpl-error) --- */
body.tmpl-error {display:grid;place-items:center;padding:24px 16px;}
body.tmpl-error .sys-page {width:100%;max-width:560px;}
body.tmpl-error .sys-site {margin:0;font-size:14px;font-weight:600;}
body.tmpl-error .sys-site a {color:var(--sys-muted);text-decoration:none;}
body.tmpl-error .sys-site a:hover {color:var(--sys-fg);}
body.tmpl-error .sys-code {margin:20px 0 4px;font-size:clamp(56px, 16vw, 96px);line-height:1;font-weight:800;letter-spacing:-0.04em;font-variant-numeric:tabular-nums;}
body.tmpl-error .sys-text {margin:0 0 28px;color:var(--sys-muted);}
body.tmpl-error .sys-search {margin:0 0 24px;}
body.tmpl-error .sys-search-row {display:flex;gap:8px;}
body.tmpl-error .sys-search-row input {flex:1;min-width:0;}
body.tmpl-error .sys-actions {display:flex;flex-wrap:wrap;gap:8px;margin:0;}
body.tmpl-error .sys-reference {margin:28px 0 0;padding-top:16px;border-top:1px solid var(--sys-border);color:var(--sys-muted);font-size:13px;overflow-wrap:anywhere;}
body.tmpl-error .sys-details {margin:28px 0 0;padding-top:16px;border-top:1px solid var(--sys-border);font-size:13px;overflow-wrap:anywhere;}
body.tmpl-error .sys-details summary {font-weight:600;cursor:pointer;}
body.tmpl-error .sys-details table {display:block;max-width:100%;overflow-x:auto;border-collapse:collapse;font-size:12px;}
body.tmpl-error .sys-details td,
body.tmpl-error .sys-details th {padding:4px 6px;border:1px solid var(--sys-border);text-align:start;vertical-align:top;}

@media (max-width:480px) {
    body.tmpl-error .sys-card {padding:28px 20px;border-radius:12px;}
    body.tmpl-error .sys-search-row {flex-wrap:wrap;}
    body.tmpl-error .sys-search-row input {flex-basis:100%;}
    body.tmpl-error .sys-search-row .sys-button {flex:1;}
}

/* --- Offline page (body.tmpl-offline) --- */
body.tmpl-offline .sys-split {display:grid;grid-template-columns:3fr 2fr;min-height:100vh;}
body.tmpl-offline .sys-brand {display:flex;align-items:center;justify-content:center;padding:48px;background:linear-gradient(135deg, #1e293b 0%, #0f172a 55%, #312e81 100%);color:#fff;}
body.tmpl-offline .sys-brand-inner {width:100%;max-width:460px;}
body.tmpl-offline .sys-brand-image {display:block;width:auto;max-width:220px;height:auto;max-height:120px;margin:0 0 24px;}
body.tmpl-offline .sys-brand-name {margin:0;font-size:clamp(28px, 4vw, 42px);line-height:1.15;font-weight:800;letter-spacing:-0.02em;overflow-wrap:anywhere;}
body.tmpl-offline .sys-brand-message {margin:16px 0 0;font-size:17px;color:rgba(255, 255, 255, 0.85);}
body.tmpl-offline .sys-login {display:flex;align-items:center;justify-content:center;padding:48px 24px;}
body.tmpl-offline .sys-login .sys-card {width:100%;max-width:400px;}
body.tmpl-offline .sys-title {margin-bottom:20px;}
body.tmpl-offline .sys-field {margin:0 0 16px;}
body.tmpl-offline .sys-field:last-of-type {margin:24px 0 0;}
body.tmpl-offline .sys-field .sys-button {width:100%;}
body.tmpl-offline #system-message-container {margin:0;padding:0;}
body.tmpl-offline #system-message-container .alert {position:relative;margin:0 0 20px;padding:10px 36px 10px 14px;border:1px solid var(--sys-border);border-radius:8px;background:var(--sys-bg);font-size:14px;text-align:start;}
body.tmpl-offline #system-message-container :is(.alert-error, .alert-danger, .alert-warning) {border-color:var(--sys-danger);color:var(--sys-danger);}
body.tmpl-offline #system-message-container .alert-heading {margin:0 0 4px;font-size:14px;}
body.tmpl-offline #system-message-container .alert p,
body.tmpl-offline #system-message-container .alert-message {margin:0;}
body.tmpl-offline #system-message-container .close {position:absolute;top:6px;inset-inline-end:10px;color:inherit;font-size:20px;line-height:1;text-decoration:none;}

@media (max-width:900px) {
    body.tmpl-offline .sys-split {grid-template-columns:1fr;grid-template-rows:auto 1fr;}
    body.tmpl-offline .sys-brand {padding:40px 24px;text-align:center;}
    body.tmpl-offline .sys-brand-image {margin:0 auto 20px;}
    body.tmpl-offline .sys-login {align-items:flex-start;padding:32px 16px 48px;}
}

@media (max-width:480px) {
    body.tmpl-offline .sys-login .sys-card {padding:28px 20px;border-radius:12px;}
}
