/* ================================================================
   DemoCorp — Keycloak Login Theme — VARIANT B
   Direction : "Quiet Ledger" — graphite ink, warm stone neutrals,
   one precise burnished-bronze accent used sparingly.
   Fonts : Public Sans (UI/body) + JetBrains Mono (overlines / labels)
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Public+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --primary:    #23241f;   /* deep warm graphite ink — sidebar / headings */
    --primary-dk: #171712;   /* pressed state */
    --accent:     #a97d4a;   /* burnished bronze — sparing accent only */
    --accent-soft: rgba(169, 125, 74, 0.13);
    --accent-dk:  #8a6238;
    --white:      #ffffff;
    --bg-light:   #f6f5f2;   /* warm stone page background */
    --bg-grey:    #efede8;   /* input / recessed surface */
    --border:     #ddd8cd;   /* warm hairline */
    --text-dark:  #26251f;
    --text-light: #7d786c;
    --error:      #a3402f;
    --success:    #3f6b52;
    --warning:    #93641f;
}

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

html, body {
    width: 100%;
    height: 100%;
    font-family: 'Public Sans', 'Segoe UI', Arial, sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    font-size: 15px;
    line-height: 1.55;
    font-weight: 400;
}

/* ── RESET KC chrome — tout ce qui vient du template parent ───── */
#kc-header, #kc-header-wrapper, .login-pf-page-header,
#kc-page-title, header.pf-c-login__header, .pf-c-login__header,
#kc-locale, #kc-locale-wrapper,
.pf-c-dropdown#kc-locale,
.pf-v5-c-login__main-header-utilities { display: none !important; }
.card-pf, .login-pf-card {
    background: transparent !important; border: none !important;
    box-shadow: none !important; padding: 0 !important; margin: 0 !important;
}
#kc-container, #kc-container-wrapper, .login-pf-page {
    background: transparent !important; padding: 0 !important; margin: 0 !important;
}
body.login-pf { background: var(--bg-light) !important; }

/* ================================================================
   LAYOUT — Deux colonnes
   ================================================================ */

.kc-business-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* ================================================================
   SIDEBAR GAUCHE
   ================================================================ */

.kc-business-sidebar {
    position: relative;
    flex: 0 0 42%;
    max-width: 42%;
    background: var(--primary);
    border-right: 1px solid rgba(169, 125, 74, 0.35);
    color: var(--white);
    padding: 64px 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
}

/* Subtle paper-grain texture — quiet, non-decorative, no new markup */
.kc-business-sidebar::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.05;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    background-size: 180px 180px;
}

/* Faint bronze vignette in the lower corner — restrained, not a gradient hero */
.kc-business-sidebar::after {
    content: "";
    position: absolute;
    right: -10%;
    bottom: -18%;
    width: 46%;
    padding-bottom: 46%;
    pointer-events: none;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(169, 125, 74, 0.16) 0%, rgba(169, 125, 74, 0) 70%);
}

.kc-sidebar-content {
    position: relative;
    z-index: 1;
    max-width: 380px;
    width: 100%;
}

.kc-sidebar-logo-img {
    width: 168px;
    height: auto;
    margin-bottom: 2.8rem;
    display: block;
    filter: brightness(0) invert(1);
    opacity: 0.94;
}

.kc-sidebar-content h1 {
    font-size: 1.85rem;
    font-weight: 500;
    line-height: 1.32;
    margin-bottom: 1.1rem;
    letter-spacing: -0.1px;
    color: var(--white);
}

.kc-sidebar-content p {
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 2.4rem;
    color: rgba(255, 255, 255, 0.62);
    font-weight: 300;
}

.kc-features-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.kc-features-list li {
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.76);
    display: flex;
    align-items: center;
    gap: 14px;
    font-weight: 300;
    letter-spacing: 0.1px;
}

.kc-features-list li::before {
    content: "";
    display: inline-block;
    width: 5px;
    height: 5px;
    min-width: 5px;
    background: var(--accent);
    border-radius: 50%;
}

/* ================================================================
   MAIN DROITE
   ================================================================ */

.kc-business-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 60px 60px 44px;
    background: var(--white);
}

/* ── Header ── */
.kc-business-header {
    margin-bottom: 44px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--border);
}

.kc-logo-business {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

.kc-logo-img {
    width: 140px;
    height: auto;
    display: block;
}
.kc-logo-dark  { display: none; }
.kc-logo-light { display: block; }
body.dark-mode .kc-logo-light { display: none; }
body.dark-mode .kc-logo-dark  { display: block; filter: brightness(0) invert(1); }

.kc-logo-subtitle {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--accent-dk);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-left: 2px;
}

.kc-business-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.kc-business-header-section {
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--primary);
    letter-spacing: -0.1px;
}

/* ── Contenu ── */
.kc-business-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.kc-form-container {
    max-width: 420px;
}

/* ================================================================
   FORMULAIRE
   ================================================================ */

.kc-login-form-business {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.kc-form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.kc-form-group label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-dark);
    display: block;
    letter-spacing: 0.1px;
}

.kc-input-business {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--bg-grey);
    font-size: 0.93rem;
    font-family: inherit;
    color: var(--text-dark);
    outline: none;
    transition: border-color 0.15s, background 0.15s;
    box-sizing: border-box;
}

.kc-input-business:hover  { border-color: #c7c0b0; }
.kc-input-business:focus  {
    border-color: var(--accent);
    background: var(--white);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.kc-input-business[aria-invalid="true"] { border-color: var(--error); }

/* ── Password wrapper ── */
.kc-password-wrapper {
    position: relative;
    width: 100%;
    height: 44px;
    display: block;
}

.kc-password-wrapper .kc-input-business {
    padding-right: 58px;
}

.kc-toggle-password {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    height: 32px;
    width: 36px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-light);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: border-color 0.15s, color 0.15s;
    padding: 0;
}

.kc-toggle-password i { display: none; }

.kc-toggle-password::before {
    content: "👁";
    font-size: 0.9rem;
    line-height: 1;
    opacity: 0.75;
}

.kc-toggle-password:hover {
    border-color: var(--accent);
    color: var(--accent-dk);
}

/* ── Bouton connexion ── */
.kc-button-business {
    width: 100%;
    padding: 13px 24px;
    margin-top: 8px;
    background: var(--primary);
    border: none;
    border-radius: 3px;
    color: var(--white);
    font-size: 0.92rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    letter-spacing: 0.2px;
    transition: background 0.15s;
}

.kc-button-business:hover    { background: var(--primary-dk); }
.kc-button-business:disabled { opacity: 0.5; cursor: not-allowed; }

.kc-button-outline {
    display: block;
    width: 100%;
    padding: 12px 24px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-dark);
    font-size: 0.88rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    letter-spacing: 0.15px;
    text-align: center;
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s;
}
.kc-button-outline:hover {
    border-color: var(--accent);
    color: var(--accent-dk);
    text-decoration: none;
}

.kc-separator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0 10px;
    color: #a19c8f;
    font-size: 0.76rem;
    letter-spacing: 0.2px;
}
.kc-separator::before,
.kc-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── Mot de passe oublié ── */
.kc-password-recovery {
    text-align: right;
    margin-top: 2px;
}

.kc-password-recovery a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 400;
    transition: color 0.15s;
}

.kc-password-recovery a:hover { color: var(--accent-dk); text-decoration: underline; }

/* ── Alerts ── */
.kc-alert {
    padding: 13px 16px;
    border-radius: 3px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    font-weight: 400;
    border: 1px solid transparent;
}

.kc-alert-error {
    background: rgba(163, 64, 47, 0.06);
    border-color: rgba(163, 64, 47, 0.35);
    color: var(--error);
}

/* ── Contrôles header ── */
.kc-header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* ── Sélecteur de langue ── */
.kc-locale-business {
    display: flex;
    align-items: center;
}

.kc-locale-select-business {
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--bg-grey);
    color: var(--text-dark);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 1px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}

.kc-locale-select-business:focus  { border-color: var(--accent); }
.kc-locale-select-business:hover  { border-color: var(--accent); }

/* ── Toggle thème ── */
.kc-theme-toggle {
    height: 32px;
    width: 32px;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--bg-grey);
    color: var(--text-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    line-height: 1;
    padding: 0;
    transition: border-color 0.15s, background 0.15s;
    flex-shrink: 0;
}

.kc-theme-toggle:hover {
    border-color: var(--accent);
    background: var(--white);
}

.kc-theme-toggle .icon-moon { display: none; }
.kc-theme-toggle .icon-sun  { display: block; }

body.dark-mode .kc-theme-toggle .icon-sun  { display: none; }
body.dark-mode .kc-theme-toggle .icon-moon { display: block; }

/* ── Footer ── */
.kc-business-footer {
    margin-top: 44px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-light);
    font-size: 0.76rem;
    font-weight: 300;
    letter-spacing: 0.1px;
}

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

@media (max-width: 1024px) {
    .kc-business-container { flex-direction: column; }
    .kc-business-sidebar   { flex: none; max-width: 100%; min-height: auto; padding: 40px 36px; }
    .kc-business-main      { padding: 40px 36px; }
}

@media (max-width: 768px) {
    .kc-business-sidebar   { padding: 32px 26px; }
    .kc-sidebar-content h1 { font-size: 1.55rem; }
    .kc-business-main      { padding: 32px 26px; }
    .kc-input-business     { font-size: 16px; }
    .kc-business-header-row { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
    .kc-business-sidebar   { padding: 24px 20px; }
    .kc-sidebar-content h1 { font-size: 1.35rem; }
    .kc-business-main      { padding: 24px 20px; }
    .kc-business-header-section { font-size: 1.2rem; }
}

/* ================================================================
   DARK MODE
   ================================================================ */

body.dark-mode { background: #16150f; color: #e8e5da; }
body.dark-mode .kc-business-main { background: #1c1b15; }
body.dark-mode .kc-business-header { border-bottom-color: #33312a; }
body.dark-mode .kc-business-header-section { color: #e8e5da; }
body.dark-mode .kc-logo-subtitle { color: #b98f5c; }
body.dark-mode .kc-form-group label { color: #b7b3a5; }
body.dark-mode .kc-input-business {
    background: #14140f;
    color: #e8e5da;
    border-color: #33312a;
}
body.dark-mode .kc-input-business:focus {
    background: #17160f;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(169, 125, 74, 0.16);
}
body.dark-mode .kc-locale-select-business {
    background: #14140f;
    color: #e8e5da;
    border-color: #33312a;
}
body.dark-mode .kc-theme-toggle {
    background: #14140f;
    border-color: #33312a;
    color: #e8e5da;
}
body.dark-mode .kc-theme-toggle:hover {
    background: #1f1e17;
    border-color: var(--accent);
}
body.dark-mode .kc-toggle-password {
    color: #b7b3a5;
    border-color: #33312a;
}
body.dark-mode .kc-toggle-password:hover {
    border-color: var(--accent);
    color: #d9b47f;
}
body.dark-mode .kc-password-recovery a { color: #9b9787; }
body.dark-mode .kc-password-recovery a:hover { color: #d9b47f; }
body.dark-mode .kc-alert-error {
    background: rgba(163, 64, 47, 0.12);
    border-color: rgba(163, 64, 47, 0.4);
    color: #d99686;
}
body.dark-mode .kc-separator { color: #4a473c; }
body.dark-mode .kc-separator::before,
body.dark-mode .kc-separator::after { background: #33312a; }
body.dark-mode .kc-button-outline { border-color: #33312a; color: #d8d4c6; }
body.dark-mode .kc-button-outline:hover {
    border-color: var(--accent);
    color: #d9b47f;
}
body.dark-mode .kc-business-footer { border-top-color: #33312a; color: #6f6b5d; }
