/* VectorDrive Keycloak Login Theme
   Mobile-first, centered design matching vectordrive.co.uk */

/* ========================================
   FONTS & CSS VARIABLES
   ======================================== */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #00E5FF;
  --primary-dark: #00B8D4;
  --secondary: #7C4DFF;
  --dark: #0A0E17;
  --darker: #05080F;
  --light: #F8FDFF;
  --gray: #7A8599;
  --accent: #FF4081;
  --success: #00E676;
  --warning: #FFAB00;
  --error: #FF4081;
}

/* ========================================
   RESET & BASE STYLES
   ======================================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: 'Montserrat', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--dark);
  color: var(--light);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Background gradient effect - matches VectorDrive website */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 10% 20%, rgba(124, 77, 255, 0.1) 0%, transparent 25%),
    radial-gradient(circle at 90% 80%, rgba(0, 229, 255, 0.08) 0%, transparent 25%),
    radial-gradient(circle at 50% 50%, rgba(124, 77, 255, 0.03) 0%, transparent 50%);
  z-index: -1;
  pointer-events: none;
}

/* ========================================
   MAIN LAYOUT - MOBILE FIRST, CENTERED
   ======================================== */
#kc-header,
#kc-header-wrapper,
div#kc-header,
div#kc-header-wrapper,
.kc-logo-text,
[id="kc-header"],
[id="kc-header-wrapper"] {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  width: 0 !important;
  max-height: 0 !important;
  max-width: 0 !important;
  overflow: hidden !important;
  position: absolute !important;
  left: -9999px !important;
  top: -9999px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  font-size: 0 !important;
  line-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  clip: rect(0, 0, 0, 0) !important;
  -webkit-clip-path: inset(100%) !important;
  clip-path: inset(100%) !important;
}

.login-pf-page,
body.login-pf-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
  background-color: var(--dark);
}

/* ========================================
   LOGIN CARD
   ======================================== */
.card-pf,
#kc-form-wrapper,
.login-pf-page .card-pf {
  background: rgba(10, 14, 23, 0.85);
  border-radius: 20px;
  padding: 2rem 1.5rem;
  border: 1px solid rgba(0, 229, 255, 0.1);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.4),
    0 0 40px rgba(0, 229, 255, 0.05);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

/* ========================================
   LOGO & HEADER
   ======================================== */
.logo-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  text-align: center;
}

.logo-container img {
  max-height: 120px;
  width: auto;
  display: block;
  margin: 0 auto;
}

.logo-container .logo-text,
.logo-container .logo {
  color: var(--primary);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: lowercase;
  display: inline-flex;
  align-items: center;
}

.logo-container .logo::after,
.logo-container .logo-text::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  margin-left: 4px;
  animation: pulse 3s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* Page title - hidden, we use logo only */
#kc-page-title,
.login-pf-page-header,
#kc-form-login > h1,
.kc-page-title {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Welcome subtitle */
.welcome-subtitle {
  color: var(--gray);
  font-size: 0.95rem;
  text-align: center;
  margin-bottom: 2rem;
  line-height: 1.5;
}

/* ========================================
   MAIN CONTENT CONTAINER (for base theme)
   ======================================== */
#kc-container,
#kc-container-wrapper,
#kc-content,
#kc-content-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100vh;
  padding: 1rem;
}

#kc-form-wrapper,
.kc-form-card {
  background: rgba(10, 14, 23, 0.85);
  border-radius: 20px;
  padding: 2.5rem 2rem;
  border: 1px solid rgba(0, 229, 255, 0.1);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.4),
    0 0 40px rgba(0, 229, 255, 0.05);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  width: 100%;
  max-width: 420px;
}

/* ========================================
   FORM ELEMENTS
   ======================================== */
#kc-form,
#kc-reset-password-form,
#kc-register-form {
  width: 100%;
}

.form-group {
  margin-bottom: 1.75rem;
  width: 100%;
}

/* Labels */
.form-group label,
.control-label,
label[for="username"],
label[for="password"],
label[for="email"] {
  color: var(--light);
  font-weight: 500;
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

/* Input fields */
.form-control,
input[type="text"],
input[type="password"],
input[type="email"],
select {
  background-color: rgba(5, 8, 15, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--light);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 1rem;
  width: 100%;
  box-sizing: border-box;
  transition: all 0.3s ease;
  font-family: inherit;
  /* Prevent iOS zoom on focus */
  font-size: 16px;
}

.form-control:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.15), 0 0 20px rgba(0, 229, 255, 0.1);
  background-color: rgba(5, 8, 15, 0.95);
}

.form-control::placeholder,
input::placeholder {
  color: var(--gray);
  opacity: 0.7;
}

/* ========================================
   LOGIN OPTIONS (Remember me & Forgot password)
   ======================================== */
.login-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1.5rem 0;
}

/* Checkbox styling */
.checkbox {
  display: flex;
  align-items: center;
}

.checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  margin-right: 0.5rem;
  cursor: pointer;
}

.checkbox label {
  color: var(--gray);
  font-size: 0.9rem;
  margin-bottom: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
}

/* Forgot password link */
.forgot-password {
  text-align: center;
}

.forgot-password a {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.forgot-password a:hover {
  color: var(--light);
  text-decoration: underline;
}

/* ========================================
   BUTTONS
   ======================================== */
#kc-form-buttons {
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

.btn-primary,
#kc-login,
input[type="submit"].btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--darker);
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(0, 229, 255, 0.35);
  transition: all 0.3s ease;
  width: 100%;
  font-family: inherit;
  text-transform: none;
  letter-spacing: 0.3px;
}

.btn-primary:hover,
#kc-login:hover,
input[type="submit"].btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 229, 255, 0.5);
}

.btn-primary:active,
#kc-login:active {
  transform: translateY(0);
}

.btn-primary:disabled,
#kc-login:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Secondary/outline buttons */
.btn-default,
.btn-secondary {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  font-family: inherit;
  margin-top: 1rem;
}

.btn-default:hover,
.btn-secondary:hover {
  background: rgba(0, 229, 255, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(0, 229, 255, 0.2);
}

/* ========================================
   REGISTRATION LINK
   ======================================== */
#kc-registration {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

#kc-registration span {
  color: var(--gray);
  font-size: 0.95rem;
}

#kc-registration a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  margin-left: 0.25rem;
  transition: all 0.3s ease;
}

#kc-registration a:hover {
  color: var(--light);
  text-decoration: underline;
}

/* ========================================
   SOCIAL PROVIDERS
   ======================================== */
#kc-social-providers {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

#kc-social-providers h2,
.kc-social-section-header {
  text-align: center;
  margin-bottom: 1rem;
  color: var(--gray);
  font-size: 0.9rem;
  font-weight: 500;
}

.kc-social-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.kc-social-links li {
  margin: 0;
}

.kc-social-link,
.kc-social-provider-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  text-decoration: none;
  color: var(--light);
  font-weight: 500;
  transition: all 0.3s ease;
  background: rgba(5, 8, 15, 0.5);
}

.kc-social-link:hover,
.kc-social-provider-link:hover {
  background: rgba(0, 229, 255, 0.08);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(0, 229, 255, 0.1);
}

/* ========================================
   ALERT MESSAGES
   ======================================== */
.alert,
.pf-c-alert {
  padding: 1rem 1.25rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  border-left: 4px solid;
  background-color: rgba(10, 14, 23, 0.9);
  font-size: 0.9rem;
}

.alert-success,
.pf-m-success {
  border-left-color: var(--success);
  color: var(--success);
}

.alert-warning,
.pf-m-warning {
  border-left-color: var(--warning);
  color: var(--warning);
}

.alert-error,
.alert-danger,
.pf-m-danger {
  border-left-color: var(--error);
  color: var(--error);
}

.alert-info,
.pf-m-info {
  border-left-color: var(--primary);
  color: var(--primary);
}

/* ========================================
   INFO SECTION
   ======================================== */
#kc-info {
  text-align: center;
  margin-top: 1.5rem;
  color: var(--gray);
  font-size: 0.9rem;
}

#kc-info a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

#kc-info a:hover {
  text-decoration: underline;
}

/* ========================================
   INPUT GROUP (Password toggle etc)
   ======================================== */
.pf-c-input-group,
.input-group {
  display: flex;
  width: 100%;
}

.pf-c-input-group .form-control,
.input-group .form-control {
  border-radius: 12px 0 0 12px;
  flex: 1;
}

.pf-c-button.pf-m-control,
.input-group-addon {
  background-color: rgba(5, 8, 15, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: none;
  color: var(--gray);
  border-radius: 0 12px 12px 0;
  padding: 0 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.pf-c-button.pf-m-control:hover,
.input-group-addon:hover {
  background-color: rgba(5, 8, 15, 0.95);
  color: var(--primary);
}

/* ========================================
   LOCALE SELECTOR
   ======================================== */
#kc-locale {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

#kc-locale-dropdown button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--gray);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.3s ease;
}

#kc-locale-dropdown button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

#kc-locale-dropdown ul {
  background: rgba(10, 14, 23, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  list-style: none;
  padding: 0.5rem 0;
  margin-top: 0.5rem;
  position: absolute;
  right: 0;
  min-width: 120px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

#kc-locale-dropdown li a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--gray);
  text-decoration: none;
  transition: all 0.3s ease;
}

#kc-locale-dropdown li a:hover {
  background: rgba(0, 229, 255, 0.1);
  color: var(--primary);
}

/* ========================================
   HELPER TEXT & LINKS
   ======================================== */
.kc-feedback-text,
.help-block {
  color: var(--gray);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--light);
}

/* Required field indicator */
.required {
  color: var(--accent);
}

/* ========================================
   TABLET & DESKTOP RESPONSIVE
   ======================================== */
@media (min-width: 480px) {
  .login-options {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .forgot-password {
    text-align: right;
  }
}

@media (min-width: 768px) {
  .card-pf,
  #kc-form-wrapper,
  .login-pf-page .card-pf {
    padding: 3rem 2.5rem;
    max-width: 450px;
  }

  #kc-page-title {
    display: none !important;
  }

  .logo-container img {
    max-height: 140px;
  }

  .logo-container .logo,
  .logo-container .logo-text {
    font-size: 2rem;
  }
}

/* ========================================
   ACCESSIBILITY & FOCUS STATES
   ======================================== */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Remove default focus outline when using mouse */
:focus:not(:focus-visible) {
  outline: none;
}

/* ========================================
   HIDE UNNECESSARY KEYCLOAK ELEMENTS
   ======================================== */
.pf-c-brand,
.kc-logo-text {
  display: none;
}

/* Content wrapper fixes */
#kc-content,
#kc-content-wrapper {
  width: 100%;
}

/* Header area fixes */
.login-pf-page .login-pf-header,
header {
  margin-bottom: 0;
}

/* Form card class if used */
.pf-c-login__main {
  background: transparent;
  box-shadow: none;
}

/* ========================================
   ANIMATION FOR CARD ENTRANCE
   ======================================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-pf,
.login-pf-page .card-pf {
  animation: fadeInUp 0.5s ease-out;
}

/* ========================================
   PATTERNFLY OVERRIDES
   ======================================== */
.pf-c-form-control {
  background-color: rgba(5, 8, 15, 0.8) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: var(--light) !important;
  border-radius: 12px !important;
}

.pf-c-form-control:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.15) !important;
}

.pf-c-form__label-text {
  color: var(--light) !important;
}

.pf-c-button.pf-m-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
  color: var(--darker) !important;
  border-radius: 50px !important;
}

/* ========================================
   INSTRUCTION TEXT & BACK LINKS
   ======================================== */
.instruction-text {
  color: var(--gray);
  font-size: 0.9rem;
  text-align: center;
  line-height: 1.6;
  margin: 1.5rem 0;
}

.back-to-login {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.back-to-login a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.3s ease;
}

.back-to-login a:hover {
  color: var(--light);
}

/* Error message styling */
.error-message {
  display: block;
  color: var(--error);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

/* ========================================
   ERROR PAGE STYLES
   ======================================== */
.error-container {
  text-align: center;
}

.error-title {
  color: var(--light);
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.error-description {
  color: var(--gray);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.error-message-box {
  background: rgba(255, 64, 129, 0.1);
  border: 1px solid rgba(255, 64, 129, 0.3);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  color: var(--light);
  font-size: 0.9rem;
  line-height: 1.5;
}

.resend-section {
  margin: 2rem 0;
  padding: 1.5rem;
  background: rgba(0, 229, 255, 0.05);
  border-radius: 12px;
  border: 1px solid rgba(0, 229, 255, 0.1);
}

.resend-instruction {
  color: var(--gray);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.resend-form .form-group {
  text-align: left;
}

.support-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.support-text {
  color: var(--gray);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.support-contact a {
  color: var(--primary);
  font-weight: 500;
  text-decoration: none;
  font-size: 0.95rem;
}

.support-contact a:hover {
  color: var(--light);
  text-decoration: underline;
}

/* ========================================
   VERTICAL SPACING FOR BASE THEME
   ======================================== */
.logo-container {
  margin-bottom: 2.5rem;
}

#kc-form-login,
#kc-reset-password-form,
#kc-register-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Space between form sections */
#kc-form-options {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

#kc-form-buttons {
  margin-top: 1.5rem;
}
