/*
 * myilo Manager Panel — Custom Styles
 * Built on top of Tabler (https://tabler.io)
 * -----------------------------------------------
 */

/* ── Brand Color Overrides ─────────────────────── */
:root {
    --mp-primary:       #31BCFD;
    --mp-primary-dark:  #1a9edb;
    --mp-sidebar-bg:    #080c11;
    --mp-sidebar-text:  #d8dadb;
    --mp-sidebar-hover: rgba(255,255,255,.06);
    --mp-sidebar-active:#31BCFD;

    /* Soft & Friendly tokens */
    --mp-radius-lg:     16px;
    --mp-radius-md:     12px;
    --mp-radius-sm:      8px;
    --mp-radius-pill:   999px;

    --mp-shadow-soft:       0 4px 12px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.04);
    --mp-shadow-soft-hover: 0 10px 24px rgba(15,23,42,.10), 0 2px 6px rgba(15,23,42,.06);
    --mp-shadow-btn:        0 2px 6px rgba(49,188,253,.35);

    --mp-border-soft:   #e9edf3;
    --mp-text-muted:    #6b7280;
    --mp-surface-hover: #f8fafc;

    --mp-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ── Typography ─────────────────────────────────── */
body {
    font-family: var(--mp-font-sans);
}

/* ── Buttons, Bg Colors ────────────────────────────── */
.btn {
    border-radius: var(--mp-radius-md);
}
.btn-primary {
    background-color: var(--mp-primary);
    border-color: var(--mp-primary);
    box-shadow: var(--mp-shadow-btn);
}
.btn-primary:hover {
    background-color: var(--mp-primary-dark);
    border-color: var(--mp-primary-dark);
    box-shadow: 0 4px 10px rgba(49,188,253,.45);
}
.bg-primary {
    background-color: var(--mp-primary) !important;
}

/* ── Sidebar ────────────────────────────────────── */
.navbar-vertical.navbar-dark {
    /* background-color: var(--mp-sidebar-bg) !important; */
    background: linear-gradient(135deg, #0f172a 0%, #31BCFD 100%);

}

.navbar-vertical .nav-link {
    color: var(--mp-sidebar-text);
    border-radius: var(--mp-radius-sm);
    margin: 1px 8px;
    font-size: .9rem;
    font-weight: 500;
    position: relative;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}

.navbar-vertical .nav-link:hover {
    background: var(--mp-sidebar-hover);
    color: #fff;
}

.navbar-vertical .nav-link.active {
    background: rgba(255,255,255,.16) !important;
    color: #fff !important;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.25), 0 0 16px rgba(49,188,253,.35);
}

.navbar-vertical .nav-link.active::before {
    content: "";
    position: absolute;
    left: -8px;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: var(--mp-radius-pill);
    background: #fff;
}

.navbar-vertical .nav-link .nav-link-icon {
    width: 1.25rem;
    text-align: center;
    opacity: .7;
}

.navbar-vertical .nav-link.active .nav-link-icon {
    opacity: 1;
}

.nav-section-label {
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #fff;
    padding: .75rem 1rem .25rem;
}
.nav-link-icon {
    color: #fff;
}

/* ── Topbar ─────────────────────────────────────── */
.navbar-top {
    border-bottom: 1px solid var(--mp-border-soft);
}

/* ── Container Width (1320px at xxl breakpoint) ──── */
@media (min-width: 1400px) {
    .page-body .container-xl,
    .footer .container-xl,
    header.navbar.navbar-expand-md .container-xl {
        max-width: 1600px;
    }
}

/* ── Cards ──────────────────────────────────────── */
.card {
    border: 1px solid var(--mp-border-soft);
    border-radius: var(--mp-radius-lg);
    box-shadow: var(--mp-shadow-soft);
    transition: transform .15s ease, box-shadow .15s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--mp-shadow-soft-hover);
}

.modal .card:hover,
.dropdown-menu .card:hover {
    transform: none;
}

.card-header {
    border-bottom: 1px solid var(--mp-border-soft);
    background: #fff;
    border-radius: var(--mp-radius-lg) var(--mp-radius-lg) 0 0;
}

.card-footer {
    border-top: 1px solid var(--mp-border-soft);
    border-radius: 0 0 var(--mp-radius-lg) var(--mp-radius-lg);
}

/* ── Stat Card ──────────────────────────────────── */
.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--mp-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 2px 6px rgba(15,23,42,.08);
}

.stat-card-icon.bg-blue-lt      { background: linear-gradient(135deg, #cfe8ff 0%, #a9d6ff 100%) !important; }
.stat-card-icon.bg-purple-lt    { background: linear-gradient(135deg, #ecdcfb 0%, #d9bdf6 100%) !important; }
.stat-card-icon.bg-cyan-lt      { background: linear-gradient(135deg, #cdf1ff 0%, #a3e6fd 100%) !important; }
.stat-card-icon.bg-green-lt     { background: linear-gradient(135deg, #d4f4dc 0%, #aee9bd 100%) !important; }
.stat-card-icon.bg-yellow-lt    { background: linear-gradient(135deg, #fdf0c8 0%, #fbe093 100%) !important; }
.stat-card-icon.bg-red-lt       { background: linear-gradient(135deg, #fbdada 0%, #f5b3b3 100%) !important; }
.stat-card-icon.bg-orange-lt    { background: linear-gradient(135deg, #fde3cc 0%, #fac49a 100%) !important; }
.stat-card-icon.bg-azure-lt     { background: linear-gradient(135deg, #d2eafd 0%, #a8d8fb 100%) !important; }
.stat-card-icon.bg-secondary-lt { background: linear-gradient(135deg, #eceef1 0%, #d8dce2 100%) !important; }

/* ── DataTables overrides ───────────────────────── */
table.dataTable thead th {
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--mp-text-muted);
    border-bottom: 2px solid var(--mp-border-soft);
}

table.dataTable tbody tr:hover {
    background-color: var(--mp-surface-hover);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: var(--mp-radius-sm);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--mp-primary);
    border-color: var(--mp-primary);
    color: #fff !important;
    border-radius: var(--mp-radius-sm);
}

.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #cadded;
    border-radius: var(--mp-radius-sm);
    padding: .25rem .75rem;
    font-size: .875rem;
}

/* ── Badges ─────────────────────────────────────── */
.badge {
    border-radius: var(--mp-radius-pill);
    font-weight: 600;
    padding-left: .6em;
    padding-right: .6em;
}

.badge-role-admin      { background: #d63939; color: #fff; }
.badge-role-developer  { background: #4263eb; color: #fff; }
.badge-role-sales      { background: #2fb344; color: #fff; }
.badge-role-financial  { background: #f76707; color: #fff; }
.badge-role-manager    { background: #ae3ec9; color: #fff; }

/* ── Breadcrumb ─────────────────────────────────── */
.page-header .breadcrumb {
    font-size: .8125rem;
}

/* ── Utility ────────────────────────────────────── */
.cursor-pointer { cursor: pointer; }
.text-muted-sm  { font-size: .8125rem; color: var(--mp-text-muted); }

/* ── Login Page ─────────────────────────────────── */
.mp-login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.mp-login-card {
    width: 100%;
    max-width: 420px;
    border-radius: var(--mp-radius-lg);
    overflow: hidden;
}

.mp-login-logo {
    width: 80px;
}

/* General Table Styles */
.dt-buttons {
    gap: 10px;
}
.dt-buttons .btn {
    padding: 6px 12px;
    font-size: .875rem;
    border-radius: var(--mp-radius-sm);
}

/* ── Filter Offcanvas Panel ─────────────────────── */
.mp-filter-panel .offcanvas-title {
    font-weight: 700;
}

.mp-filter-panel .form-label {
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--mp-text-muted);
    margin-bottom: .375rem;
}

/* Shared field styling — native inputs & selects */
.mp-filter-panel .form-control,
.mp-filter-panel .form-select {
    height: calc(1.5em + 0.5rem + 2px);
    min-height: calc(1.5em + 0.5rem + 2px);
    font-size: .875rem;
    color: #1f2937;
    background-color: #fff;
    border: 1px solid var(--mp-border-soft);
    border-radius: var(--mp-radius-sm);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.mp-filter-panel .form-control::placeholder {
    color: #aab3bf;
}
.mp-filter-panel .form-control:focus,
.mp-filter-panel .form-select:focus {
    border-color: var(--mp-primary);
    box-shadow: 0 0 0 3px rgba(49, 188, 253, .15);
}

/* Range groups (Profiles / Catalogs / Ilos / Registered) */
.mp-range {
    display: flex;
    align-items: center;
    gap: .5rem;
}
.mp-range .form-control {
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
}
.mp-range input[type="date"] {
    text-align: left;
}
.mp-range-sep {
    flex: 0 0 auto;
    color: var(--mp-text-muted);
    font-weight: 500;
    user-select: none;
}
/* Hide native number spinners for a cleaner look */
.mp-range input[type="number"]::-webkit-outer-spin-button,
.mp-range input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.mp-range input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* select2 — match the native fields exactly */
.mp-filter-panel .select2-container {
    width: 100% !important;
}
.mp-filter-panel .select2-container--bootstrap-5 .select2-selection {
    height: calc(1.5em + 0.5rem + 2px);
    min-height: calc(1.5em + 0.5rem + 2px);
    padding: .25rem .5rem;
    font-size: .875rem;
    border: 1px solid var(--mp-border-soft);
    border-radius: var(--mp-radius-sm);
    display: flex;
    align-items: center;
}
.mp-filter-panel .select2-container--bootstrap-5.select2-container--focus .select2-selection,
.mp-filter-panel .select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: var(--mp-primary);
    box-shadow: 0 0 0 3px rgba(49, 188, 253, .15);
}
.mp-filter-panel .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    padding: 0;
    line-height: 1.5;
    color: #1f2937;
}
.mp-filter-panel .select2-container--bootstrap-5 .select2-selection--single .select2-selection__placeholder {
    color: #aab3bf;
}
.mp-filter-panel .select2-container--bootstrap-5 .select2-selection__arrow {
    height: 100%;
    top: 0;
}

/* select2 dropdown popup
   NOTE: selectors match the bootstrap-5 theme's full depth
   (.select2-dropdown .select2-results__options .select2-results__option)
   so our brand colors/sizing win the specificity battle. */
.mp-filter-panel .select2-container--bootstrap-5 .select2-dropdown {
    border-color: var(--mp-border-soft);
    border-radius: var(--mp-radius-sm);
    box-shadow: var(--mp-shadow-soft);
    overflow: hidden;
}
.mp-filter-panel .select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option {
    font-size: .875rem;
    padding: .375rem .625rem;
    line-height: 1.5;
}
.mp-filter-panel .select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option[role="group"] .select2-results__group {
    font-size: .75rem;
    font-weight: 700;
}
/* Selected (current value) — soft brand tint. Listed BEFORE highlighted
   so highlighted wins the tie when an option is both. */
.mp-filter-panel .select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--selected,
.mp-filter-panel .select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option[aria-selected="true"] {
    background-color: rgba(49, 188, 253, .12);
    color: #1f2937;
}
/* Highlighted (hover / keyboard) — brand blue */
.mp-filter-panel .select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--highlighted,
.mp-filter-panel .select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option--highlighted[aria-selected="true"] {
    background-color: var(--mp-primary);
    color: #fff;
}
.mp-filter-panel .select2-container--bootstrap-5 .select2-dropdown .select2-search--dropdown .select2-search__field {
    font-size: .875rem;
    border-color: var(--mp-border-soft);
    border-radius: var(--mp-radius-sm);
}
.mp-filter-panel .select2-container--bootstrap-5 .select2-dropdown .select2-search--dropdown .select2-search__field:focus {
    border-color: var(--mp-primary);
    box-shadow: 0 0 0 3px rgba(49, 188, 253, .15);
}

/* "Show more" divider toggle */
.mp-filter-panel #moreFiltersToggle {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--mp-primary);
    white-space: nowrap;
}
.mp-filter-panel #moreFiltersToggle:hover {
    color: var(--mp-primary-dark);
}

/* ── PWA / installed app (safe-area insets for notch & home indicator) ── */
/* The layout uses viewport-fit=cover; pad content past the device cutouts.  */
@supports (padding: max(0px)) {
    .page-body {
        padding-left:  max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
    .footer {
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
    /* Sticky top navbar clears the status-bar area when run as an app */
    .navbar.sticky-top {
        padding-top: env(safe-area-inset-top);
    }
}
