@use "flags";

html {
    font-size: 1rem;
}

html,
body {
    width: 100%;
    height: 100%;
}

body {
    font-family: var(--bs-body-font-family, system-ui, -apple-system, sans-serif);
    font-size: 1rem;
    line-height: 1.42857143;
}

.modal-dialog {
    margin-right: auto;
    margin-left: auto;
}

.fs-7 {
    font-size: .875rem;
}

.offcanvas-item {
    border-bottom: 1px rgba(#000, .1) solid;

    &:first-child {
        border-top: 1px rgba(#000, .1) solid;
    }

    &:hover {
        background: #fafafa;
    }

    >a {
        color: var(--bs-secondary);
    }
}

.card-header h1, .page-password-reset .card h1, .page-login .card h1, .page-signup .card h1 {
    font-size: 1.25rem;
}

.card-body {
    @at-root table {
        >thead {
            >tr {
                >th {
                    font-size: 0.765625rem;
                    color: var(--bs-secondary);
                    font-weight: 600;
                    text-transform: uppercase;
                }
            }
        }

        >tbody {
            >tr {
                >td {
                    vertical-align: middle;
                }
            }
        }
    }
}

.svg-icon {
    height: 20px;
    width: 20px;
    fill: currentColor;
}

// Order management accordion
#orderManager {
    --bs-accordion-btn-icon: none;
    --bs-accordion-btn-active-icon: none;
}

// TomSelect dropdown
.ts-input {
    color: inherit;
}

.ts-wrapper {
    &.form-select {
        background-color: inherit;
    }

    .ts-control {
        font-size: 14px;
        width: 100%;
        color: inherit;

        &.locale {
            width: 205px;
        }

        .dropdown-menu {
            width: 100%;
            height: auto;
        }
    }

    .ts-dropdown {
        font-size: 14px;

        .active {
            background-color: rgba(var(--bs-secondary-rgb), 0.06);
            color: inherit;
        }

        .selected {
            background-color: rgba(var(--bs-secondary-rgb), 0.1);
        }
    }
}

@media (max-width: 768px) {
    .ts-wrapper.js-locale-selector {
        width: 180px
    }
}

.invoice-gateway {
    border: 1px solid var(--bs-border-color);

    &:hover {
        border: 1px solid var(--bs-primary);
    }
}

.fb-phone-country-code {
    width: 5.5rem;
    flex: 0 0 5.5rem;
    max-width: 5.5rem;
}

.email-list {
    border-radius: 0;

    .list-group-item {
        border: 0;
        border-bottom: 1px solid var(--bs-border-color);
        border-left: 2px solid transparent;

        &.active {
            border-left: 2px solid var(--bs-primary);
            background: rgba(var(--bs-primary-rgb), 0.1);
            color: var(--bs-dark);
        }
    }
}

// Badge text contrast fix - ensure white text on colored badges
.badge[class*="bg-"],
.badge[class*="text-bg-"] {
    color: #ffffff !important;
    font-weight: 600;
}

// Hide empty badges to prevent grey circle from showing
.badge:empty {
    display: none;
}

.card-header {
    padding: 0.75rem 1.25rem;
    background-color: var(--bs-tertiary-bg);
}

// Navbar and logo styling
.navbar {
    background-color: var(--bs-body-bg);
    box-shadow: none;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 45px;
}

.navbar-brand img {
    display: block;
    height: 45px;
    width: auto;
}

// Language selector flag icon styling
.locale-selector-dropdown {
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    box-shadow: var(--bs-box-shadow);

    .dropdown-item {
        display: flex;
        align-items: center;
        padding: 0.5rem 1rem;

        .fi {
            display: inline-block;
            width: 1.25em;
            height: 1em;
            margin-right: 0.5rem;
            vertical-align: middle;
        }
    }
}

// Ensure flag icons render correctly in all contexts
.fi {
    border-radius: 4px;
    display: inline-block;
    vertical-align: middle;
    position: relative;
    width: 1.25em;
    height: 1em;

    &::before {
        content: '';
        display: block;
        width: inherit;
        height: inherit;
        background-size: contain;
        background-position: center;
        background-repeat: no-repeat;
    }
}

// Flag icon size variants
.fi-fw {
    width: 1.28571429em;
}

.fi-size-sm {
    font-size: 0.875rem;
}

.fi-size-lg {
    font-size: 1.25rem;
}

// Dark mode is now handled by Bootstrap's native color modes via data-bs-theme attribute
// See: https://getbootstrap.com/docs/5.3/customize/color-modes/

// Breadcrumb margin
.breadcrumb {
    margin-bottom: 1.25rem;
}

// Nav-link color - black for better visibility and contrast
.nav-link {
    color: #000000 !important;
}

.nav-link:hover {
    color: var(--bs-primary) !important;
}

.nav-link.active,
.offcanvas-item.active > .nav-link {
    color: var(--bs-primary) !important;
    font-weight: 600;
}

.nav-pills .nav-link.active {
    color: var(--bs-nav-pills-link-active-color) !important;
}

.offcanvas-item.active {
    background: rgba(var(--bs-primary-rgb), 0.08);
}

// Client profile dropdown - inline with nav items, transparent background
.client-dropdown {
    .nav-link.dropdown-toggle {
        color: var(--bs-body-color);
        background-color: transparent;
        border: none;
        display: inline-flex;
        align-items: center;
        gap: 0.25rem;
        padding: 0.5rem 0.75rem;

        &:hover {
            color: var(--bs-primary);
        }

        &::after {
            margin-left: 0.25rem;
        }
    }

    .dropdown-menu {
        background-color: var(--bs-body-bg);
        border: 1px solid var(--bs-border-color);
        box-shadow: var(--bs-box-shadow);
    }

    .dropdown-item {
        padding: 0.5rem 1rem;
    }
}

// Sidebar balance and note styling
.sidebar-balance-title {
    color: var(--bs-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.sidebar-note-content {
    font-size: 0.875rem;
}

// Alert styling - use Bootstrap's native alert colors
.alert-danger {
    --bs-alert-bg: rgba(var(--bs-danger-rgb), 0.15);
    --bs-alert-border-color: rgba(var(--bs-danger-rgb), 0.3);
    --bs-alert-color: var(--bs-danger);
}

.alert-warning {
    --bs-alert-bg: rgba(var(--bs-warning-rgb), 0.15);
    --bs-alert-border-color: rgba(var(--bs-warning-rgb), 0.3);
    --bs-alert-color: var(--bs-warning);
}

.alert-info {
    --bs-alert-bg: rgba(var(--bs-primary-rgb), 0.1);
    --bs-alert-border-color: rgba(var(--bs-primary-rgb), 0.2);
    --bs-alert-color: var(--bs-primary);
}

// Order page text sizing
.mod_orderbutton {
    .accordion-body {
        span:not(.badge) {
            font-size: 0.875rem;
        }
    }
}

// Dashboard and client area styling
.dashboard,
.mod_client {
    // Card header h6 styling - larger and more prominent
    .card-header {
        h6 {
            font-size: 1rem;
            font-weight: 600;
            margin: 0;
            color: var(--bs-body-color);
        }
    }
}

// Language selector vertical alignment in navbar
.nav-item {
    display: flex;
    align-items: center;

    .form-select.js-locale-selector {
        color: var(--bs-body-color);
        padding: 0.5rem 2rem 0.5rem 0.75rem;
        font-size: 0.875rem;
        line-height: 1.5;
        min-height: auto;
        height: auto;
        background-position: right 0.5rem center;
    }
}

// Alert vertical centering and layout
.alert {
    align-items: center;
    flex-direction: column !important;
}

.alert p {
    margin-bottom: 0;
}

// Nav-link vertical alignment with language selector
.navbar-nav {
    align-items: center;
    gap: 0.25rem;

    .nav-link {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    > .btn {
        margin-top: 0;
        margin-bottom: 0;
        display: inline-flex;
        align-items: center;
    }
}
.toast-container-zindex {
    z-index: 1070;
}

// Dark mode support uses Bootstrap's native color mode system via data-bs-theme attribute in HTML tag.
// Bootstrap 5.3+ automatically handles dark mode colors through CSS variables.
