﻿/* --------------------------------------------------
   Root variables & base
-------------------------------------------------- */
@font-face {
    font-family: 'Inter';
    src: url('~/fonts/inter.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Roboto';
    src: url('~/fonts/roboto.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Noto Sans Arabic';
    src: url('~/fonts/noto-sans-arabic.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Montserrat';
    src: url('~/fonts/montserrat.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Allura';
    src: url('~/fonts/allura.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Advent-pro';
    src: url('~/fonts/advent-pro.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Agdasima';
    src: url('~/fonts/agdasima.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Adlam';
    src: url('~/fonts/adlam.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}


/* ... all your existing @font-face blocks unchanged ... */

:root {
    --accent-color: #0d6efd;
    --accent-button: #0d6efd;
    --sidebar-width: 260px;
    --header-height: 56px;
    --app-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --app-font-size: 0.95rem;
}

html, body {
    height: 100%;
}

body {
    font-family: var(--app-font-family);
    font-size: var(--app-font-size);
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    overflow-x: hidden;
    transition: background-color .25s ease, color .25s ease;
}

/* Accent helpers */
.accent {
    color: var(--accent-color) !important;
}

.bg-accent {
    background-color: var(--accent-color) !important;
}

/* Links */
a {
    text-decoration: none;
}

    a:hover {
        text-decoration: none;
    }

/* Shadows */
.shadow-soft {
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 999px;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
}

/* --------------------------------------------------
   Layout shell
-------------------------------------------------- */

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Header */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bs-body-bg);
    border-bottom: 1px solid rgba(0, 0, 0, .08);
    z-index: 1040;
}

.header-row {
    min-height: var(--header-height);
}

.header-left {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}

/* Header logo container */
.header-logo {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}

/* Generic company logo for all companies */
.logo-img {
    max-height: 32px; /* main control for header logo size */
    width: auto; /* preserve aspect ratio */
    object-fit: contain; /* avoid distortion / safe crop */
    display: block;
}

/* Slightly smaller on very small screens */
@media (max-width: 575.98px) {
    .logo-img {
        max-height: 26px;
    }

    .header-toolbar {
        column-gap: .35rem;
    }

    .header-logo span {
        display: none;
    }
}

/* Toolbar with normalized spacing */
.header-toolbar {
    display: inline-flex;
    align-items: center;
    column-gap: .5rem;
    row-gap: .35rem;
}

    .header-toolbar > * {
        margin: 0;
    }

    .header-toolbar .btn,
    .header-toolbar .btn-icon,
    .header-toolbar .btn-user {
        margin: 0;
    }

/* Icon-only button */
.btn-icon {
    --btn-size: 34px;
    width: var(--btn-size);
    height: var(--btn-size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,.08);
    background: rgba(255,255,255,.02);
    transition: background .15s ease, border-color .15s ease;
}

    .btn-icon:hover {
        background: rgba(255,255,255,.06);
    }

[data-bs-theme="dark"] .btn-icon {
    border-color: rgba(255,255,255,.08);
}

/* Notification tiny dot */
.badge-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
}

/* User button */
.btn-user {
    height: 34px;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,.08);
    background: rgba(255,255,255,.02);
    padding: 0 .5rem;
}

    .btn-user:hover {
        background: rgba(255,255,255,.06);
    }

[data-bs-theme="dark"] .btn-user {
    border-color: rgba(255,255,255,.08);
}

/* Theme toggle ring */
.theme-toggle {
    border-radius: 999px !important;
}

/* Hide layout density menu on < lg */
@media (max-width: 991.98px) {
    .layout-density {
        display: none !important;
    }
}

/* Header toggle button (desktop collapse) */
#layoutSidebarToggle {
    border-radius: 10px;
}

    #layoutSidebarToggle:hover {
        background: rgba(255,255,255,.06);
    }

/* Avatar image */
.avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6f42c1, #0d6efd);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--app-font-size);
    font-weight: 600;
}

.avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    display: inline-block;
    background: #e9ecef;
}

/* Page loader bar */
#pageLoaderBar {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0;
    background: var(--accent-color);
    z-index: 9999;
    transition: width .3s ease, opacity .5s ease;
}

/* Sidebar */
.app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--sidebar-width);
    background: var(--bs-body-bg);
    border-right: 1px solid rgba(0, 0, 0, .08);
    padding-top: var(--header-height);
    transform: translateX(0);
    transition: transform 0.25s ease;
    z-index: 1030;
}

    .app-sidebar.collapsed {
        transform: translateX(-100%);
    }

.sidebar-header {
    padding: .75rem 1rem;
}

.sidebar-search .form-control {
    border-radius: 999px;
    padding-left: 2rem;
    /*font-size: .85rem;*/
    font-size: var(--app-font-size);
}

.sidebar-search .bi-search {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    /*font-size: .9rem;*/
    font-size: var(--app-font-size);
    opacity: .6;
}

/* Sidebar menu structure */
.sidebar-menu {
    padding: 0.25rem 0.75rem 1rem 0.75rem;
    overflow-y: auto;
    max-height: calc(100vh - var(--header-height) - 112px);
}

    /* Only style ULs and LI items inside .sidebar-menu */
    .sidebar-menu ul {
        list-style: none;
        padding-left: 0;
        margin-bottom: 0;
    }

    /* Animate only actual menu items with data-key (not group headers) */
    .sidebar-menu li[data-key] {
        margin-bottom: .125rem;
        opacity: 0;
        transform: translateX(-10px);
        animation: slideIn .35s ease forwards;
    }

        .sidebar-menu li[data-key]:nth-child(1) {
            animation-delay: .02s;
        }

        .sidebar-menu li[data-key]:nth-child(2) {
            animation-delay: .04s;
        }

        .sidebar-menu li[data-key]:nth-child(3) {
            animation-delay: .06s;
        }

        .sidebar-menu li[data-key]:nth-child(4) {
            animation-delay: .08s;
        }

        .sidebar-menu li[data-key]:nth-child(5) {
            animation-delay: .10s;
        }

@keyframes slideIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Links inside sidebar items */
.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .75rem;
    border-radius: .5rem;
    color: inherit;
    text-decoration: none;
    /*font-size: .9rem;*/
    font-size: var(--app-font-size);
    transition: background-color .15s ease, color .15s ease, transform .1s ease;
}

    .sidebar-menu a .icon {
        width: 1.2rem;
        text-align: center;
        opacity: .9;
    }

    .sidebar-menu a:hover {
        background-color: rgba(0, 0, 0, .05);
        transform: translateX(2px);
    }

    .sidebar-menu a.active {
        background-color: rgba(13, 110, 253, .10);
        color: var(--accent-color);
        font-weight: 500;
    }

[data-bs-theme="dark"] .sidebar-menu a:hover {
    background-color: rgba(255, 255, 255, .05);
}

/* Favorites pin */
.menu-pin {
    margin-left: auto;
    cursor: pointer;
    opacity: .4;
    transition: opacity .15s ease, transform .1s ease;
}

    .menu-pin:hover {
        transform: scale(1.1);
    }

    .menu-pin.active {
        color: #ffc107;
        opacity: 1;
    }

/* Search filter helper */
.menu-item-hidden {
    display: none !important;
}

/* Sidebar footer color panel */
.sidebar-footer {
    border-top: 1px solid rgba(0, 0, 0, .08);
    padding: .75rem 1rem 1rem 1rem;
    /*font-size: .8rem;*/
    font-size: var(--app-font-size);
}

.color-dot {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 2px solid transparent;
    cursor: pointer;
    display: inline-block;
    margin-right: .25rem;
}

    .color-dot.active {
        border-color: #212529;
    }

[data-bs-theme="dark"] .color-dot.active {
    border-color: #f8f9fa;
}

/* Content area */
.app-content {
    margin-top: var(--header-height);
    margin-left: var(--sidebar-width);
    padding: 1rem 1.25rem 1.5rem 1.25rem;
    flex: 1;
    transition: margin-left .25s ease;
}

    .app-content.sidebar-collapsed {
        margin-left: 0;
    }

/* Mobile overlay */
@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

        .app-sidebar.expanded {
            transform: translateX(0);
        }

    .app-content {
        margin-left: 0;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.35);
        backdrop-filter: blur(1px);
        z-index: 1025;
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
    }

    .app-sidebar.expanded + .sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }
}

/* --------------------------------------------------
   Sidebar groups & Favorites
-------------------------------------------------- */

.sidebar-group {
    margin-bottom: .25rem;
}

/* Group header */
.sidebar-group-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .4rem .75rem;
    border: 0;
    background: transparent;
    color: inherit;
    border-radius: .5rem;
    cursor: pointer;
    /*font-size: .85rem;*/
    font-size: var(--app-font-size);
    transition: background .15s ease, color .15s ease;
}

    .sidebar-group-toggle .icon {
        width: 1.2rem;
        text-align: center;
        opacity: .85;
    }

    .sidebar-group-toggle:hover {
        background: rgba(0,0,0,.04);
    }

[data-bs-theme="dark"] .sidebar-group-toggle:hover {
    background: rgba(255,255,255,.06);
}

/* Chevrons */
.sidebar-group-toggle .bi-chevron-down,
.sidebar-group-toggle .bi-chevron-up {
    transition: transform .2s ease;
}

.sidebar-group-toggle.open .bi-chevron-down,
.sidebar-group-toggle.open .bi-chevron-up {
    transform: rotate(180deg);
}

/* Inner list with smooth height animation */
.sidebar-group-items {
    list-style: none;
    padding-left: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-4px);
    transition: max-height .25s ease, opacity .2s ease, transform .2s ease;
}

    .sidebar-group-items.show {
        opacity: 1;
        transform: translateY(0);
        max-height: 800px;
    }

/* Favorites group highlight */
#favoritesGroup {
    margin-bottom: .35rem;
}

    #favoritesGroup .sidebar-group-toggle {
        background: color-mix(in oklab, var(--accent-color) 10%, transparent);
    }

[data-bs-theme="dark"] #favoritesGroup .sidebar-group-toggle {
    background: color-mix(in oklab, var(--accent-color) 18%, transparent);
}

/* Favorite pinned separator (in main list) */
.sidebar-menu ul.pinned-split > li.pinned-last {
    position: relative;
}

    .sidebar-menu ul.pinned-split > li.pinned-last::after {
        content: "";
        position: absolute;
        left: .5rem;
        right: .5rem;
        bottom: -6px;
        height: 1px;
        background: rgba(0,0,0,.08);
    }

[data-bs-theme="dark"] .sidebar-menu ul.pinned-split > li.pinned-last::after {
    background: rgba(255,255,255,.08);
}

/* --------------------------------------------------
   Notifications dropdown
-------------------------------------------------- */

.dropdown-menu-notifications {
    max-height: 320px;
    overflow-y: auto;
    /*font-size: .8rem;*/
    font-size: var(--app-font-size);
}

/* --------------------------------------------------
   Command palette modal
-------------------------------------------------- */

#globalSearchModal .modal-content {
    border-radius: .75rem;
}

#globalSearchModal .input-group .form-control {
    border-radius: 0 .5rem .5rem 0;
}

#globalSearchModal .input-group .input-group-text {
    border-radius: .5rem 0 0 .5rem;
}

#globalSearchResults .result-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem .6rem;
    border-radius: .5rem;
    cursor: pointer;
}

    #globalSearchResults .result-item:hover {
        background: rgba(0,0,0,.04);
    }

[data-bs-theme="dark"] #globalSearchResults .result-item:hover {
    background: rgba(255,255,255,.06);
}

#globalSearchResults .result-item .icon {
    width: 1.1rem;
    text-align: center;
    opacity: .9;
}

#globalSearchResults .result-empty {
    color: var(--bs-secondary-color, #6c757d);
    /*font-size: .9rem;*/
    font-size: var(--app-font-size);
}

/* --------------------------------------------------
   Forms / inputs / buttons
-------------------------------------------------- */

.form-control,
.form-select {
    border-radius: .6rem;
}

    .form-control:focus,
    .form-select:focus,
    .btn-check:focus + .btn,
    .btn:focus {
        box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, .25);
    }

.btn {
    border-radius: .6rem;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 25px rgba(13, 110, 253, .30);
}

/* Accent B filled button */
.btn-accent {
    --btn-bg: var(--accent-button);
    --btn-color: #fff;
    color: var(--btn-color);
    background: var(--btn-bg);
    border: 1px solid color-mix(in oklab, var(--btn-bg) 85%, black 15%);
    box-shadow: 0 6px 18px color-mix(in oklab, var(--btn-bg) 30%, transparent);
}

    .btn-accent:hover {
        background: color-mix(in oklab, var(--btn-bg) 92%, black 8%);
        border-color: color-mix(in oklab, var(--btn-bg) 90%, black 10%);
    }

    .btn-accent:focus,
    .btn-accent:active {
        background: color-mix(in oklab, var(--btn-bg) 88%, black 12%);
        border-color: color-mix(in oklab, var(--btn-bg) 95%, black 5%);
        box-shadow: 0 0 0 0.2rem color-mix(in oklab, var(--btn-bg) 35%, transparent);
    }

/* --------------------------------------------------
   Cards / tables
-------------------------------------------------- */

.card {
    border-radius: .8rem;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

[data-bs-theme="dark"] .card {
    border-color: rgba(255, 255, 255, 0.08);
}

.table {
    font-size: var(--app-font-size);
}

    .table thead th {
        border-bottom-width: 1px;
        text-transform: uppercase;
        /*font-size: .7rem;*/
        font-size: var(--app-font-size);
        letter-spacing: .05em;
    }

.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(0, 0, 0, .01);
}

[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(255, 255, 255, .02);
}

/* --------------------------------------------------
   Density modes
-------------------------------------------------- */

/* --- Compact Layout Styles --- */
/* =========================
   Compact Layout Styles
   body.layout-compact
   ========================= */

/* Sidebar Menu Links */
/* --- Compact Layout Variables --- */
body.layout-compact {
    --compact-padding-y: 0.35rem;
    --compact-padding-card: 0.5rem 1rem;
    --compact-font-scale: 0.875; /* relative to --app-font-size */
    --compact-btn-padding: 0.25rem 0.5rem;
}

    /* --- Sidebar & Nav --- */
    body.layout-compact .sidebar-menu a,
    body.layout-compact .nav-link,
    body.layout-compact .breadcrumb-item {
        padding-top: var(--compact-padding-y);
        padding-bottom: var(--compact-padding-y);
        font-size: calc(var(--app-font-size) * var(--compact-font-scale));
    }

    body.layout-compact .sidebar-menu h5,
    body.layout-compact .sidebar-menu .sidebar-section-title {
        margin-bottom: 0.25rem;
        font-size: calc(var(--app-font-size) * 0.9);
    }

    /* --- App Content --- */
    body.layout-compact .app-content {
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }

    /* --- Cards & Panels --- */
    body.layout-compact .card,
    body.layout-compact .panel {
        margin-bottom: 0.75rem;
        padding: var(--compact-padding-card);
    }

    body.layout-compact .card-body,
    body.layout-compact .panel-body {
        padding: 0.5rem 0.75rem;
    }

    /* --- Buttons --- */
    body.layout-compact .btn {
        padding: var(--compact-btn-padding);
        font-size: calc(var(--app-font-size) * var(--compact-font-scale));
    }

    /* --- Form Controls --- */
    body.layout-compact .form-control,
    body.layout-compact .form-select,
    body.layout-compact .input-group-text,
    body.layout-compact .form-check-label {
        padding-top: 0.25rem;
        padding-bottom: 0.25rem;
        font-size: calc(var(--app-font-size) * var(--compact-font-scale));
    }

    /* --- Tables --- */
    body.layout-compact table th,
    body.layout-compact table td {
        padding-top: 0.25rem;
        padding-bottom: 0.25rem;
        font-size: calc(var(--app-font-size) * var(--compact-font-scale));
    }

    /* --- Headings & Paragraphs --- */
    body.layout-compact h1,
    body.layout-compact h2,
    body.layout-compact h3,
    body.layout-compact h4,
    body.layout-compact h5,
    body.layout-compact h6,
    body.layout-compact p {
        margin-top: 0.25rem;
        margin-bottom: 0.25rem;
    }

    /* --- Lists --- */
    body.layout-compact ul,
    body.layout-compact ol {
        margin-bottom: 0.5rem;
        padding-left: 1.25rem;
    }

    /* --- Alerts / Badges / Chips --- */
    body.layout-compact .alert,
    body.layout-compact .badge,
    body.layout-compact .chip {
        padding: 0.25rem 0.5rem;
        font-size: calc(var(--app-font-size) * 0.85);
    }

    /* --- Modals --- */
    body.layout-compact .modal-body {
        padding: 0.5rem 0.75rem;
    }

    /* --- Navbar Items --- */
    body.layout-compact .navbar .nav-link,
    body.layout-compact .navbar .dropdown-item {
        padding-top: 0.25rem;
        padding-bottom: 0.25rem;
        font-size: calc(var(--app-font-size) * var(--compact-font-scale));
    }

    /* --- Tooltips / Popovers --- */
    body.layout-compact .tooltip-inner,
    body.layout-compact .popover-body {
        font-size: calc(var(--app-font-size) * 0.85);
    }

    /* --- Spacing Reductions --- */
    body.layout-compact .mb-3 {
        margin-bottom: 0.5rem !important;
    }

    body.layout-compact .mb-2 {
        margin-bottom: 0.25rem !important;
    }



/* --------------------------------------------------
   Utilities
-------------------------------------------------- */

.page-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

    .page-title h1,
    .page-title h2 {
        /*font-size: 1.3rem;*/
        font-size: var(--app-font-size);
        font-weight: 600;
    }

.badge-soft {
    background-color: rgba(15, 23, 42, 0.06);
    color: inherit;
}

[data-bs-theme="dark"] .badge-soft {
    background-color: rgba(255, 255, 255, 0.06);
}

.tag-pill {
    border-radius: 999px;
    padding: .15rem .55rem;
    /*font-size: .7rem;*/
    font-size: var(--app-font-size);
    text-transform: uppercase;
    letter-spacing: .06em;
}

/* Footer */
.app-footer {
    /*font-size: 0.8rem;*/
    font-size: var(--app-font-size);
    color: var(--bs-secondary-color, #6c757d);
}

    .app-footer a {
        /*font-size: 0.8rem;*/
        font-size: var(--app-font-size);
    }

.ai-logo {
    width: 18px;
    height: 18px;
    object-fit: contain;
    display: inline-block;
    opacity: 0.9;
}

.ai-logo-icon {
    /*font-size: 1rem;*/
    font-size: var(--app-font-size);
    opacity: 0.9;
}

/* --------------------------------------------------
   RTL helpers
-------------------------------------------------- */

/* Mirror sidebar + content */
[dir="rtl"] .app-sidebar {
    left: auto;
    right: 0;
    border-right: none;
    border-left: 1px solid rgba(0, 0, 0, .08);
}

[dir="rtl"] .app-content {
    margin-left: 0;
    margin-right: var(--sidebar-width);
}

    /* Collapsed state */
    [dir="rtl"] .app-content.sidebar-collapsed {
        margin-right: 0;
    }

/* Mobile: slide sidebar from the right */
@media (max-width: 991.98px) {
    [dir="rtl"] .app-sidebar {
        transform: translateX(100%);
    }

        [dir="rtl"] .app-sidebar.expanded {
            transform: translateX(0);
        }

    [dir="rtl"] .app-content {
        margin-right: 0;
    }
}

/* Sidebar links: icon and text order */
[dir="rtl"] .sidebar-menu a {
    flex-direction: row-reverse;
}

    [dir="rtl"] .sidebar-menu a .icon {
        text-align: center;
    }

/* Group header in RTL - keep DOM order, mirror spacing & chevron/pin */
[dir="rtl"] .sidebar-group-toggle {
    padding-left: .75rem;
    padding-right: .75rem;
}

    /* Group icon spacing in RTL */
    [dir="rtl"] .sidebar-group-toggle .icon {
        margin-right: 0;
        margin-left: .25rem;
    }

    /* Chevron on the far left in RTL */
    [dir="rtl"] .sidebar-group-toggle .bi-chevron-down,
    [dir="rtl"] .sidebar-group-toggle .bi-chevron-up {
        margin-left: 0;
        margin-right: auto;
    }

/* Pin icon moves to left in RTL */
[dir="rtl"] .menu-pin {
    margin-left: 0;
    margin-right: auto;
}

/* RTL: sidebar group items list padding */
[dir="rtl"] .sidebar-group-items {
    padding-left: 0;
    padding-right: 0;
}

/* Optional: slide-in animation from the sidebar side in RTL */
@keyframes slideInRtl {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

[dir="rtl"] .sidebar-group-items li[data-key] {
    transform: translateX(10px);
    animation-name: slideInRtl;
}

/* Tabs status dot alignment in RTL */
[dir="rtl"] .tabs-nav .tab-link .tab-status-dot {
    margin-left: 0;
    margin-right: auto;
}

/* --------------------------------------------------
   Tabs (pill cards + glow)
-------------------------------------------------- */

.tabs-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    background: var(--bs-body-bg);
    padding: 10px 12px;
    border-radius: 14px;
}

    .tabs-nav .tab-link {
        position: relative;
        display: inline-flex;
        align-items: center;
        gap: 10px;
        padding: 12px 18px;
        border-radius: 12px;
        color: var(--bs-body-color);
        text-decoration: none;
        border: 1px solid rgba(255, 255, 255, 0.06);
        background: rgba(255, 255, 255, 0.02);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 2px 12px rgba(0, 0, 0, 0.18);
        transition: background .2s ease, color .2s ease, box-shadow .2s ease, transform .06s ease;
    }

        .tabs-nav .tab-link .bi,
        .tabs-nav .tab-link .fa,
        .tabs-nav .tab-link i {
            width: 18px;
            text-align: center;
            opacity: 0.9;
            /*font-size: 0.95rem;*/
            font-size: var(--app-font-size);
        }

        /* Underline base */
        .tabs-nav .tab-link::after {
            content: "";
            position: absolute;
            left: 14px;
            right: 14px;
            bottom: 6px;
            height: 3px;
            background: transparent;
            border-radius: 999px;
            box-shadow: none;
            transition: background .2s ease, box-shadow .2s ease;
        }

        /* Hover */
        .tabs-nav .tab-link:hover {
            background: rgba(255, 255, 255, 0.06);
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 4px 16px rgba(0, 0, 0, 0.22);
            transform: translateY(-1px);
            color: var(--accent-color);
        }

            .tabs-nav .tab-link:hover::after {
                background: color-mix(in oklab, var(--accent-color) 70%, transparent);
                box-shadow: 0 0 6px color-mix(in oklab, var(--accent-color) 45%, transparent);
            }

        /* Active */
        .tabs-nav .tab-link.active {
            color: var(--accent-color);
            background: color-mix(in oklab, var(--accent-color) 10%, transparent);
            border-color: color-mix(in oklab, var(--accent-color) 25%, transparent);
            font-weight: 600;
        }

            .tabs-nav .tab-link.active::after {
                background: var(--accent-color);
                box-shadow: 0 0 8px color-mix(in oklab, var(--accent-color) 55%, transparent);
            }

/* Dark tweaks */
[data-bs-theme="dark"] .tabs-nav .tab-link {
    border-color: rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
}

    [data-bs-theme="dark"] .tabs-nav .tab-link:hover {
        background: rgba(255, 255, 255, 0.07);
    }

/* Compact density */
body.layout-compact .tabs-nav .tab-link {
    padding: 9px 14px;
    border-radius: 10px;
}

/* Responsive */
@media (max-width: 991.98px) {
    .tabs-nav {
        gap: 10px;
    }

        .tabs-nav .tab-link {
            padding: 10px 14px;
        }
}

@media (max-width: 575.98px) {
    .tabs-nav .tab-link {
        flex: 1 1 100%;
        justify-content: flex-start;
    }
}

/* Tabs status dots (LTR baseline) */
.tabs-nav .tab-link .tab-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    margin-left: auto;
    display: inline-block;
    background: transparent;
    box-shadow: none;
}

.tabs-nav .tab-link.is-dirty .tab-status-dot {
    background: #ffc107;
    box-shadow: 0 0 4px rgba(255, 193, 7, .7);
}

.tabs-nav .tab-link.has-error .tab-status-dot {
    background: #dc3545;
    box-shadow: 0 0 4px rgba(220, 53, 69, .7);
}

.tabs-nav .tab-link.is-complete .tab-status-dot {
    background: #198754;
    box-shadow: 0 0 4px rgba(25, 135, 84, .7);
}

/* Sticky tabs */
/*.sticky-tabs {
    position: sticky;
    top: calc(var(--header-height) + 6px);
    z-index: 1035;
    background: var(--bs-body-bg);
    padding-top: 6px;
    margin-top: -6px;
}*/
/* Sticky tabs – DISABLED: behave as normal block */
.sticky-tabs {
    position: static; /* instead of sticky */
    top: auto;
    z-index: auto;
    background: var(--bs-body-bg);
    padding-top: 6px;
    margin-top: -6px;
}

/* Tabs scroller */
.tabs-scroll-container {
    position: relative;
    overflow-x: auto;
    overflow-y: visible;
    padding-bottom: 4px;
}

    .tabs-scroll-container::after {
        content: "";
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 40px;
        pointer-events: none;
        background: linear-gradient(to right, transparent, var(--bs-body-bg));
        transition: opacity .2s ease;
    }

    .tabs-scroll-container.at-end::after {
        opacity: 0;
    }
/* SQL Console specific styles */

.sql-console-editor textarea.form-control {
    font-family: Consolas, "Fira Code", "Courier New", monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    background-color: #1e1e1e;
    color: #f5f5f5;
    border-radius: 4px;
    padding: 0.75rem;
}

    .sql-console-editor textarea.form-control:focus {
        outline: none;
        box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, .25);
    }

/* Scrollable result area with no wrap */
.sql-console-results {
    max-height: 400px; /* vertical size of the result box */
    overflow-y: auto; /* vertical scroll */
    overflow-x: auto; /* horizontal scroll for wide tables */
    width: 100%;
}

    .sql-console-results table {
        font-size: 0.85rem;
        white-space: nowrap; /* keep columns on one line */
        width: max-content; /* allow horizontal scroll if very wide */
        min-width: 100%;
    }


    .sql-console-results thead.sticky-top {
        top: 0;
        z-index: 1;
    }

.sql-console-badge-danger {
    background-color: #dc3545;
    color: #fff;
}

.sql-console-badge-ok {
    background-color: #28a745;
    color: #fff;
}
/* Limit editor width, center it */
/* Force SQL editor textarea to align left and not be centered */
.card.sql-console-editor .sql-console-editor-inner {
    max-width: 900px; /* or any width you prefer */
    width: 100%;
    margin-left: 0 !important;
    margin-right: 0 !important;
    text-align: left !important;
}

    /* Make textarea fill that left-aligned block */
    .card.sql-console-editor .sql-console-editor-inner textarea.form-control {
        display: block;
        width: 100%;
    }

/* --- SQL Tool / Console --- */

/* Editor text area look (you already use sql-console-editor on card) */
.sql-console-editor textarea.form-control {
    font-family: Consolas, "Fira Code", "Courier New", monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    background-color: #1e1e1e;
    color: #f5f5f5;
    border-radius: 4px;
    padding: 0.75rem;
}

/* Fixed-width editor aligned left inside its card */
.sql-console-editor-inner {
    max-width: 900px; /* adjust as you like */
    width: 100%;
    margin-left: 0;
    margin-right: 0;
}

/* Scrollable results with no-wrap */
.sql-console-results {
    max-height: 400px; /* vertical size of box */
    overflow-y: auto;
    overflow-x: auto;
    width: 100%;
}

    .sql-console-results table {
        font-size: 0.85rem;
        white-space: nowrap;
        width: max-content;
        min-width: 100%;
    }

/* --------------------------------------------------
   Print & motion
-------------------------------------------------- */

@media print {
    .app-header,
    .app-sidebar,
    .sidebar-overlay,
    .dropdown-menu,
    .btn,
    .tabs-nav {
        display: none !important;
    }

    .app-content {
        margin: 0 !important;
        padding: 0.25in !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}