body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ---------------------------------------------------------------------------
   Persian typography.
   Segoe UI has weak Persian coverage; Vazirmatn is the de-facto UI font for
   Persian and Tahoma is the universally available fallback on Windows. Applied
   on the html element so it inherits everywhere including form controls.
   --------------------------------------------------------------------------- */
html[lang="fa"] body,
html[lang="fa"] .form-control,
html[lang="fa"] .form-select,
html[lang="fa"] .btn,
html[lang="fa"] .navbar-brand {
    font-family: Vazirmatn, 'Segoe UI', Tahoma, 'Iranian Sans', sans-serif;
}

/* Persian text has taller ascenders/descenders than Latin; a slightly looser
   line height keeps table rows and multi-line labels from looking cramped. */
html[lang="fa"] body {
    line-height: 1.75;
}

/* ---------------------------------------------------------------------------
   List item styling.
   Every <ul> in the app is a Bootstrap component (nav-tabs, pagination,
   navbar, dropdown) plus the group tree, so each <li> family is styled
   explicitly instead of relying on one generic rule.
   --------------------------------------------------------------------------- */

/* Generic content lists (any plain <ul> added later) */
main ul {
    padding-left: 1.25rem;
    margin-bottom: 0.75rem;
}

main li {
    margin: 0.35rem 0;
    padding-left: 0.15rem;
    line-height: 1.55;
}

main ul:not(.nav):not(.navbar-nav):not(.dropdown-menu):not(.pagination):not(.list-unstyled):not(.breadcrumb) > li::marker {
    color: #6c757d;
}

main ul ul {
    margin-top: 0.35rem;
    margin-bottom: 0.35rem;
    padding-left: 1.1rem;
    border-left: 2px solid #e9ecef;
}

main ul ul > li::marker {
    color: #adb5bd;
}

/* --- Tabs (.nav-tabs > .nav-item) --- */
.nav-tabs .nav-item {
    margin-bottom: -1px;
}

.nav-tabs .nav-item .nav-link {
    border: 1px solid transparent;
    border-top-left-radius: 0.375rem;
    border-top-right-radius: 0.375rem;
    color: #6c757d;
    font-size: 0.925rem;
    padding: 0.5rem 0.9rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out,
                border-color 0.15s ease-in-out;
}

.nav-tabs .nav-item .nav-link:hover {
    background-color: #f1f3f5;
    border-color: #e9ecef #e9ecef transparent;
    color: #0d6efd;
}

.nav-tabs .nav-item .nav-link.active {
    background-color: #fff;
    border-color: #dee2e6 #dee2e6 #fff;
    color: #212529;
    font-weight: 600;
}

.nav-tabs .nav-item .nav-link i {
    margin-right: 0.35rem;
}

/* --- Pagination (.pagination > .page-item) --- */
.pagination .page-item {
    margin: 0 0.125rem;
}

.pagination .page-item .page-link {
    border-radius: 0.375rem;
    min-width: 2.25rem;
    text-align: center;
    color: #495057;
    transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out;
}

.pagination .page-item .page-link:hover {
    background-color: #e9ecef;
    color: #0d6efd;
}

.pagination .page-item.active .page-link {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
    font-weight: 600;
}

.pagination .page-item.disabled .page-link {
    color: #adb5bd;
}

/* --- Navbar + dropdown items --- */
.navbar-nav > .nav-item {
    margin: 0;
}

.dropdown-menu > li {
    margin: 0;
    padding: 0;
}

.dropdown-menu > li > .dropdown-item {
    border-radius: 0.25rem;
    margin: 0.125rem 0.25rem;
    padding: 0.375rem 0.75rem;
    transition: background-color 0.15s ease-in-out;
}

.dropdown-menu > li > .dropdown-item:hover,
.dropdown-menu > li > .dropdown-item:focus {
    background-color: #e7f1ff;
    color: #0a58ca;
}

.dropdown-menu > li > .dropdown-divider {
    margin: 0.25rem 0;
}

/* --- Group tree nodes (.tree-view li) --- */
.tree-view ul {
    list-style-type: none;
    padding-left: 20px;
    margin: 0;
}

.tree-view li {
    margin: 4px 0;
    padding: 0.2rem 0.4rem;
    position: relative;
    border-radius: 0.375rem;
    transition: background-color 0.15s ease-in-out;
}

.tree-view li:hover {
    background-color: #f1f3f5;
}

.tree-view li:before {
    content: "";
    position: absolute;
    top: -10px;
    left: -15px;
    border-top: 1px solid #ccc;
    width: 15px;
}

.tree-view li:last-child:before {
    border-color: transparent;
}

.tree-view li a {
    color: #212529;
    font-weight: 500;
}

.tree-view li a:hover {
    color: #0d6efd;
    text-decoration: underline;
}

/* Unstyled lists keep no markers or indentation */
.list-unstyled > li {
    margin: 0;
    padding-left: 0;
}

.nav-link.active {
    font-weight: 600;
}

.credential-status {
    font-size: 0.75rem;
}

.secret-display {
    font-family: 'Courier New', monospace;
    word-break: break-all;
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.alert-secret {
    background-color: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

/* ---------------------------------------------------------------------------
   RTL adjustments.
   Bootstrap's RTL build mirrors the grid and the *-start/*-end utilities, but the
   group tree draws its connector lines with physical left/right offsets, and the
   tab icon spacing is written in physical terms. Those need explicit overrides.
   --------------------------------------------------------------------------- */

/* Group tree: the connector elbow is drawn on the inline-start side, which is the
   right edge in RTL. Mirror the geometry rather than the whole tree. */
[dir="rtl"] .tree-view ul {
    padding-left: 0;
    padding-right: 20px;
}

[dir="rtl"] .tree-view li:before {
    left: auto;
    right: -15px;
}

/* Tab icons sit before the label; in RTL the gap belongs on the other side. */
[dir="rtl"] .nav-tabs .nav-item .nav-link i {
    margin-right: 0;
    margin-left: 0.35rem;
}

/* Pagination and badges inside the group tree keep their logical order thanks to
   the RTL stylesheet, but the numeric page links read more naturally with a
   mirrored arrow set — nothing to do beyond the physical offsets above. */

/* Secrets are opaque tokens: keep them LTR even inside an RTL page, otherwise
   bidi reordering can visually shuffle characters and mislead a reader copying
   the value by hand. */
[dir="rtl"] .secret-display {
    direction: ltr;
    text-align: left;
}

/* URLs, IP addresses and identifiers are also LTR-only content. */
[dir="rtl"] code,
[dir="rtl"] .text-monospace {
    direction: ltr;
    unicode-bidi: embed;
}

