/* =========================================================
   AROMA ERP — BRAND ICON IDENTITY
   Theme-adaptive outline and premium glass icon styles.
   ========================================================= */

:root {
    --aroma-icon-primary:
        var(--aroma-primary, #2f6fdf);

    --aroma-icon-secondary:
        var(--aroma-secondary, #1753a6);

    --aroma-icon-surface:
        color-mix(
            in srgb,
            var(--aroma-card-bg, #ffffff) 88%,
            var(--aroma-icon-primary) 12%
        );

    --aroma-icon-surface-hover:
        color-mix(
            in srgb,
            var(--aroma-card-bg, #ffffff) 80%,
            var(--aroma-icon-primary) 20%
        );

    --aroma-icon-border:
        color-mix(
            in srgb,
            var(--aroma-icon-primary) 28%,
            var(--aroma-border, #d7e1eb) 72%
        );

    --aroma-icon-glow:
        color-mix(
            in srgb,
            var(--aroma-icon-primary) 28%,
            transparent
        );

    --aroma-icon-radius: 12px;
}


/* =========================================================
   BASIC SVG ICON
   ========================================================= */

.aroma-brand-icon {
    width: 21px;
    height: 21px;

    min-width: 21px;
    min-height: 21px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 21px;

    color:
        var(--aroma-icon-primary);

    vertical-align:
        -.18em;

    pointer-events:
        none;

    transition:
        color 160ms ease,
        transform 160ms ease,
        opacity 160ms ease;
}

.aroma-brand-icon svg {
    width: 100%;
    height: 100%;

    display: block;

    fill: none;
    stroke: currentColor;

    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;

    overflow: visible;
}


/* =========================================================
   STYLE 1 — CLEAN OUTLINE
   Used in menus and compact actions.
   ========================================================= */

.aroma-icon-outline {
    color:
        currentColor;

    opacity:
        .9;
}

a:hover > .aroma-icon-outline,
button:hover > .aroma-icon-outline {
    opacity:
        1;

    transform:
        scale(1.07);
}


/* =========================================================
   STYLE 2 — PREMIUM GLASS TILE
   Used in dashboard cards and large modules.
   ========================================================= */

.aroma-icon-tile {
    width: 46px;
    height: 46px;

    min-width: 46px;
    min-height: 46px;

    flex: 0 0 46px;

    padding: 10px;

    color:
        var(--aroma-icon-primary);

    background:
        linear-gradient(
            145deg,
            color-mix(
                in srgb,
                var(--aroma-icon-surface) 92%,
                white 8%
            ),
            var(--aroma-icon-surface)
        );

    border:
        1px solid
        var(--aroma-icon-border);

    border-radius:
        var(--aroma-icon-radius);

    box-shadow:
        0 7px 20px
        var(--aroma-icon-glow),
        inset 0 1px 0
        rgba(255,255,255,.38);

    transition:
        color 170ms ease,
        background-color 170ms ease,
        border-color 170ms ease,
        box-shadow 170ms ease,
        transform 170ms ease;
}

:is(
    .quick-card,
    .product-card,
    .stat-card,
    .r-report-link,
    [class$="-card"]
):hover .aroma-icon-tile {
    background:
        var(--aroma-icon-surface-hover);

    border-color:
        color-mix(
            in srgb,
            var(--aroma-icon-primary) 52%,
            var(--aroma-border) 48%
        );

    box-shadow:
        0 10px 27px
        var(--aroma-icon-glow);

    transform:
        translateY(-2px)
        scale(1.025);
}


/* Larger dashboard tiles */

.aroma-icon-tile--large {
    width: 58px;
    height: 58px;

    min-width: 58px;
    min-height: 58px;

    flex-basis: 58px;

    padding: 13px;

    border-radius: 15px;
}


/* =========================================================
   MENUS
   ========================================================= */

:is(
    .aroma-system-header,
    .aroma-dropdown,
    nav,
    .sidebar,
    .menu
) a {
    position: relative;

    display: flex !important;
    align-items: center !important;
    gap: 11px !important;

    min-height: 43px;

    border-radius: 10px;

    transition:
        color 150ms ease,
        background-color 150ms ease,
        transform 150ms ease;
}

:is(
    .aroma-system-header,
    .aroma-dropdown,
    nav,
    .sidebar,
    .menu
) a > .aroma-brand-icon {
    width: 21px;
    height: 21px;

    min-width: 21px;
    min-height: 21px;

    flex-basis: 21px;
}


/* Active menu item */

:is(
    .aroma-dropdown,
    nav,
    .sidebar,
    .menu
) a.aroma-menu-active {
    color:
        var(--aroma-icon-primary) !important;

    font-weight:
        750;

    background:
        color-mix(
            in srgb,
            var(--aroma-icon-primary) 14%,
            transparent
        ) !important;
}

:is(
    .aroma-dropdown,
    nav,
    .sidebar,
    .menu
) a.aroma-menu-active::before {
    content: "";

    position: absolute;

    inset-block:
        8px;

    inset-inline-start:
        3px;

    width:
        3px;

    border-radius:
        999px;

    background:
        var(--aroma-icon-primary);

    box-shadow:
        0 0 9px
        var(--aroma-icon-glow);
}


/* Header menu uses white icons */

.aroma-system-header
.aroma-dropdown
a > .aroma-brand-icon {
    color:
        currentColor !important;
}


/* =========================================================
   BUTTONS
   ========================================================= */

:is(
    .button,
    .btn,
    button
) > .aroma-brand-icon {
    color:
        currentColor !important;

    width: 19px;
    height: 19px;

    min-width: 19px;
    min-height: 19px;

    flex-basis: 19px;
}


/* =========================================================
   MODULE COLOR ACCENTS
   Still adapt to the selected theme.
   ========================================================= */

[data-aroma-module="accounting"] {
    --aroma-module-accent:
        color-mix(
            in srgb,
            var(--aroma-icon-primary) 72%,
            #10b981 28%
        );
}

[data-aroma-module="sales"] {
    --aroma-module-accent:
        color-mix(
            in srgb,
            var(--aroma-icon-primary) 67%,
            #14b8a6 33%
        );
}

[data-aroma-module="inventory"] {
    --aroma-module-accent:
        color-mix(
            in srgb,
            var(--aroma-icon-primary) 72%,
            #6366f1 28%
        );
}

[data-aroma-module="manufacturing"] {
    --aroma-module-accent:
        color-mix(
            in srgb,
            var(--aroma-icon-primary) 66%,
            #f97316 34%
        );
}

[data-aroma-module="customers"] {
    --aroma-module-accent:
        color-mix(
            in srgb,
            var(--aroma-icon-primary) 68%,
            #8b5cf6 32%
        );
}

[data-aroma-module]
.aroma-brand-icon {
    color:
        var(
            --aroma-module-accent,
            var(--aroma-icon-primary)
        );
}


/* =========================================================
   DARK THEMES
   ========================================================= */

html[data-aroma-theme="1"],
html[data-aroma-theme="9"],
html[data-aroma-theme="10"],
html[data-aroma-theme="15"] {
    --aroma-icon-surface:
        color-mix(
            in srgb,
            var(--aroma-card-bg) 80%,
            var(--aroma-icon-primary) 20%
        );

    --aroma-icon-border:
        color-mix(
            in srgb,
            var(--aroma-icon-primary) 46%,
            var(--aroma-border) 54%
        );

    --aroma-icon-glow:
        color-mix(
            in srgb,
            var(--aroma-icon-primary) 40%,
            transparent
        );
}

html[data-aroma-theme="1"]
.aroma-icon-tile,
html[data-aroma-theme="10"]
.aroma-icon-tile,
html[data-aroma-theme="15"]
.aroma-icon-tile {
    box-shadow:
        0 9px 25px
        rgba(0,0,0,.34),
        0 0 17px
        var(--aroma-icon-glow),
        inset 0 1px 0
        rgba(255,255,255,.08);
}


/* =========================================================
   HIGH CONTRAST
   ========================================================= */

html[data-aroma-theme="9"] {
    --aroma-icon-primary: #ffff00;
    --aroma-icon-surface: #000000;
    --aroma-icon-border: #ffff00;
    --aroma-icon-glow: rgba(255,255,0,.42);
}

html[data-aroma-theme="9"]
.aroma-brand-icon svg {
    stroke-width: 2.4;
}

html[data-aroma-theme="9"]
.aroma-icon-tile {
    border-width: 2px;

    box-shadow:
        0 0 0 1px #000000,
        0 0 15px
        var(--aroma-icon-glow);
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 760px) {
    .aroma-icon-tile {
        width: 43px;
        height: 43px;

        min-width: 43px;
        min-height: 43px;

        flex-basis: 43px;

        padding: 9px;
    }

    .aroma-icon-tile--large {
        width: 52px;
        height: 52px;

        min-width: 52px;
        min-height: 52px;

        flex-basis: 52px;

        padding: 11px;
    }
}


/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    .aroma-brand-icon,
    .aroma-icon-tile {
        transition: none !important;
        transform: none !important;
    }
}

/* =========================================================
   AROMA ICON OVERLAP FIX
   ========================================================= */

.aroma-brand-icon {
    position: static !important;
    inset: auto !important;

    margin: 0 !important;

    flex-shrink: 0 !important;

    z-index: auto !important;

    transform-origin: center;
}

.aroma-brand-icon + .aroma-brand-icon,
.aroma-brand-icon ~ .aroma-svg-icon,
.aroma-brand-icon ~ .aroma-generated-icon {
    display: none !important;
}


/* حامل الأيقونة يحتوي رسمة واحدة فقط */

:is(
    .card-icon,
    .quick-icon,
    .stat-icon,
    .icon-box
) {
    position: relative;

    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    overflow: hidden;
}

:is(
    .card-icon,
    .quick-icon,
    .stat-icon,
    .icon-box
) > .aroma-brand-icon {
    width: 24px !important;
    height: 24px !important;

    min-width: 24px !important;
    min-height: 24px !important;

    flex: 0 0 24px !important;

    padding: 0 !important;

    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}


/* منع تراكب الأيقونة مع النص */

:is(
    .aroma-system-header a,
    .aroma-dropdown a,
    .button,
    .btn,
    button
) {
    isolation: isolate;
}

:is(
    .aroma-system-header a,
    .aroma-dropdown a,
    .button,
    .btn,
    button
) > .aroma-brand-icon {
    position: relative !important;

    margin-inline-end: 0 !important;

    flex: 0 0 auto !important;
}


/* إخفاء أي حاوية Emoji قديمة أصبحت فارغة */

:is(
    .aroma-system-header a,
    .aroma-dropdown a,
    .button,
    .btn,
    button
) > span:empty:not(.aroma-brand-icon) {
    display: none !important;
}
