html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

/* ========================================
   FOCUS STATES & ACCESSIBILITY
   ======================================== */

/* Verbesserte Fokus-Styles für alle interaktiven Elemente */
.btn:focus, 
.btn:active:focus, 
.btn-link.nav-link:focus, 
.form-control:focus, 
.form-check-input:focus,
.form-select:focus,
.page-link:focus,
a:focus,
button:focus {
  outline: 3px solid #258cfb;
  outline-offset: 2px;
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* Fokus-Sichtbarkeit für Tastaturnutzer */
*:focus-visible {
  outline: 3px solid #258cfb;
  outline-offset: 2px;
}

/* Skip-Link für Screenreader und Tastaturnutzer */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #258cfb;
  color: white;
  padding: 8px;
  text-decoration: none;
  z-index: 100;
  border-radius: 0 0 4px 0;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid #ffffff;
}

/* Screen-Reader only content */
.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;
}

.sr-only-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* Verbesserte Fehlerdarstellung */
.field-validation-error {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: #dc3545;
  font-weight: 500;
}

.input-validation-error {
  border-color: #dc3545 !important;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
  padding-right: calc(1.5em + 0.75rem);
}

.validation-summary-errors {
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid #dc3545;
  border-radius: 0.375rem;
  background-color: #f8d7da;
  color: #721c24;
}

.validation-summary-errors ul {
  margin-bottom: 0;
  padding-left: 1.5rem;
}

/* Tabellen-Accessibility */
.table-responsive {
  position: relative;
}

.table th[scope="col"],
.table th[scope="row"] {
  font-weight: 600;
}

/* Sortierbare Table Headers */
.sortable-header {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease-in-out;
}

.sortable-header:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.sortable-header:focus {
  background-color: rgba(0, 0, 0, 0.075);
  outline: 2px solid #258cfb;
  outline-offset: -2px;
}

/* Modal-Accessibility */
.modal {
  overflow-x: hidden;
  overflow-y: auto;
}

.modal-dialog {
  margin: 1.75rem auto;
}

.modal.show .modal-dialog {
  transform: none;
}

/* Bessere Sichtbarkeit für erforderliche Felder */
.form-label .required,
.form-label .text-danger {
  color: #dc3545;
  font-weight: bold;
  margin-left: 0.2em;
}

/* Hover-Effekte für bessere Sichtbarkeit */
.table-hover tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.04);
  cursor: default;
}

.table tbody tr:focus-within {
  background-color: rgba(37, 140, 251, 0.1);
  outline: 2px solid #258cfb;
  outline-offset: -2px;
}

/* Button-Gruppen Accessibility */
.btn-group > .btn:focus,
.btn-group-vertical > .btn:focus {
  z-index: 3;
}

/* Verbesserte Alert-Sichtbarkeit */
.alert {
  border-left-width: 4px;
}

.alert-dismissible .btn-close:focus {
  box-shadow: 0 0 0 0.25rem rgba(37, 140, 251, 0.5);
}

/* Pagination Accessibility */
.pagination .page-link {
  position: relative;
  display: block;
  text-decoration: none;
}

.pagination .page-item.active .page-link {
  font-weight: 600;
}

.pagination .page-link:focus {
  z-index: 3;
}

/* Card-Focus für Tastaturbedienung */
.card.focusable:focus {
  outline: 2px solid #258cfb;
  outline-offset: 2px;
  box-shadow: 0 0 0 0.25rem rgba(37, 140, 251, 0.25);
}

/* Loading State Accessibility */
.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
}

.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2rem;
  height: 2rem;
  margin-top: -1rem;
  margin-left: -1rem;
  border: 0.25rem solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
  to { transform: rotate(360deg); }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .btn:focus,
  .form-control:focus,
  .form-select:focus,
  a:focus {
    outline-width: 3px;
    outline-offset: 3px;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, 
.form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

/* ========================================
   LOGOUT BUTTON STYLES (Keycloak SSO)
   ======================================== */

/* Primary Logout Button - Red with Shadow */
.btn-danger.shadow-sm {
  box-shadow: 0 0.125rem 0.25rem rgba(220, 53, 69, 0.3) !important;
  font-weight: 500;
  transition: all 0.2s ease-in-out;
}

.btn-danger.shadow-sm:hover {
  box-shadow: 0 0.25rem 0.5rem rgba(220, 53, 69, 0.5) !important;
  transform: translateY(-1px);
}

.btn-danger.shadow-sm:active {
  transform: translateY(0);
  box-shadow: 0 0.125rem 0.25rem rgba(220, 53, 69, 0.3) !important;
}

/* User Info Badge */
.navbar-text .badge {
  font-size: 0.8rem;
  padding: 0.35em 0.65em;
  font-weight: 500;
}

/* Logout Button Icons */
.btn-danger i.bi,
.btn-outline-danger i.bi {
  font-size: 1.1em;
  vertical-align: middle;
}

/* Responsive Logout Button Text */
@media (max-width: 991.98px) {
  .btn-danger .d-none.d-lg-inline {
    display: none !important;
  }
}

/* Hover effect for outline logout button */
.btn-outline-danger:hover {
  background-color: #dc3545;
  border-color: #dc3545;
  color: white;
  transform: scale(1.05);
  transition: all 0.15s ease-in-out;
}

/* Focus states for accessibility */
.btn-danger:focus,
.btn-outline-danger:focus {
  box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.5);
}

/* Loading state for logout (optional) */
.btn-danger.loading::after {
  content: "";
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-left: 0.5em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
  to { transform: rotate(360deg); }
}

.form-floating > .form-control-plaintext:focus::placeholder, 
.form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* Zusätzliche Hilfsstyles */
.footer {
  padding: 1rem 0;
  background-color: #f8f9fa;
}

/* Beschreibungstexte für Formularfelder */
.form-text {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875em;
  color: #6c757d;
}

/* Aktionsspalten in Tabellen */
.action-buttons {
  white-space: nowrap;
}

.action-buttons .btn {
  margin-left: 0.25rem;
}

.action-buttons .btn:first-child {
  margin-left: 0;
}

/* Footer Hover Effects */
.hover-text-primary:hover {
  color: #0d6efd !important;
  text-decoration: underline !important;
}

/* Recruiting Karriere Page Specific Styles */
.hover-shadow {
  transition: box-shadow 0.3s ease-in-out, transform 0.3s ease-in-out;
}

.hover-shadow:hover {
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
  transform: translateY(-5px);
}

/* ========================================
   USER ROLES DROPDOWN & BADGES
   ======================================== */

/* User Dropdown Styling */
#userDropdown {
  cursor: pointer;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  transition: background-color 0.2s ease-in-out;
}

#userDropdown:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Role Badges */
.badge {
  font-weight: 500;
  letter-spacing: 0.025em;
}

.badge.bg-light {
  border: 1px solid #dee2e6;
}

/* Dropdown Menu Enhanced */
.dropdown-menu {
  min-width: 250px;
  border-radius: 0.5rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.dropdown-item {
  padding: 0.5rem 1rem;
  transition: background-color 0.15s ease-in-out;
}

.dropdown-item:hover {
  background-color: #f8f9fa;
}

.dropdown-item.text-danger:hover {
  background-color: #f8d7da;
  color: #dc3545 !important;
}

.dropdown-header {
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: #495057;
  border-bottom: 1px solid #dee2e6;
}

/* Role Category Styling (for /Account/Roles page) */
.role-category {
  border-left: 3px solid #dee2e6;
  padding-left: 1rem;
  margin-bottom: 1rem;
}

.role-badge-item {
  display: inline-block;
  margin: 0.25rem;
}

/* Responsive Adjustments */
@media (max-width: 767.98px) {
  .dropdown-menu {
    min-width: 200px;
  }

  #userDropdown .badge {
    font-size: 0.75rem;
  }
}

/* Animation for Dropdown */
.dropdown-menu {
  animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ======================================== */
/*   MODAL LOGIN BUTTON IN NAVBAR        */
/* ======================================== */

/* Button styled as nav-link but with primary color */
.nav-link-btn {
  border: none;
  background: transparent;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  color: #0d6efd;
  font-weight: 500;
  transition: all 0.2s ease;
  border-radius: 0.375rem;
  cursor: pointer;
}

.nav-link-btn:hover {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.nav-link-btn:active {
  transform: translateY(0);
}

.nav-link-btn i {
  margin-right: 0.25rem;
}

/* Responsive: Make login button full-width on mobile */
@media (max-width: 991px) {
  .nav-link-btn {
    width: 100%;
    display: block;
    text-align: left;
  }
}
