/* ========================================================
   SDS — Smart Delta Systems Theme for Keycloak 26.8.0
   Account Console (v3) & Admin Console (v2)
   ======================================================== */

:root {
    color-scheme: light;
    --sds-ink: #202d43;
    --sds-muted: #57677d;
    --sds-blue: #0964d8;
    --sds-blue-hover: #0754b7;
    --sds-blue-active: #084897;
    --sds-orange: #ef682a;
    --sds-line: #e1ebf6;
    --sds-bg: #f8fafd;

    /* PatternFly 5 Design Tokens */
    --pf-v5-global--FontFamily--text: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --pf-v5-global--FontFamily--heading: var(--pf-v5-global--FontFamily--text);
    --pf-v5-global--Color--100: #202d43;
    --pf-v5-global--Color--200: #57677d;
    --pf-v5-global--primary-color--100: #0964d8;
    --pf-v5-global--primary-color--200: #0754b7;
    --pf-v5-global--link--Color: #075fc9;
    --pf-v5-global--link--Color--hover: #064b9c;
    --pf-v5-global--BackgroundColor--100: #ffffff;
    --pf-v5-global--BackgroundColor--200: #f8fafd;
    --pf-v5-global--BorderColor--100: #e1ebf6;
    --pf-v5-global--BorderColor--200: #c8d7e8;

    /* PatternFly 4 Fallback Tokens */
    --pf-global--primary-color--100: #0964d8;
    --pf-global--primary-color--200: #0754b7;
    --pf-global--link--Color: #075fc9;
    --pf-global--link--Color--hover: #064b9c;
    --pf-global--BackgroundColor--100: #ffffff;
    --pf-global--BackgroundColor--200: #f8fafd;
    --pf-global--BorderColor--100: #e1ebf6;
}

/* ========================================================
   Global Layout & Typography
   ======================================================== */
html,
body,
#app {
    color: var(--sds-ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--sds-bg) !important;
    min-height: 100%;
}

.pf-v5-c-page,
.pf-c-page {
    background-color: var(--sds-bg) !important;
    --pf-v5-c-page__sidebar--BackgroundColor: #ffffff;
    --pf-v5-c-page__main-section--BackgroundColor: #ffffff;
}

/* ========================================================
   Masthead (Top Header Bar)
   ======================================================== */
.pf-v5-c-masthead,
.pf-c-masthead,
.pf-v5-c-page__header,
.pf-c-page__header {
    background: #ffffff !important;
    color: var(--sds-ink) !important;
    border-top: 3px solid #ef682a !important; /* SDS brand orange line */
    border-bottom: 1px solid var(--sds-line) !important;
    box-shadow: 0 2px 12px rgba(36, 78, 121, 0.05) !important;
    --pf-v5-c-masthead--BackgroundColor: #ffffff;
    --pf-v5-c-masthead--Color: #202d43;
}

/* Logo container & Brand image */
.pf-v5-c-masthead__brand,
.pf-c-masthead__brand,
.pf-v5-c-page__header-brand,
.pf-c-page__header-brand {
    display: flex !important;
    align-items: center !important;
    max-height: 54px !important;
}

.pf-v5-c-masthead__brand .pf-v5-c-brand,
.pf-c-masthead__brand .pf-c-brand,
.pf-v5-c-page__header-brand img,
.pf-c-page__header-brand img,
.pf-v5-c-brand,
.pf-c-brand {
    content: url("../img/sds-logo.png") !important;
    height: 42px !important;
    max-height: 42px !important;
    width: auto !important;
    max-width: 160px !important;
    object-fit: contain !important;
    border-radius: 4px;
}

/* Masthead navigation / actions / toggles */
.pf-v5-c-masthead .pf-v5-c-toolbar,
.pf-c-masthead .pf-c-toolbar {
    background: transparent !important;
    color: var(--sds-ink) !important;
}

.pf-v5-c-masthead .pf-v5-c-button.pf-m-plain,
.pf-c-masthead .pf-c-button.pf-m-plain,
.pf-v5-c-masthead .pf-v5-c-menu-toggle,
.pf-c-masthead .pf-c-menu-toggle {
    color: var(--sds-ink) !important;
    --pf-v5-c-button--m-plain--Color: #202d43;
    --pf-v5-c-menu-toggle--Color: #202d43;
}

/* ========================================================
   Sidebar Navigation
   ======================================================== */
.pf-v5-c-page__sidebar,
.pf-c-page__sidebar {
    background: #ffffff !important;
    border-inline-end: 1px solid var(--sds-line) !important;
    box-shadow: 2px 0 10px rgba(36, 78, 121, 0.03);
}

.pf-v5-c-nav,
.pf-c-nav {
    --pf-v5-c-nav__link--Color: #41546f;
    --pf-v5-c-nav__link--hover--Color: #0754b7;
    --pf-v5-c-nav__link--m-current--Color: #0754b7;
    --pf-v5-c-nav__link--hover--BackgroundColor: #f2f7ff;
    --pf-v5-c-nav__link--m-current--BackgroundColor: #edf5ff;
    --pf-v5-c-nav__link--m-current--after--BorderColor: #ef682a;
}

.pf-v5-c-nav__link,
.pf-c-nav__link {
    color: #41546f !important;
    border-radius: 10px !important;
    margin: 3px 10px !important;
    transition: all 0.15s ease !important;
}

.pf-v5-c-nav__link:hover,
.pf-c-nav__link:hover {
    color: #0754b7 !important;
    background: #f2f7ff !important;
}

.pf-v5-c-nav__link.pf-m-current,
.pf-c-nav__link.pf-m-current {
    color: #0754b7 !important;
    background: #edf5ff !important;
    font-weight: 600 !important;
}

.pf-v5-c-nav__link.pf-m-current::after,
.pf-c-nav__link.pf-m-current::after {
    border-color: #ef682a !important;
    border-radius: 10px !important;
}

/* Section titles & Breadcrumbs */
.pf-v5-c-page__main-section.pf-m-light,
.pf-c-page__main-section.pf-m-light {
    background: #ffffff !important;
}

.pf-v5-c-title,
.pf-c-title {
    color: var(--sds-ink) !important;
    letter-spacing: -0.02em;
    font-weight: 650;
}

/* ========================================================
   Cards, Panels, Modal Boxes
   ======================================================== */
.pf-v5-c-card,
.pf-c-card,
.pf-v5-c-data-list,
.pf-c-data-list,
.pf-v5-c-modal-box,
.pf-c-modal-box {
    border: 1px solid var(--sds-line) !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 20px -6px rgba(36, 78, 121, 0.07) !important;
    background: #ffffff !important;
}

.pf-v5-c-card__title,
.pf-c-card__title {
    font-weight: 650;
    color: var(--sds-ink);
}

.pf-v5-c-data-list__item:first-child,
.pf-c-data-list__item:first-child {
    border-start-start-radius: 16px;
    border-start-end-radius: 16px;
}

.pf-v5-c-data-list__item:last-child,
.pf-c-data-list__item:last-child {
    border-end-start-radius: 16px;
    border-end-end-radius: 16px;
}

/* ========================================================
   Buttons: Modern, soft rounded, subtle shadows
   ======================================================== */
.pf-v5-c-button,
.pf-c-button {
    --pf-v5-c-button--BorderRadius: 10px;
    border-radius: 10px !important;
    font-weight: 600 !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.pf-v5-c-button::after,
.pf-c-button::after,
.pf-v5-c-menu-toggle::before,
.pf-v5-c-menu-toggle::after,
.pf-c-menu-toggle::before,
.pf-c-menu-toggle::after {
    border-radius: inherit !important;
}

/* Primary Button */
.pf-v5-c-button.pf-m-primary:not(:disabled):not(.pf-m-disabled):not([aria-disabled="true"]),
.pf-c-button.pf-m-primary:not(:disabled):not(.pf-m-disabled):not([aria-disabled="true"]) {
    background: var(--sds-blue) !important;
    color: #ffffff !important;
    border-color: transparent !important;
    box-shadow: 0 3px 10px rgba(9, 100, 216, 0.22) !important;
}

.pf-v5-c-button.pf-m-primary:hover:not(:disabled):not(.pf-m-disabled):not([aria-disabled="true"]),
.pf-c-button.pf-m-primary:hover:not(:disabled):not(.pf-m-disabled):not([aria-disabled="true"]) {
    background: #0754b7 !important;
    box-shadow: 0 5px 14px rgba(9, 100, 216, 0.3) !important;
    transform: translateY(-1px);
}

.pf-v5-c-button.pf-m-primary:active:not(:disabled):not(.pf-m-disabled):not([aria-disabled="true"]),
.pf-c-button.pf-m-primary:active:not(:disabled):not(.pf-m-disabled):not([aria-disabled="true"]) {
    background: #084897 !important;
    transform: translateY(0);
}

/* Secondary Button */
.pf-v5-c-button.pf-m-secondary,
.pf-c-button.pf-m-secondary {
    --pf-v5-c-button--m-secondary--Color: #0754b7;
    --pf-v5-c-button--m-secondary--BorderColor: #c8daf0;
    background: #f0f6ff !important;
    color: #0754b7 !important;
    border: 1px solid #c8daf0 !important;
}

.pf-v5-c-button.pf-m-secondary:hover,
.pf-c-button.pf-m-secondary:hover {
    background: #e2efff !important;
    border-color: #a8caf5 !important;
    color: #064b9c !important;
    transform: translateY(-1px);
}

/* ========================================================
   Form Controls (Inputs, Selects, Menus)
   ======================================================== */
.pf-v5-c-form-control,
.pf-c-form-control,
.pf-v5-c-menu-toggle,
.pf-c-menu-toggle {
    border-radius: 10px !important;
    border: 1px solid #d7e2ee !important;
    --pf-v5-c-form-control--BorderRadius: 10px;
}

.pf-v5-c-form-control:hover,
.pf-c-form-control:hover {
    border-color: #9cbce5 !important;
}

.pf-v5-c-form-control:focus,
.pf-v5-c-form-control:focus-within,
.pf-c-form-control:focus,
.pf-c-form-control:focus-within {
    border-color: var(--sds-blue) !important;
    box-shadow: 0 0 0 3px rgba(9, 100, 216, 0.15) !important;
}

.pf-v5-c-form__label,
.pf-c-form__label {
    color: var(--sds-ink) !important;
    font-weight: 600;
}

/* ========================================================
   Tables: Clean, soft, readable
   ======================================================== */
.pf-v5-c-table,
.pf-c-table {
    --pf-v5-c-table--BackgroundColor: #ffffff;
    --pf-v5-c-table--BorderColor: #e1ebf6;
    --pf-v5-c-table__tr--hover--BackgroundColor: #f5f9ff;
    border-radius: 12px;
}

.pf-v5-c-table thead,
.pf-c-table thead {
    background: #f5f8fd !important;
}

/* ========================================================
   Tabs
   ======================================================== */
.pf-v5-c-tabs,
.pf-c-tabs {
    --pf-v5-c-tabs__link--Color: #57677d;
    --pf-v5-c-tabs__item--m-current__link--Color: #0754b7;
    --pf-v5-c-tabs__link--after--BorderColor: #0964d8;
}

/* ========================================================
   Alerts & Toast Notifications
   ======================================================== */
.pf-v5-c-alert,
.pf-c-alert {
    border-radius: 12px !important;
}

/* ========================================================
   Menus & Dropdowns
   ======================================================== */
.pf-v5-c-menu,
.pf-c-menu,
.pf-v5-c-dropdown__menu,
.pf-c-dropdown__menu,
.pf-v5-c-select__menu,
.pf-c-select__menu {
    border-radius: 12px !important;
    border: 1px solid var(--sds-line) !important;
    box-shadow: 0 8px 30px rgba(36, 78, 121, 0.12) !important;
}

/* ========================================================
   Checkboxes & Radios: SDS Soft Style
   ======================================================== */
input[type="checkbox"]:not(.pf-v5-c-switch__input):not([role="switch"]):not(.pf-c-switch__input) {
    -webkit-appearance: none;
    appearance: none;
    width: 19px;
    height: 19px;
    flex-shrink: 0;
    border: 1.5px solid #c8d7e8;
    border-radius: 6px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

input[type="checkbox"]:not(.pf-v5-c-switch__input):not([role="switch"]):not(.pf-c-switch__input):hover {
    border-color: #3b82f6;
    background-color: #f4f8fe;
    box-shadow: 0 0 0 3px rgba(9, 100, 216, 0.1);
}

input[type="checkbox"]:not(.pf-v5-c-switch__input):not([role="switch"]):not(.pf-c-switch__input):checked {
    border-color: var(--sds-blue);
    background-color: var(--sds-blue);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m5.5 10.2 3.1 3.1 6.2-6.5' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-size: 100% 100%;
    box-shadow: 0 2px 6px rgba(9, 100, 216, 0.32);
}

input[type="checkbox"]:not(.pf-v5-c-switch__input):not([role="switch"]):not(.pf-c-switch__input):indeterminate {
    border-color: var(--sds-blue);
    background-color: var(--sds-blue);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5.5 10h9' stroke='white' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
    background-size: 100% 100%;
}

input[type="radio"]:not([role="switch"]) {
    accent-color: var(--sds-blue);
}

/* ========================================================
   Loading spinner & Focus visibility
   ======================================================== */
:is(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 3px solid #0964d8;
    outline-offset: 3px;
}

.keycloak__loading-container {
    color: var(--sds-ink) !important;
    background: #f8fafd !important;
}

.pf-c-spinner,
.pf-v5-c-spinner {
    --pf-v5-c-spinner--Color: #0964d8;
    --pf-c-spinner--Color: #0964d8;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
