/* ========================================
   Account Console Theme - Konek
   PatternFly 4 Compatible
   ======================================== */

@import url("https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700&display=swap");

/* ========== RESET & BASE ========== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  font-family: var(--font-family-base);
  /* No font-size here: PatternFly sizes are rem-based, and a 14px root shrank its 0.875rem
     steps to 12.25px. The 16px browser default keeps 0.875rem = 14px and body text at 16px (brief). */
  line-height: 1.5;
  color: var(--tc-surface);
  background-color: #f5f5f5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========== PAGE HEADER ========== */

/* keycloak.v3 (PatternFly 5) renders the header as .pf-v5-c-masthead; the .pf-c-* rules below
   target the old PF4 markup. The logo image comes from the theme's logo= property. */
.pf-v5-c-masthead {
  --pf-v5-c-masthead--BackgroundColor: var(--color-navy-700);
  background: linear-gradient(135deg, var(--color-navy-700) 0%, var(--color-navy-500) 100%);
}

/* The React UI gives the logo a hashed class (e.g. _brand_xxxx) with a fixed 35px height,
   so target the element inside the stable PF5 brand wrapper. */
.pf-v5-c-masthead .pf-v5-c-masthead__brand img {
  width: 144px;
  height: auto;
  /* Clear space: 1/4 of the 54px lockup height */
  margin: 14px 0;
}

.pf-c-page__header {
  background: linear-gradient(135deg, var(--color-navy-700) 0%, var(--color-navy-500) 100%) !important;
  color: var(--tc-world) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 0 !important;
  border-bottom: none !important;
}

.pf-c-page__header-brand {
  padding: 1rem 2rem !important;
  background: transparent !important;
}

.pf-c-page__header-brand a,
.pf-c-page__header-brand-link {
  color: var(--tc-world) !important;
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pf-c-page__header-tools {
  padding: 1rem 2rem !important;
  background: transparent !important;
}

.pf-c-page__header-tools-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.pf-c-page__header-tools-item {
  color: var(--tc-world) !important;
}

.pf-c-page__header-tools-item a {
  color: var(--tc-world) !important;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.pf-c-page__header-tools-item a:hover {
  opacity: 0.8;
}

.pf-c-page__header-tools-item button {
  background-color: rgba(255, 255, 255, 0.1) !important;
  color: var(--tc-world) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

.pf-c-page__header-tools-item button:hover {
  background-color: rgba(255, 255, 255, 0.2) !important;
}

/* ========== PAGE SIDEBAR ========== */

.pf-c-page__sidebar {
  background-color: #ffffff !important;
  border-right: 1px solid var(--bg-surface-border) !important;
  padding: 0 !important;
}

.pf-c-nav {
  background-color: #ffffff !important;
  border-right: none !important;
}

.pf-c-nav__list {
  background-color: #ffffff !important;
}

.pf-c-nav__item {
  background-color: transparent !important;
  border: none !important;
  padding: 0 !important;
}

.pf-c-nav__link {
  color: var(--tc-surface) !important;
  transition: all 0.15s ease;
  padding: 0.75rem 1rem !important;
  border-left: 3px solid transparent !important;
  text-decoration: none !important;
}

.pf-c-nav__link:hover {
  background-color: var(--bg-surface-low) !important;
  color: var(--tc-primary) !important;
  border-left-color: var(--bg-primary) !important;
}

.pf-c-nav__link.pf-m-current {
  background-color: var(--bg-primary-soft-active) !important;
  color: var(--tc-primary) !important;
  border-left-color: var(--bg-primary) !important;
  font-weight: 500 !important;
}

.pf-c-nav__section-title {
  color: var(--tc-surface-low) !important;
  font-weight: 600 !important;
  font-size: 0.875rem !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  padding: 1rem 1rem 0.5rem 1rem !important;
}

/* ========== PAGE MAIN ========== */

.pf-c-page__main {
  background-color: #f5f5f5 !important;
  padding: 2rem !important;
}

.pf-c-page__main-section {
  background-color: #ffffff !important;
  border-radius: var(--br-md);
  padding: 2rem !important;
  margin-bottom: 2rem !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ========== TITLES & HEADINGS ========== */

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--tc-surface) !important;
}

.pf-c-title {
  color: var(--tc-surface) !important;
}

.pf-c-title.pf-m-lg {
  font-size: 1.875rem !important;
  font-weight: 700 !important;
  margin-bottom: 1rem !important;
}

.pf-c-title.pf-m-md {
  font-size: 1.5rem !important;
  font-weight: 700 !important;
  margin-bottom: 1rem !important;
}

.pf-c-title.pf-m-sm {
  font-size: 1.125rem !important;
  font-weight: 600 !important;
  margin-bottom: 0.75rem !important;
}

/* Section titles */
.pf-c-content h1 {
  font-size: 1.875rem !important;
  font-weight: 700 !important;
  margin-bottom: 1rem !important;
}

.pf-c-content h2 {
  font-size: 1.5rem !important;
  font-weight: 700 !important;
  margin-bottom: 0.75rem !important;
  margin-top: 1.5rem !important;
}

.pf-c-content h3 {
  font-size: 1.125rem !important;
  font-weight: 600 !important;
  margin-bottom: 0.75rem !important;
  margin-top: 1rem !important;
}

/* ========== FORM STYLES ========== */

.pf-c-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.pf-c-form__group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pf-c-form__label {
  color: var(--tc-surface) !important;
  font-weight: 500 !important;
  font-size: 0.875rem !important;
}

.pf-c-form__label-required {
  color: var(--bg-danger) !important;
}

.pf-c-form__helper-text {
  color: var(--tc-surface-low) !important;
  font-size: 0.875rem !important;
}

.pf-c-form__helper-text.pf-m-error {
  color: var(--bg-danger) !important;
}

/* ========== INPUTS & FORM CONTROL ========== */

.pf-c-form-control {
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--bg-surface-border) !important;
  color: var(--tc-surface) !important;
  padding: 0.625rem 0.875rem !important;
  border-radius: var(--br-xs) !important;
  font-family: inherit !important;
  font-size: 0.875rem !important;
  transition: all 0.15s ease;
}

.pf-c-form-control:focus {
  outline: none !important;
  border-color: var(--bg-primary) !important;
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.1) !important;
}

.pf-c-form-control::placeholder {
  color: var(--tc-surface-low) !important;
}

.pf-c-form-control:disabled {
  background-color: var(--bg-surface-low) !important;
  opacity: 0.6 !important;
}

.pf-c-form-control.pf-m-error {
  border-color: var(--bg-danger) !important;
}

.pf-c-form-control.pf-m-error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

/* Textarea */
.pf-c-form-control.pf-m-textarea {
  min-height: 120px !important;
  resize: vertical;
}

/* ========== CHECKBOXES & RADIOS ========== */

.pf-c-check {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
}

.pf-c-check__input {
  width: 1rem !important;
  height: 1rem !important;
  cursor: pointer !important;
  accent-color: var(--bg-primary) !important;
}

.pf-c-check__label {
  color: var(--tc-surface) !important;
  cursor: pointer !important;
  user-select: none !important;
  font-size: 0.875rem !important;
}

.pf-c-radio {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
}

.pf-c-radio__input {
  width: 1rem !important;
  height: 1rem !important;
  cursor: pointer !important;
  accent-color: var(--bg-primary) !important;
}

.pf-c-radio__label {
  color: var(--tc-surface) !important;
  cursor: pointer !important;
  user-select: none !important;
  font-size: 0.875rem !important;
}

/* ========== BUTTONS ========== */

.pf-c-button {
  font-family: inherit !important;
  font-weight: 500 !important;
  border-radius: var(--br-xs) !important;
  transition: all 0.15s ease;
  cursor: pointer !important;
  border: 1px solid transparent !important;
}

.pf-c-button.pf-m-primary {
  background-color: var(--bg-primary) !important;
  color: var(--tc-on-primary) !important;
  border-color: var(--bg-primary) !important;
}

.pf-c-button.pf-m-primary:hover:not(:disabled) {
  background-color: var(--bg-primary-hover) !important;
  border-color: var(--bg-primary-hover) !important;
}

.pf-c-button.pf-m-primary:active:not(:disabled) {
  background-color: var(--bg-primary-active) !important;
  border-color: var(--bg-primary-active) !important;
}

.pf-c-button.pf-m-primary:focus:not(:disabled) {
  outline: none !important;
  box-shadow: var(--focus-ring) !important;
}

.pf-c-button.pf-m-secondary {
  background-color: transparent !important;
  color: var(--tc-surface) !important;
  border-color: var(--bg-surface-border) !important;
}

.pf-c-button.pf-m-secondary:hover:not(:disabled) {
  background-color: var(--bg-surface-hover) !important;
  border-color: var(--bg-surface-border) !important;
}

.pf-c-button.pf-m-secondary:active:not(:disabled) {
  background-color: var(--bg-surface-active) !important;
  border-color: var(--bg-surface-border) !important;
}

.pf-c-button.pf-m-danger {
  background-color: var(--bg-danger) !important;
  color: var(--tc-on-danger) !important;
  border-color: var(--bg-danger) !important;
}

.pf-c-button.pf-m-danger:hover:not(:disabled) {
  background-color: var(--bg-danger-hover) !important;
  border-color: var(--bg-danger-hover) !important;
}

.pf-c-button.pf-m-danger:active:not(:disabled) {
  background-color: var(--bg-danger-active) !important;
  border-color: var(--bg-danger-active) !important;
}

.pf-c-button.pf-m-danger:focus:not(:disabled) {
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3) !important;
}

.pf-c-button:disabled {
  opacity: 0.6 !important;
  cursor: not-allowed !important;
}

.pf-c-button.pf-m-link {
  background-color: transparent !important;
  color: var(--tc-link) !important;
  border: none !important;
  padding: 0.375rem 0 !important;
  text-decoration: none !important;
}

.pf-c-button.pf-m-link:hover:not(:disabled) {
  text-decoration: underline !important;
  opacity: 0.8;
}

.pf-c-button.pf-m-link:focus:not(:disabled) {
  outline: none !important;
  text-decoration: underline !important;
}

/* ========== ALERTS ========== */

.pf-c-alert {
  border-radius: var(--br-xs) !important;
  padding: 1rem !important;
  margin-bottom: 1.5rem !important;
  display: flex !important;
  align-items: flex-start;
  gap: 0.75rem;
}

.pf-c-alert.pf-m-success {
  background-color: rgba(34, 197, 94, 0.1) !important;
  border: 1px solid rgba(34, 197, 94, 0.3) !important;
  color: #16a34a !important;
}

.pf-c-alert.pf-m-danger {
  background-color: rgba(239, 68, 68, 0.1) !important;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
  color: #dc2626 !important;
}

.pf-c-alert.pf-m-warning {
  background-color: rgba(245, 158, 11, 0.1) !important;
  border: 1px solid rgba(245, 158, 11, 0.3) !important;
  color: #d97706 !important;
}

.pf-c-alert.pf-m-info {
  background-color: rgba(74, 144, 217, 0.1) !important;
  border: 1px solid rgba(74, 144, 217, 0.3) !important;
  color: var(--color-ocean-700) !important;
}

.pf-c-alert__icon {
  flex-shrink: 0;
  font-weight: 700 !important;
}

.pf-c-alert__title {
  font-weight: 600 !important;
  margin-bottom: 0.25rem !important;
}

.pf-c-alert__description {
  font-size: 0.875rem !important;
}

/* ========== CARDS ========== */

.pf-c-card {
  background-color: #ffffff !important;
  border: 1px solid var(--bg-surface-border) !important;
  border-radius: var(--br-md) !important;
  padding: 1.5rem !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.pf-c-card__title {
  color: var(--tc-surface) !important;
  font-size: 1.125rem !important;
  font-weight: 600 !important;
  margin-bottom: 1rem !important;
}

.pf-c-card__body {
  color: var(--tc-surface) !important;
}

.pf-c-card__footer {
  border-top: 1px solid var(--bg-surface-border) !important;
  padding-top: 1rem !important;
  margin-top: 1rem !important;
}

/* ========== TABLES ========== */

.pf-c-table {
  background-color: #ffffff !important;
  border: 1px solid var(--bg-surface-border) !important;
  border-radius: var(--br-md) !important;
  overflow: hidden;
}

.pf-c-table thead {
  background-color: var(--bg-surface-low) !important;
  border-bottom: 1px solid var(--bg-surface-border) !important;
}

.pf-c-table th {
  background-color: var(--bg-surface-low) !important;
  color: var(--tc-surface) !important;
  font-weight: 600 !important;
  font-size: 0.875rem !important;
  padding: 1rem !important;
  text-align: left !important;
  border-bottom: 1px solid var(--bg-surface-border) !important;
}

.pf-c-table td {
  color: var(--tc-surface) !important;
  padding: 1rem !important;
  border-bottom: 1px solid var(--bg-surface-border) !important;
}

.pf-c-table tbody tr:hover td {
  background-color: var(--bg-surface-low) !important;
}

/* ========== DROPDOWN ========== */

.pf-c-dropdown {
  position: relative;
}

.pf-c-dropdown__toggle {
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--bg-surface-border) !important;
  color: var(--tc-surface) !important;
  padding: 0.625rem 0.875rem !important;
  border-radius: var(--br-xs) !important;
  font-family: inherit !important;
  font-size: 0.875rem !important;
  cursor: pointer !important;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pf-c-dropdown__toggle:hover {
  background-color: var(--bg-surface-hover) !important;
}

.pf-c-dropdown__menu {
  background-color: #ffffff !important;
  border: 1px solid var(--bg-surface-border) !important;
  border-radius: var(--br-xs) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  z-index: 1000;
}

.pf-c-dropdown__menu-item {
  color: var(--tc-surface) !important;
  padding: 0.75rem 1rem !important;
  cursor: pointer !important;
  transition: all 0.15s ease;
}

.pf-c-dropdown__menu-item:hover {
  background-color: var(--bg-surface-low) !important;
  color: var(--tc-primary) !important;
}

/* ========== MODALS & DIALOGS ========== */

.pf-c-modal-box {
  background-color: #ffffff !important;
  border-radius: var(--br-md) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.pf-c-modal-box__header {
  background-color: #ffffff !important;
  border-bottom: 1px solid var(--bg-surface-border) !important;
  padding: 1.5rem !important;
}

.pf-c-modal-box__title {
  color: var(--tc-surface) !important;
  font-size: 1.25rem !important;
  font-weight: 600 !important;
}

.pf-c-modal-box__body {
  padding: 1.5rem !important;
  color: var(--tc-surface) !important;
}

.pf-c-modal-box__footer {
  background-color: var(--bg-surface-low) !important;
  border-top: 1px solid var(--bg-surface-border) !important;
  padding: 1.5rem !important;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.pf-c-backdrop {
  background-color: rgba(0, 0, 0, 0.5) !important;
}

/* ========== TABS ========== */

.pf-c-tabs {
  border-bottom: 1px solid var(--bg-surface-border) !important;
}

.pf-c-tabs__list {
  display: flex;
  background-color: #ffffff !important;
}

.pf-c-tabs__item {
  border-bottom: 2px solid transparent !important;
  color: var(--tc-surface-low) !important;
  padding: 1rem 1.5rem !important;
  cursor: pointer !important;
  transition: all 0.15s ease;
}

.pf-c-tabs__item:hover {
  color: var(--tc-primary) !important;
}

.pf-c-tabs__item.pf-m-current {
  border-bottom-color: var(--bg-primary) !important;
  color: var(--tc-primary) !important;
  font-weight: 500 !important;
}

.pf-c-tabs__content {
  padding: 1.5rem !important;
  background-color: #ffffff !important;
}

/* ========== TOOLTIPS ========== */

.pf-c-tooltip {
  background-color: var(--bg-tooltip) !important;
  color: var(--tc-tooltip) !important;
  border-radius: var(--br-xs) !important;
  padding: 0.5rem 0.75rem !important;
  font-size: 0.875rem !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ========== PAGINATION ========== */

.pf-c-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem !important;
  border-top: 1px solid var(--bg-surface-border) !important;
  background-color: #ffffff !important;
}

/* ========== AVATAR ========== */

.pf-c-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 600 !important;
  background-color: var(--bg-primary) !important;
  color: var(--tc-on-primary) !important;
}

/* ========== UTILITY CLASSES ========== */

.text-primary {
  color: var(--tc-primary) !important;
}

.text-secondary {
  color: var(--tc-secondary) !important;
}

.text-danger {
  color: var(--tc-danger) !important;
}

.text-success {
  color: var(--tc-secondary) !important;
}

.text-warning {
  color: var(--tc-warning) !important;
}

.text-info {
  color: var(--tc-info) !important;
}

.text-muted {
  color: var(--tc-surface-low) !important;
}

/* Links. Sidebar nav links are excluded: they sit on the dark PF5 nav, where PatternFly's own
   white link colour is the readable one (#2E6DB5 on #212427 is 2.9:1). */
a:not(.pf-v5-c-nav__link) {
  color: var(--tc-link) !important;
  text-decoration: none !important;
  transition: opacity 0.15s ease;
}

a:hover {
  opacity: 0.8;
  text-decoration: underline !important;
}

a:focus {
  outline: var(--focus-outline);
  outline-offset: 2px;
}

/* ========== RESPONSIVE ADJUSTMENTS ========== */

@media (max-width: 768px) {
  .pf-c-page__main {
    padding: 1rem !important;
  }

  .pf-c-page__main-section {
    padding: 1rem !important;
  }

  .pf-c-card {
    padding: 1rem !important;
  }

  .pf-c-page__header-brand {
    padding: 0.75rem 1rem !important;
  }

  .pf-c-page__header-tools {
    padding: 0.75rem 1rem !important;
  }
}

@media (max-width: 640px) {
  .pf-c-title.pf-m-lg {
    font-size: 1.25rem !important;
  }

  .pf-c-title.pf-m-md {
    font-size: 1.125rem !important;
  }

  .pf-c-button {
    width: 100% !important;
  }
}

/* ========== ANIMATIONS ========== */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.pf-c-modal-box {
  animation: fadeIn 0.2s ease-out;
}

/* ========== ACCESSIBILITY ========== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

*:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-offset);
}

/* ========== SCROLLBAR ========== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-surface-scroll-track);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-surface-scroll-thumb);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: hsl(0deg 0% 0% / 30%);
}

/* ========== PRINT STYLES ========== */

@media print {
  .pf-c-page__header,
  .pf-c-page__sidebar,
  .pf-c-pagination {
    display: none !important;
  }

  .pf-c-page__main {
    padding: 0 !important;
  }

  body {
    background-color: #ffffff !important;
  }
}
