/* =========================================================
   Pravdan PWM Theme (clean replacement)
   Files:
     themes/pravdan/style.css
     themes/pravdan/bg.png
   Goals:
     - Dark/glass cards on top of a bright background
     - Fix PWM oddities: empty <p>, utility forms, buttonbars, menubutton text
     - Stable layout across zoom
     - Tiles: icon LEFT, title+subtitle RIGHT (no vertical letter-wrap)
   ========================================================= */


/* =========================
   0) Reset & base
   ========================= */

*,
*::before,
*::after { box-sizing: border-box; }

html { font-size: 16px; }

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;

  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.5;

  background-image: url("bg.png");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

/* No global dimmer overlay (you disabled it and wanted vivid background) */
body::before { display: none !important; }

/* PWM wrapper stacking */
#wrapper, #header, #centerbody, #footer {
  position: relative;
  z-index: 1;
  float: none !important;
  clear: both;
  width: 100%;
  max-width: 100%;
}

/* PWM header is usually empty */
#header { display: none; }

/* Global center column for non-tile pages */
#centerbody {
  width: min(900px, 92vw);
  margin: clamp(2rem, 6vh, 5rem) auto clamp(2rem, 5vh, 4rem);
  padding: 0;
}

/* Page titles */
#page-content-title {
  margin: 0 0 1rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.98);
  text-align: left;
  letter-spacing: 0.2px;
}

/* Default text colors (PWM sometimes assumes light backgrounds) */
body { color: rgba(245, 248, 255, 0.95); }
p, li, span, label { color: rgba(235, 240, 250, 0.92); }
h1, h2, h3, h4, h5 { color: rgba(255, 255, 255, 0.98); }

/* Links */
a {
  color: rgba(165, 210, 255, 0.95);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* =========================
   1) Glass card primitives
   ========================= */

:root {
  --card-bg: rgba(16, 20, 28, 0.78);
  --card-border: rgba(255,255,255,0.10);
  --card-shadow: 0 14px 40px rgba(0,0,0,0.50);
  --card-blur: blur(10px);

  --muted: rgba(210, 225, 245, 0.85);
  --text: rgba(245, 248, 255, 0.95);

  --accent: rgba(120, 190, 255, 0.95);
}

.pwm-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  backdrop-filter: var(--card-blur);
}

/* Make common PWM panes readable (do NOT card every form) */
.tab-content-pane,
#PasswordRequirements,
.pwm-form-captcha {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  backdrop-filter: var(--card-blur);
  padding: 1.25rem 1.5rem;
}

/* If a pane contains a form, don’t double-card it */
.tab-content-pane form {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  padding: 0 !important;
}

/* =========================
   2) Inputs & buttons
   ========================= */

/* Baseline sizing */
input, select, textarea, button { font-size: 1rem; }

/* Inputs: use a LIGHT background (matches your current direction) */
input[type="text"],
input[type="password"],
input[type="email"],
textarea,
select {
  background: rgba(255,255,255,0.88) !important;
  color: rgba(10, 14, 20, 0.95) !important;
  border: 1px solid rgba(10, 14, 20, 0.18) !important;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  outline: none;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
textarea:focus,
select:focus {
  border-color: rgba(90, 160, 255, 0.55) !important;
  box-shadow: 0 0 0 3px rgba(90, 160, 255, 0.18);
}

input::placeholder,
textarea::placeholder {
  color: rgba(10, 14, 20, 0.45) !important;
}

/* Generic buttons */
button,
input[type="submit"],
input[type="button"] {
  padding: 0.65rem 0.95rem;
  font-weight: 650;
  color: rgba(10, 14, 20, 0.95) !important;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
button:hover,
input[type="submit"]:hover,
input[type="button"]:hover {
  background: rgba(120, 190, 255, 1);
}

/* Button bars: stop table/flex weirdness */
.buttonbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: flex-start;
  margin-top: 1rem;
}

/* =========================
   3) Messages (no ghost cards)
   ========================= */

#message-wrapper {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  padding: 0 !important;
  margin: 0 0 1rem;
}

#message.nodisplay { display: none !important; }

/* Only visible messages get a card */
#message-wrapper #message:not(.nodisplay) {
  display: block;
  background: rgba(16, 20, 28, 0.72);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.50);
  backdrop-filter: blur(10px);
  padding: 0.85rem 1rem;
}

/* =========================
   4) Login page
   ========================= */

#wrapper.login-wrapper #centerbody {
  width: 100%;
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: start center;
  padding: clamp(2rem, 10vh, 6rem) 1rem 4rem;
}

#wrapper.login-wrapper #page-content-title {
  text-align: center;
  margin-bottom: 1rem;
}

#wrapper.login-wrapper #login {
  width: min(520px, 92vw);
  padding: 1.75rem 1.75rem 1.25rem;
  border-radius: 12px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: 0 14px 40px rgba(0,0,0,0.55);
  backdrop-filter: var(--card-blur);
}

#wrapper.login-wrapper #login input[type="text"],
#wrapper.login-wrapper #login input[type="password"] {
  width: 100%;
  margin: 0.5rem 0 0.9rem;
}

#wrapper.login-wrapper #login button,
#wrapper.login-wrapper #login input[type="submit"] {
  width: 100%;
}

/* Config warning under login (PWM uses table) */
#wrapper.login-wrapper table.noborder {
  margin: 1.25rem auto 0;
  width: min(520px, 92vw);
  padding: 1rem 1.25rem;

  background: rgba(16, 20, 28, 0.55);
  border: 1px solid rgba(255,255,255,0.08);
  border-left: 4px solid rgba(255, 200, 100, 0.6);
  border-radius: 12px;
  backdrop-filter: blur(8px);

  color: rgba(240, 245, 255, 0.90);
}

/* =========================
   5) Tile dashboard (post-login home)
   ========================= */

#centerbody.tile-centerbody {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 auto !important;
  min-height: 100vh;

  display: flex !important;
  flex-direction: column;
  align-items: center !important;
  justify-content: flex-start;

  gap: clamp(1rem, 2.5vh, 1.75rem);
  padding: clamp(2rem, 7vh, 4rem) 1rem clamp(2rem, 6vh, 4rem) !important;
}

/* Each tile link is a block with predictable width */
#centerbody.tile-centerbody > a {
  display: block !important;
  width: min(560px, 92vw) !important;
  max-width: 92vw !important;
  text-decoration: none !important;
}

/* Card */
#centerbody.tile-centerbody .tile {
  width: 100% !important;
  padding: 1.5rem 1.75rem;
  border-radius: 12px;

  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: 0 16px 45px rgba(0,0,0,0.55);
  backdrop-filter: var(--card-blur);

  /* tile itself is just a card */
  display: block !important;
}

#centerbody.tile-centerbody a:hover .tile,
#centerbody.tile-centerbody a:focus .tile {
  border-color: rgba(140, 190, 255, 0.45);
  box-shadow: 0 18px 52px rgba(0,0,0,0.65);
  transform: translateY(-1px);
}

/* IMPORTANT: layout is on .tile-content (per your DOM) */
#centerbody.tile-centerbody .tile-content {
  display: grid !important;
  grid-template-columns: 56px 1fr !important;
  grid-template-rows: auto auto !important;
  column-gap: 1rem !important;
  row-gap: 0.25rem !important;
  align-items: center !important;
  overflow: visible;
}

/* Icon */
#centerbody.tile-centerbody .tile-image {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  display: grid;
  place-items: center;

  grid-column: 1;
  grid-row: 1 / span 2;
}

#centerbody.tile-centerbody .tile-image img,
#centerbody.tile-centerbody .tile-image svg {
  opacity: 0.95;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.35));
}

/* Text (right side) */
#centerbody.tile-centerbody .tile-title,
#centerbody.tile-centerbody .tile-subtitle {
  grid-column: 2;
  text-align: left !important;
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: normal;
}

#centerbody.tile-centerbody .tile-title {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  text-shadow: 0 2px 10px rgba(0,0,0,0.35);
}

#centerbody.tile-centerbody .tile-subtitle {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
  text-shadow: 0 2px 10px rgba(0,0,0,0.30);
  display: block !important;
  opacity: 0.95;
}

/* =========================
   6) Tables (My Account etc.)
   ========================= */

table { border-collapse: collapse; }

table, th, td {
  border-color: rgba(255,255,255,0.12) !important;
}

table.nomargin,
table.noborder {
  width: 100%;
}

th, td {
  padding: 0.6rem 0.75rem;
  background: rgba(255,255,255,0.03);
  color: rgba(240, 245, 255, 0.92);
}

td.key,
td:first-child {
  color: rgba(220, 235, 255, 0.95);
  font-weight: 650;
  background: rgba(255,255,255,0.045);
}

/* =========================
   7) Tabs (My Account / Password Policy)
   ========================= */

.tab-container {
  width: min(980px, 92vw);
  margin: clamp(2rem, 6vh, 4rem) auto;
}

.tab-container .label {
  display: inline-block;
  padding: 0.6rem 0.9rem;
  margin-right: 0.25rem;

  background: rgba(16, 20, 28, 0.55);
  border: 1px solid rgba(255,255,255,0.10);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;

  color: rgba(235, 242, 255, 0.92);
  cursor: pointer;
}

.tab-container .input:checked + .label {
  background: rgba(16, 20, 28, 0.80);
  color: rgba(245, 248, 255, 0.98);
  border-color: rgba(140, 190, 255, 0.35);
}

.tab-content-pane {
  border-top-left-radius: 0;
  margin-top: 0;
}

/* =========================
   8) PWM quirks / fixes
   ========================= */

/* Menubutton black text override (Forgot Password link etc.) */
.menubutton,
.menubutton * {
  color: rgba(245, 248, 255, 0.95) !important;
}

.menubutton {
  width: auto !important;
  max-width: 100% !important;
  display: inline-flex !important;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.9rem !important;

  background: rgba(16, 20, 28, 0.55) !important;
  border: 1px solid rgba(255,255,255,0.10) !important;
  border-radius: 10px !important;
  text-decoration: none !important;
}

td.menubutton-key,
td.menubutton-description {
  vertical-align: middle;
  padding: 0.35rem 0.5rem;
}
td.menubutton-description {
  color: rgba(210, 225, 245, 0.85) !important;
}

/* Hide “push” spacers that explode with zoom */
.push {
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Forms that are table-ish: keep controls from overflowing */
.formFieldWrapper,
.formFieldWrapper * { max-width: 100%; }

.formFieldWrapper input[type="text"],
.formFieldWrapper input[type="password"],
.formFieldWrapper input[type="email"],
.formFieldWrapper select,
.formFieldWrapper textarea {
  width: min(560px, 100%);
}

/* Setup Security Questions: PWM inserts empty filler nodes */
#centerbody > p:empty,
#centerbody > h2:empty,
#pwm-setupResponsesDiv p:empty,
#pwm-setupResponsesDiv h2:empty {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Hide PWM utility forms that should never be visible */
form#skipForm,
form#form-hidden-cancel,
form.hidden {
  display: none !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* Change Password: card the introductory paragraph so it stays readable */
#centerbody[ng-app="changepassword.module"] > p {
  background: rgba(16, 20, 28, 0.72);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.50);
  backdrop-filter: blur(10px);
  padding: 1rem 1.25rem;
  margin: 0 0 1rem;
}

/* =========================================================
   Forgotten Password / Reset Password page fixes
   ========================================================= */

/* Card the intro text (it’s otherwise white-on-busy-background) */
#centerbody > p {
  background: rgba(16, 20, 28, 0.72);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.50);
  backdrop-filter: blur(10px);
  padding: 1rem 1.25rem;
  margin: 0 0 1rem;
}

/* Card the “forgotten password” form itself */
form#searchForm.pwm-form.pwm-form-captcha,
form[action*="forgottenpassword"].pwm-form {
  background: rgba(16, 20, 28, 0.78);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.50);
  backdrop-filter: blur(10px);
  padding: 1.25rem 1.5rem;
}

/* Ensure fields behave inside that form */
form#searchForm .formFieldWrapper input[type="text"],
form#searchForm .formFieldWrapper input[type="email"] {
  width: min(560px, 92vw);
}

/* Kill the usual invisible junk on this page */
#contextSelectorWrapper,
#capslockwarning,
.push {
  display: none !important;
}

/* Hide PWM’s extra “Cancel” utility form (often empty / weird) */
form#form-cancelButton {
  display: none !important;
}

/* =========================================================
   Forgotten Password (form#searchForm) hard-fix
   ========================================================= */

/* Ensure centerbody is truly centered on this view */
#centerbody {
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Make the forgotten password form a centered, fixed-width card */
form#searchForm {
  width: min(560px, 92vw) !important;
  margin: 0 auto !important;

  background: rgba(16, 20, 28, 0.78) !important;
  border: 1px solid rgba(255,255,255,0.10) !important;
  border-radius: 12px !important;
  box-shadow: 0 14px 40px rgba(0,0,0,0.50) !important;
  backdrop-filter: blur(10px) !important;
  padding: 1.25rem 1.5rem !important;
}

/* The intro paragraph: keep it readable and aligned with the form */
#centerbody > p {
  width: min(560px, 92vw) !important;
  margin: 0 auto 1rem !important;

  background: rgba(16, 20, 28, 0.72);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.50);
  backdrop-filter: blur(10px);
  padding: 1rem 1.25rem;
}

/* PWM sprinkles a <br> that creates weird gaps */
form#searchForm > br { display: none !important; }

/* Kill wrappers that are empty/hidden but still mess with layout */
form#searchForm #message_wrapper,
form#searchForm #contextSelectorWrapper {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Make label + input behave like a normal form */
form#searchForm .formFieldWrapper label {
  display: block !important;
  margin: 0 0 0.4rem !important;
  color: rgba(235, 240, 250, 0.92) !important;
  text-align: left !important;
}

/* Force the field to full width inside the card */
form#searchForm .formFieldWrapper .inputfield,
form#searchForm .formFieldWrapper input[type="text"],
form#searchForm .formFieldWrapper input[type="email"] {
  width: 100% !important;
  max-width: 100% !important;
}

/* Button row stays inside the card */
form#searchForm .buttonbar {
  justify-content: flex-start !important;
  margin-top: 1rem !important;
}

/* Hide the extra utility cancel form PWM includes outside the main form */
form#form-cancelButton { display: none !important; }

/* Remove PWM spacer */
.push { display: none !important; }

/* =========================================================
   HARD FIX: Forgotten Password layout (page contains #searchForm)
   Works even if PWM forces width:100% on pwm-form*
   ========================================================= */

@supports selector(:has(*)) {
  /* Detect this specific page by presence of the searchForm */
  #centerbody:has(form#searchForm) {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: clamp(2rem, 6vh, 4rem) 1rem !important;

    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;   /* center the children */
  }

  /* Title stays readable and aligned with the form */
  #centerbody:has(form#searchForm) > #page-content-title {
    width: min(560px, 92vw) !important;
    margin: 0 0 0.75rem !important;
  }

  /* Hide empty filler paragraphs (PWM sometimes has <p></p>) */
  #centerbody:has(form#searchForm) > p:empty {
    display: none !important;
  }

  /* Card + align the real intro text */
  #centerbody:has(form#searchForm) > p {
    width: min(560px, 92vw) !important;
    margin: 0 0 1rem !important;

    background: rgba(16, 20, 28, 0.72);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 12px;
    box-shadow: 0 14px 40px rgba(0,0,0,0.50);
    backdrop-filter: blur(10px);
    padding: 1rem 1.25rem;
  }

  /* The form itself: force a bounded card regardless of PWM width rules */
  #centerbody:has(form#searchForm) form#searchForm {
    width: min(560px, 92vw) !important;
    max-width: min(560px, 92vw) !important;
    margin: 0 !important;

    display: block !important;
    float: none !important;

    background: rgba(16, 20, 28, 0.78) !important;
    border: 1px solid rgba(255,255,255,0.10) !important;
    border-radius: 12px !important;
    box-shadow: 0 14px 40px rgba(0,0,0,0.50) !important;
    backdrop-filter: blur(10px) !important;
    padding: 1.25rem 1.5rem !important;
  }

  /* Remove PWM junk inside the form */
  #centerbody:has(form#searchForm) form#searchForm > br { display: none !important; }

  #centerbody:has(form#searchForm) #contextSelectorWrapper,
  #centerbody:has(form#searchForm) #capslockwarning {
    display: none !important;
  }

  /* Label + input clean layout */
  #centerbody:has(form#searchForm) #formFieldWrapper-sAMAccountName label {
    display: block !important;
    margin: 0 0 0.4rem !important;
    text-align: left !important;
  }

  #centerbody:has(form#searchForm) #formFieldWrapper-sAMAccountName input {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Button row stays inside and aligns nicely */
  #centerbody:has(form#searchForm) form#searchForm .buttonbar {
    justify-content: flex-start !important;
    margin-top: 1rem !important;
  }

  /* Kill the extra utility cancel form PWM places outside the main form */
  #centerbody:has(form#searchForm) form#form-cancelButton {
    display: none !important;
  }

  /* Kill PWM spacer */
  #centerbody:has(form#searchForm) .push {
    display: none !important;
  }
}
