/* ========================================
   PREMIUM VOIP KEYCLOAK THEME - UNIFIED DESIGN SYSTEM
   ========================================

   This CSS file implements a 5-section design system:
   1. LOGO SECTION - Centered logo with consistent margins
   2. INTRO SECTION - Page titles and descriptions
   3. CONTENT SECTION - Form inputs and fields
   4. ACTION SECTION - Primary buttons
   5. SECONDARY LINKS - Navigation and helper links

   GLOBAL STYLE VARIABLES:
   - Input background: #f9fafb (line ~177)
   - Input border: #d1d5db (line ~179)
   - Button background: #2c3e50 (line ~269)
   - Title margins: 30px 0 (line ~119)
   - Logo margins: 30px 0 (line ~63)

   To change a style globally, modify the values in the
   "GLOBAL" sections below.
   ======================================== */

/* ========================================
   RESET AND BASE STYLES
   ======================================== */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  font-size: 14px;
  line-height: 1.5;
  color: #636c72;
  background: #f8f9fa !important;
  min-height: 100vh;
}

/* ========================================
   MAIN CONTAINER - LIKE MYPROFILE CARD
   ======================================== */

.login-pf-page {
  background: #f8f9fa !important;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* GLOBAL CARD STYLING - consistent across ALL screens */
.card-pf,
.login-pf-page .card-pf,
.kc-form-wrapper,
.login-pf-form-wrapper {
  background: #fff !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
  border: none !important;
  max-width: 460px !important; /* PRZYWRÓCONA ORYGINALNA SZEROKOŚĆ */
  width: 100% !important;
  overflow: hidden !important;
  padding: 2rem !important; /* PRZYWRÓCONY ORYGINALNY PADDING */
  margin: 0 auto !important;
  box-sizing: border-box !important;
}

/* UPORZĄDKOWANIE KONTENERÓW - wszystkie elementy muszą być w karcie */
.login-pf-form,
.kc-form,
form,
.login-pf-form > *,
.kc-form > *,
form > * {
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* KEYCLOAK CONTENT WRAPPERS - muszą być w kontenerze */
.col-md-10,
.col-md-12,
div[class*="col-"],
div[class*="kcContent"],
div[class*="kcLabel"],
div[class*="kcForm"] {
  max-width: 100% !important;
  width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  box-sizing: border-box !important;
}

/* ========================================
   SECTION 1: LOGO - CONSISTENT MARGINS & CENTERING
   ======================================== */

.login-pf-header {
  background: white;
  padding: 0;
  text-align: center;
  border-bottom: none;
  margin-bottom: 2rem;
}

/* Logo container - FULL WIDTH for proper centering */
.login-pf-page .card-pf .login-pf-header .kc-logo,
.kc-logo {
  width: 100% !important;
  text-align: center !important;
  margin: 30px 0 30px 0 !important; /* Equal top/bottom margins */
  padding: 0 !important;
}

/* Logo image - constrain size, not container */
.kc-logo img {
  max-width: 160px !important;
  height: auto !important;
  display: inline-block !important;
}

.kc-logo-link {
  display: inline-block !important;
  line-height: 0 !important;
}

.kc-logo-link:hover {
  text-decoration: none !important;
}

/* ========================================
   LANGUAGE SELECTOR - CLEAN DROPDOWN
   ======================================== */

#kc-locale {
  position: absolute !important;
  top: 15px !important;
  right: 20px !important;
  z-index: 1000 !important;
}

#kc-locale select {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  background: transparent !important;
  border: none !important;
  border-radius: 4px !important;
  padding: 4px 24px 4px 8px !important;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e") !important;
  background-position: right 0.5rem center !important;
  background-repeat: no-repeat !important;
  background-size: 1em 1em !important;
  cursor: pointer !important;
  font-size: 14px !important;
  color: #6c757d !important;
}

#kc-locale select::-ms-expand {
  display: none !important;
}

/* ========================================
   SECTION 2: INTRO - TITLES AND DESCRIPTIONS
   ======================================== */

/* Form title - consistent across all screens */
.kc-form-title,
.login-pf-form h1,
.login-pf-header h1,
h1, h2 {
  text-align: center !important;
  font-size: 24px !important;
  font-weight: 500 !important;
  color: #374151 !important;
  margin: 30px 0 30px 0 !important; /* Equal margins like logo */
}

/* Instructions and descriptions */
.login-pf-form .instruction {
  text-align: center !important;
  font-size: 14px !important;
  color: #6c757d !important;
  margin: 0 0 2rem 0 !important;
  padding: 1rem 2rem !important;
}

/* ========================================
   SECTION 3: CONTENT - FORM LAYOUT
   ======================================== */

.login-pf-form {
  padding: 0 !important;
  position: relative;
  min-height: auto;
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box !important;
  overflow: hidden !important; /* Zapobiega wykraczaniu elementów */
  margin: 0 !important;
}

/* ========================================
   FORM CONTROLS - LIKE MYPROFILE
   ======================================== */

.form-group {
  margin-bottom: 1.5rem;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #6c757d;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* GLOBAL INPUT STYLING - applies to ALL input fields across all screens */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"],
select,
textarea,
.form-control,
.login-pf-form input,
.card-pf input,
input[class*="kc-input"],
.pf-c-form-control,
input[class*="pf-c-form-control"] {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important; /* OGRANICZENIE - nie może wykraczać */
  padding: 0.75rem !important;
  font-size: 0.95rem !important;
  line-height: 1.5 !important;
  color: #636c72 !important;
  background: #f9fafb !important; /* CHANGE THIS COLOR TO APPLY GLOBALLY */
  border: 1px solid #d1d5db !important;
  border-radius: 8px !important;
  outline: none !important;
  transition: all 0.2s ease !important;
  box-sizing: border-box !important;
  margin: 0 !important; /* Usuń domyślne marginesy */
}

/* reCAPTCHA injects a hidden textarea with a token; keep it hidden even with global textarea styling. */
textarea.g-recaptcha-response,
textarea[name="g-recaptcha-response"] {
  display: none !important;
}

/* GLOBAL INPUT HOVER STATE - applies to all inputs */
input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
input[type="tel"]:hover,
input[type="url"]:hover,
select:hover,
textarea:hover,
.form-control:hover,
.login-pf-form input:hover,
.card-pf input:hover,
input[class*="kc-input"]:hover,
.pf-c-form-control:hover,
input[class*="pf-c-form-control"]:hover {
  border-color: #9ca3af !important;
  background-color: #fff !important;
}

/* GLOBAL INPUT FOCUS STATE - applies to all inputs */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
select:focus,
textarea:focus,
.form-control:focus,
.login-pf-form input:focus,
.card-pf input:focus,
input[class*="kc-input"]:focus,
.pf-c-form-control:focus,
input[class*="pf-c-form-control"]:focus {
  border-color: #6b7280 !important;
  background-color: #fff !important;
  box-shadow: none;
  outline: none;
}

/* Required asterisk styling */
.required {
  color: #d35232 !important;
  margin-left: 4px !important;
  font-size: 14px !important;
}
/* ========================================
   CHECKBOX STYLING - REMEMBER ME
   ======================================== */

.checkbox {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  margin: 1rem 0 !important;
  padding: 0 !important;
  text-align: left !important;
  width: 100% !important;
}

.checkbox input[type="checkbox"] {
  width: 16px !important;
  height: 16px !important;
  margin: 0 8px 0 0 !important;
  flex-shrink: 0 !important;
  cursor: pointer !important;
}

.checkbox label {
  display: inline-flex !important;
  align-items: center !important;
  margin: 0 !important;
  cursor: pointer !important;
  font-size: 14px !important;
  color: #6b7280 !important;
  user-select: none !important;
  text-transform: none !important;
  letter-spacing: normal !important;
}

/* ========================================
   SECTION 4: ACTION - BUTTONS (GLOBAL STYLING)
   ======================================== */

/* GLOBAL BUTTON STYLING - applies to ALL primary buttons */
.btn-primary,
#kc-login,
input[type="submit"],
button[type="submit"],
.btn.btn-primary,
button[class*="kc-button"],
input[class*="kc-button"],
.pf-c-button,
.pf-c-button--primary,
button[class*="pf-c-button"] {
  background: #2c3e50 !important; /* CHANGE THIS COLOR TO APPLY GLOBALLY */
  border-color: #2c3e50 !important;
  color: #fff !important;
  border: none !important;
  border-radius: 6px !important;
  padding: 12px 24px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  width: 100% !important;
  max-width: 100% !important; /* OGRANICZENIE - nie może wykraczać */
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  margin: 1.5rem 0 1rem 0 !important;
  text-decoration: none !important;
  display: inline-block !important;
  text-align: center !important;
  box-sizing: border-box !important;
}

/* GLOBAL BUTTON HOVER STATE */
.btn-primary:hover,
#kc-login:hover,
input[type="submit"]:hover,
button[type="submit"]:hover,
.btn.btn-primary:hover,
button[class*="kc-button"]:hover,
input[class*="kc-button"]:hover,
.pf-c-button:hover,
.pf-c-button--primary:hover,
button[class*="pf-c-button"]:hover {
  background: #1e4a7a !important;
  border-color: #1e4a7a !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(26, 40, 55, 0.3) !important;
  text-decoration: none !important;
  color: #fff !important;
}

/* ========================================
   SECTION 5: SECONDARY LINKS - CONSISTENT POSITIONING
   ======================================== */

/* GLOBAL LINK STYLING */
a {
  color: #0da8e0 !important;
  text-decoration: none !important;
}

a:hover {
  color: #0b8bb8 !important;
  text-decoration: underline !important;
}

/* SECONDARY LINKS - consistent positioning across all screens */
.kc-back-link,
#kc-registration,
#kc-registration-container,
.login-pf-signup,
.kc-info,
.kc-form-options {
  text-align: center !important;
  margin-top: 20px !important;
  padding-top: 0 !important;
}

/* REMEMBER ME CHECKBOX - wyrównany do lewej, bliżej inputa */
.checkbox {
  text-align: left !important;
  margin: 8px 0 15px 0 !important; /* Mniejszy margines góra, bliżej inputa */
  padding-left: 0 !important;
}

.checkbox label {
  display: flex !important;
  align-items: center !important;
  font-weight: normal !important;
  color: #6c757d !important;
  font-size: 14px !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  cursor: pointer !important;
  margin: 0 !important; /* usuń marginesy */
  padding: 0 !important; /* usuń padding (zielony obszar na screenie) */
}

.checkbox input[type="checkbox"] {
  position: static !important; /* nadpisz Bootstrap absolute */
  width: 16px !important;
  height: 16px !important;
  margin: 0 10px 0 0 !important; /* lewy = 0, prawy = 10 */
  cursor: pointer !important;
  flex-shrink: 0 !important; /* Nie pozwól na zmniejszanie checkboxa */
}

/* Forgot password link - centered */
.kc-form-options a,
a[href*="reset-credentials"],
a[href*="login-actions/reset-credentials"] {
  display: block !important;
  text-align: center !important;
  margin: 15px 0 !important;
}

/* Registration footer with border */
.login-pf-signup {
  border-top: 1px solid #e9ecef;
  padding-top: 20px;
}

/* ========================================
   ALERTS AND MESSAGES
   ======================================== */

.alert {
  padding: 1rem;
  margin-bottom: 1.5rem;
  border-radius: 8px;
  border: none;
  text-align: center;
}

.alert-error {
  background-color: #fef2f2;
  color: #dc2626;
  border-left: 4px solid #dc2626;
}

.alert-success {
  background-color: #f0fdf4;
  color: #16a34a;
  border-left: 4px solid #16a34a;
}

.alert-warning {
  background-color: #fffbeb;
  color: #d97706;
  border-left: 4px solid #d97706;
}

/* Info messages - centered like MyProfile */
#kc-info-message {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  text-align: center !important;
  padding: 2rem !important;
  min-height: 200px !important;
}

#kc-info-message h2 {
  font-size: 1.25rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 2rem;
  line-height: 1.5;
}

#kc-error-message,
#kc-info-message {
  text-align: center;
}

#kc-error-message {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  padding: 1rem 0 0.5rem;
}

.kc-page-intro {
  max-width: 32rem;
  margin: 0;
  padding: 0;
  color: #6b7280;
  font-size: 0.95rem;
  line-height: 1.7;
}

.kc-page-summary {
  width: 100%;
  max-width: 32rem;
  margin: 0;
  padding: 0.9rem 1rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  color: #374151;
  font-size: 0.95rem;
  line-height: 1.6;
}

.kc-page-summary-label {
  font-weight: 600;
}

.kc-page-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 20rem;
  margin-top: 0.5rem;
}

.kc-action-button {
  display: inline-block;
  width: 100%;
  padding: 12px 24px;
  border-radius: 6px;
  background: #2c3e50;
  color: #fff !important;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  text-decoration: none !important;
  transition: all 0.2s ease;
}

.kc-action-button:hover {
  background: #1e4a7a;
  color: #fff !important;
  text-decoration: none !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26, 40, 55, 0.3);
}

.kc-action-button--secondary {
  background: #fff;
  border: 1px solid #d1d5db;
  color: #374151 !important;
}

.kc-action-button--secondary:hover {
  background: #f9fafb;
  color: #111827 !important;
  border-color: #9ca3af;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 480px) {
  .card-pf {
    margin: 10px;
    max-width: none;
    padding: 1.5rem;
  }

  .login-pf-form h1 {
    font-size: 20px !important;
  }

  #kc-locale {
    top: 10px !important;
    right: 15px !important;
  }
}

/* ========================================
   GLOBAL OVERRIDES - ENSURE CONSISTENCY
   ======================================== */

/* Hide default Keycloak branding */
.login-pf-brand {
  display: none;
}

/* WYMUSZENIE KONTENERÓW - wszystkie elementy muszą być w karcie */
* {
  box-sizing: border-box !important;
}

.card-pf *,
.login-pf-form *,
.kc-form * {
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* Force consistent styling for any missed elements */
.login-pf-page input,
.card-pf input,
.kc-form input {
  background: #f9fafb !important;
  border: 1px solid #d1d5db !important;
  max-width: 100% !important;
  width: 100% !important;
}

.login-pf-page button:not(.kc-country-close),
.card-pf button:not(.kc-country-close),
.kc-form button:not(.kc-country-close) {
  background: #2c3e50 !important;
  border-color: #2c3e50 !important;
  max-width: 100% !important;
  width: 100% !important;
}

/* KEYCLOAK SPECIFIC CLASSES - ensure they match our global styles */
.pf-c-form-control,
input.pf-c-form-control,
.form-control {
  background: #f9fafb !important;
  border: 1px solid #d1d5db !important;
  padding: 0.75rem !important;
  border-radius: 8px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.pf-c-button,
.pf-c-button--primary,
button.pf-c-button,
input.pf-c-button {
  background: #2c3e50 !important;
  border-color: #2c3e50 !important;
  color: #fff !important;
  width: 100% !important;
  padding: 12px 24px !important;
  border-radius: 6px !important;
}

/* Ensure all titles are centered */
.login-pf-page h1,
.login-pf-page h2,
.card-pf h1,
.card-pf h2 {
  text-align: center !important;
  margin: 30px 0 !important;
}

/* Logout confirmation screen */
.kc-logout-wrapper {
  text-align: center;
}

.kc-logout-message {
  margin: 0 0 1.5rem 0;
  color: #6c757d;
  font-size: 14px;
}

.kc-logout-actions {
  margin-top: 0.5rem;
}

  /* Registration country modal (Keycloak theme) */
  .kc-country-text {
    margin: 0;
    font-size: 0.9rem;
    color: #6c757d;
    text-transform: none;
    line-height: 1.4;
  }

  .kc-country-link {
    font-weight: 600;
    text-transform: none;
  }

  .kc-country-modal {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 12px;
    z-index: 1100;
  }

  .kc-country-modal.is-open {
    display: flex;
  }

  .kc-country-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    border-radius: 12px;
  }

  .kc-country-modal-panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 100%;
    height: 80%;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  }

.kc-country-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

  .kc-country-modal-title {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
  }

.kc-country-close {
  background: #fff;
  color: #6b7280;
  border: 0;
  cursor: pointer;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
  text-transform: none;
}

.kc-country-close:hover {
  color: #374151;
}

  .kc-country-list {
    flex: 1;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 6px 0;
  }

  .kc-country-option,
  .kc-country-empty {
    padding: 8px 12px;
    font-size: 15px;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: default;
  }

  .kc-country-option + .kc-country-option {
    border-top: 1px solid #f1f5f9;
  }

  .kc-country-empty {
    color: #6c757d;
  }

  .kc-password-requirements {
    margin-top: 8px;
    font-size: 12px;
    color: #6c757d;
  }

  .kc-password-requirements.is-hidden {
    display: none;
  }

  .kc-password-title {
    font-weight: 600;
    margin-bottom: 6px;
  }

  .kc-password-list {
    margin: 0;
    padding-left: 16px;
  }

  .kc-password-list li {
    margin: 2px 0;
  }

  .kc-password-list li.is-valid {
    color: #1f7a3f;
    font-weight: 600;
  }

.kc-password-list li.is-invalid {
  color: #b42318;
}


