/* Fonts — local woff2 */
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/Montserrat-Bold-cyrillic-ext.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/Montserrat-Bold-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/Montserrat-Bold-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Lato';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/Lato-Regular-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Lato';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/Lato-Regular-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* =============================================
   Design Tokens
   ============================================= */
:root {
  --bb-bg-primary: #010101;
  --bb-bg-secondary: #121212;
  --bb-bg-tertiary: #181818;

  --bb-accent-yellow: #F8E800;
  --bb-accent-yellow-hover: #e6d600;
  --bb-accent-yellow-glow: rgba(248, 232, 0, 0.15);

  --bb-text-primary: #ffffff;
  --bb-text-secondary: #cccccc;
  --bb-text-tertiary: #9d9d9d;
  --bb-text-muted: #737373;

  --bb-border: #2a2a2a;
  --bb-border-focus: var(--bb-accent-yellow);

  --bb-error: #ff4444;
  --bb-error-bg: rgba(255, 68, 68, 0.1);
  --bb-success: #4caf50;

  --bb-radius-sm: 8px;
  --bb-radius-md: 12px;
  --bb-radius-lg: 16px;

  --bb-transition: 0.25s ease-in-out;

  --bb-space-xs: 8px;
  --bb-space-sm: 12px;
  --bb-space-md: 16px;
  --bb-space-lg: 24px;
  --bb-space-xl: 32px;
}

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

body {
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--bb-bg-primary);
  color: var(--bb-text-primary);
  min-height: 100vh;
}

/* =============================================
   Animated Background
   ============================================= */
.kc-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--bb-space-lg);
  background: var(--bb-bg-primary);
  position: relative;
  overflow: hidden;
}

.kc-container::before {
  content: '';
  position: absolute;
  inset: -50%;
  background:
    radial-gradient(ellipse 45% 45% at 20% 50%, rgba(248, 232, 0, 0.13) 0%, transparent 100%),
    radial-gradient(ellipse 35% 35% at 80% 20%, rgba(248, 232, 0, 0.09) 0%, transparent 100%),
    radial-gradient(ellipse 40% 30% at 50% 85%, rgba(248, 232, 0, 0.08) 0%, transparent 100%);
  animation: bgDrift 18s ease-in-out infinite alternate;
  pointer-events: none;
  will-change: transform;
}

@keyframes bgDrift {
  0%   { transform: translate(0, 0) rotate(0deg); }
  33%  { transform: translate(10%, -8%) rotate(3deg); }
  66%  { transform: translate(-8%, 6%) rotate(-2deg); }
  100% { transform: translate(6%, -10%) rotate(2deg); }
}

/* =============================================
   Glassmorphism Card
   ============================================= */
.kc-card {
  background: rgba(18, 18, 18, 0.75);
  backdrop-filter: blur(24px) saturate(120%);
  -webkit-backdrop-filter: blur(24px) saturate(120%);
  border: 1px solid rgba(248, 232, 0, 0.08);
  border-radius: var(--bb-radius-lg);
  padding: 40px var(--bb-space-xl);
  width: 100%;
  max-width: 440px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
  position: relative;
  z-index: 1;
  animation: cardAppear 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cardAppear {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* =============================================
   Header
   ============================================= */
.kc-header {
  text-align: center;
  margin-bottom: var(--bb-space-xl);
}

.kc-logo {
  margin-bottom: 20px;
}

.kc-logo img {
  filter: drop-shadow(0 0 24px rgba(248, 232, 0, 0.1));
  transition: filter 0.4s ease;
}

.kc-logo img:hover {
  filter: drop-shadow(0 0 32px rgba(248, 232, 0, 0.2));
}

.kc-subtitle {
  font-size: 18px;
  color: var(--bb-text-muted);
  letter-spacing: 0.02em;
  margin-bottom: 20px;
  line-height: 1.4;
}

.kc-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--bb-text-primary);
  letter-spacing: -0.02em;
}

/* =============================================
   Forms
   ============================================= */
.kc-form,
.kc-form > form {
  display: flex;
  flex-direction: column;
  gap: var(--bb-space-md);
}

.kc-form-group {
  display: flex;
  flex-direction: column;
  gap: var(--bb-space-xs);
}

.kc-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--bb-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Input wrapper (for icons) */
.kc-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.kc-input-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--bb-text-muted);
  pointer-events: none;
  transition: color var(--bb-transition);
  z-index: 1;
}

.kc-input-wrapper:focus-within .kc-input-icon {
  color: var(--bb-accent-yellow);
}

.kc-input {
  background: var(--bb-bg-tertiary);
  border: 1px solid var(--bb-border);
  border-radius: var(--bb-radius-sm);
  padding: 14px 16px;
  font-size: 15px;
  color: var(--bb-text-primary);
  transition: all var(--bb-transition);
  outline: none;
  font-family: inherit;
  width: 100%;
  caret-color: rgba(248, 232, 0, 0.4);
}

.kc-input-with-icon {
  padding-left: 44px;
}

.kc-input:focus {
  border-color: var(--bb-accent-yellow);
  box-shadow: 0 0 0 3px var(--bb-accent-yellow-glow);
  background: rgba(24, 24, 24, 0.9);
}

.kc-input::placeholder {
  color: var(--bb-text-muted);
}

.kc-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =============================================
   Password Toggle
   ============================================= */
.kc-password-toggle {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--bb-text-muted);
  transition: color var(--bb-transition);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.kc-password-toggle:hover {
  color: var(--bb-accent-yellow);
}

.kc-password-toggle svg {
  width: 20px;
  height: 20px;
}

/* =============================================
   Buttons
   ============================================= */
.kc-button {
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 700;
  font-family: 'Montserrat', sans-serif;
  border-radius: var(--bb-radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--bb-transition);
  outline: none;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  position: relative;
  overflow: hidden;
}

.kc-button-primary {
  background: var(--bb-accent-yellow);
  color: var(--bb-bg-primary);
}

.kc-button-primary:hover {
  background: var(--bb-accent-yellow-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(248, 232, 0, 0.3);
}

.kc-button-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(248, 232, 0, 0.2);
}

.kc-button-secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--bb-text-secondary);
  border: 1px solid var(--bb-border);
}

.kc-button-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--bb-text-muted);
  color: var(--bb-text-primary);
  transform: translateY(-1px);
}

.kc-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* =============================================
   Links
   ============================================= */
.kc-link {
  color: var(--bb-accent-yellow);
  text-decoration: none;
  font-size: 14px;
  transition: all var(--bb-transition);
  position: relative;
}

.kc-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--bb-accent-yellow);
  transition: width var(--bb-transition);
}

.kc-link:hover::after {
  width: 100%;
}

.kc-link:hover {
  color: var(--bb-accent-yellow-hover);
}

/* =============================================
   Hint text (instructions on TOTP pages)
   ============================================= */
.kc-hint {
  font-size: 14px;
  color: var(--bb-text-secondary);
  line-height: 1.5;
}

/* =============================================
   Alerts
   ============================================= */
.kc-alert {
  padding: var(--bb-space-md);
  border-radius: var(--bb-radius-sm);
  font-size: 14px;
  margin-bottom: var(--bb-space-md);
  animation: alertSlide 0.4s ease-out;
}

@keyframes alertSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.kc-alert-error {
  background: var(--bb-error-bg);
  border: 1px solid rgba(255, 68, 68, 0.3);
  color: #ff6b6b;
}

.kc-alert-success {
  background: rgba(76, 175, 80, 0.1);
  border: 1px solid rgba(76, 175, 80, 0.3);
  color: #66bb6a;
}

.kc-alert-info,
.kc-alert-warning {
  background: rgba(248, 232, 0, 0.06);
  border: 1px solid rgba(248, 232, 0, 0.2);
  color: var(--bb-text-secondary);
}

/* =============================================
   Custom Checkbox
   ============================================= */
.kc-checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: var(--bb-space-xs);
}

.kc-checkbox {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--bb-border);
  border-radius: 5px;
  background: var(--bb-bg-tertiary);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  flex-shrink: 0;
}

.kc-checkbox:hover {
  border-color: var(--bb-text-muted);
}

.kc-checkbox:checked {
  background: var(--bb-accent-yellow);
  border-color: var(--bb-accent-yellow);
}

.kc-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid var(--bb-bg-primary);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
  animation: checkPop 0.2s ease-out;
}

@keyframes checkPop {
  from { transform: rotate(45deg) scale(0); }
  to   { transform: rotate(45deg) scale(1); }
}

.kc-checkbox:focus-visible {
  box-shadow: 0 0 0 3px var(--bb-accent-yellow-glow);
}

.kc-checkbox-label {
  font-size: 14px;
  color: var(--bb-text-secondary);
  cursor: pointer;
  user-select: none;
}

/* =============================================
   Footer
   ============================================= */
.kc-footer {
  margin-top: var(--bb-space-lg);
  text-align: center;
  font-size: 14px;
  color: var(--bb-text-muted);
}

.kc-footer a {
  color: var(--bb-accent-yellow);
  text-decoration: none;
}

.kc-footer a:hover {
  text-decoration: underline;
}

/* =============================================
   Social Providers
   ============================================= */
.kc-social-providers {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: var(--bb-space-md);
}

.kc-social-divider {
  text-align: center;
  color: var(--bb-text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: var(--bb-space-md) 0;
  position: relative;
}

.kc-social-divider::before,
.kc-social-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 38%;
  height: 1px;
  background: var(--bb-border);
}

.kc-social-divider::before { left: 0; }
.kc-social-divider::after  { right: 0; }

/* =============================================
   Form Options Row
   ============================================= */
.kc-form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* =============================================
   TOTP Setup
   ============================================= */
.kc-totp-setup {
  background: var(--bb-bg-tertiary);
  padding: var(--bb-space-lg);
  border-radius: var(--bb-radius-md);
  margin-bottom: var(--bb-space-lg);
  text-align: center;
  border: 1px solid var(--bb-border);
}

.kc-totp-secret {
  font-family: 'Courier New', monospace;
  font-size: 18px;
  color: var(--bb-accent-yellow);
  font-weight: 700;
  letter-spacing: 0.2em;
  padding: var(--bb-space-md);
  background: var(--bb-bg-primary);
  border-radius: var(--bb-radius-sm);
  margin: var(--bb-space-md) 0;
  word-break: break-all;
  border: 1px solid var(--bb-border);
}

.kc-totp-qr {
  max-width: 280px;
  border: 8px solid var(--bb-bg-primary);
  border-radius: var(--bb-radius-md);
}

/* =============================================
   OTP
   ============================================= */
.kc-otp-credential {
  display: block;
  padding: var(--bb-space-sm) var(--bb-space-md);
  margin-bottom: var(--bb-space-xs);
  border-radius: var(--bb-radius-sm);
  border: 2px solid var(--bb-border);
  cursor: pointer;
  text-align: center;
  color: var(--bb-text-secondary);
  transition: all var(--bb-transition);
}

.kc-otp-credential:hover,
.kc-otp-credential-selected {
  border-color: var(--bb-accent-yellow);
  color: var(--bb-text-primary);
  background: rgba(248, 232, 0, 0.04);
}

.kc-otp-input {
  font-size: 32px;
  text-align: center;
  letter-spacing: 0.6em;
  font-weight: 700;
  font-family: 'Montserrat', monospace;
  padding: 16px !important;
  caret-color: rgba(248, 232, 0, 0.4);
}

.kc-otp-input::placeholder {
  font-size: 28px;
  letter-spacing: 0.5em;
  color: var(--bb-border);
}

/* App list on TOTP setup */
.kc-totp-apps {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: var(--bb-space-sm);
}

.kc-totp-apps li {
  background: var(--bb-bg-tertiary);
  border: 1px solid var(--bb-border);
  border-radius: var(--bb-radius-sm);
  padding: 6px 14px;
  font-size: 13px;
  color: var(--bb-text-secondary);
}

/* =============================================
   Utilities
   ============================================= */
.kc-text-center { text-align: center; }
.kc-mt-md { margin-top: var(--bb-space-md); }
.kc-mt-lg { margin-top: var(--bb-space-lg); }
.kc-mb-md { margin-bottom: var(--bb-space-md); }
.kc-w-full { width: 100%; }

.kc-button-group {
  display: flex;
  gap: 12px;
  margin-top: var(--bb-space-lg);
}

.kc-required-actions {
  list-style: none;
  padding: 0;
  margin-bottom: var(--bb-space-md);
}

.kc-required-actions li {
  padding: var(--bb-space-xs) 0;
  color: var(--bb-text-secondary);
  font-size: 14px;
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 480px) {
  .kc-container {
    padding: var(--bb-space-md);
  }

  .kc-card {
    padding: var(--bb-space-lg) 20px;
  }

  .kc-title {
    font-size: 20px;
  }

  .kc-form-options {
    flex-direction: column;
    gap: var(--bb-space-sm);
    align-items: flex-start;
  }
}
