/* Keycloak Login Theme CSS - Matching Haku Design System */
/* This file mirrors the styling from src/index.css and tailwind.config.ts */

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

/* ============================================
   CSS VARIABLES (Light Theme Only)
   ============================================ */
:root {
  /* Force light mode regardless of system preference */
  color-scheme: light only;

  /* Core colors */
  --background: hsl(210, 40%, 98%);
  --foreground: hsl(222, 47%, 11%);
  
  /* Card */
  --card: hsl(0, 0%, 100%);
  --card-foreground: hsl(222, 47%, 11%);
  
  /* Primary (Orange) */
  --primary: hsl(14, 74%, 51%);
  --primary-foreground: hsl(0, 0%, 100%);
  
  /* Secondary */
  --secondary: hsl(210, 40%, 96%);
  --secondary-foreground: hsl(222, 47%, 11%);
  
  /* Muted */
  --muted: hsl(210, 40%, 96%);
  --muted-foreground: hsl(215, 16%, 47%);
  
  /* Accent (Teal) */
  --accent: hsl(174, 62%, 47%);
  --accent-foreground: hsl(0, 0%, 100%);
  
  /* Destructive */
  --destructive: hsl(0, 84%, 60%);
  --destructive-foreground: hsl(210, 40%, 98%);
  
  /* Success */
  --success: hsl(142, 71%, 45%);
  --success-foreground: hsl(0, 0%, 100%);
  
  /* Warning */
  --warning: hsl(38, 92%, 50%);
  --warning-foreground: hsl(0, 0%, 100%);
  
  /* Border & Input */
  --border: hsl(214, 32%, 91%);
  --input: hsl(214, 32%, 91%);
  --ring: hsl(14, 74%, 51%);
  
  /* Border radius */
  --radius: 0.5rem;
}

/* ============================================
   BASE STYLES
   ============================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  color-scheme: light only;
}

body {
  font-family: 'Poppins', sans-serif;
  background-color: var(--background) !important;
  color: var(--foreground) !important;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   SPLIT LAYOUT
   ============================================ */
.login-pf {
  min-height: 100vh;
  display: flex;
  padding: 0;
}

.login-pf-page {
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: none;
}

/* ============================================
   LEFT PANEL - Form
   ============================================ */
.login-left-panel {
  width: 100%;
  background-color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem;
  position: relative;
}

@media (min-width: 1024px) {
  .login-left-panel {
    width: 50%;
    padding: 3rem;
  }
}

.login-left-content {
  width: 100%;
  max-width: 28rem;
  margin: 0 auto;
}

/* Logo */
.login-logo {
  text-align: left;
  margin-bottom: 2rem;
}

.login-logo img {
  max-height: 2rem;
  width: auto;
}

/* Footer at bottom-left */
.login-footer {
  position: absolute;
  bottom: 2rem;
  left: 2rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

@media (min-width: 1024px) {
  .login-footer {
    left: 3rem;
  }
}

/* ============================================
   RIGHT PANEL - Showcase
   ============================================ */
.login-right-panel {
  display: none;
  width: 50%;
  background-color: var(--muted);
  flex-direction: column;
  justify-content: center;
  padding: 3rem;
}

@media (min-width: 1024px) {
  .login-right-panel {
    display: flex;
  }
}

.login-right-content {
  max-width: 42rem;
  width: 100%;
  margin: 0 auto;
}

/* ============================================
   SHOWCASE BADGE
   ============================================ */
.showcase-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.ping-dot {
  position: relative;
  display: flex;
  height: 0.5rem;
  width: 0.5rem;
}

.ping-dot::before {
  content: '';
  position: absolute;
  display: inline-flex;
  height: 100%;
  width: 100%;
  border-radius: 9999px;
  background-color: var(--primary);
  opacity: 0.75;
  animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.ping-dot::after {
  content: '';
  position: relative;
  display: inline-flex;
  border-radius: 9999px;
  height: 0.5rem;
  width: 0.5rem;
  background-color: var(--primary);
}

@keyframes ping {
  75%, 100% {
    transform: scale(2);
    opacity: 0;
  }
}

.badge-text {
  color: var(--muted-foreground);
}

/* ============================================
   SHOWCASE CONTENT
   ============================================ */
.showcase-title {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--foreground);
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.showcase-description {
  color: var(--muted-foreground);
  margin-bottom: 2rem;
  font-size: 1rem;
  line-height: 1.6;
}

/* Screenshot Container */
.showcase-screenshot {
  border-radius: 0.75rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  border: 1px solid var(--border);
}

.showcase-screenshot img {
  width: 100%;
  height: auto;
  display: block;
}

/* ============================================
   CARD COMPONENT
   ============================================ */
.card-pf {
  background-color: transparent;
  color: var(--card-foreground);
  border-radius: 0;
  border: none;
  box-shadow: none;
  overflow: visible;
}

.card-pf-header {
  display: flex;
  flex-direction: column;
  padding: 0;
  padding-bottom: 0;
  margin-bottom: 1.5rem;
}

.card-pf-title {
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--foreground);
  margin: 0;
}

.card-pf-description {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-top: 0.5rem;
}

.card-pf-body {
  padding: 0;
}

/* ============================================
   FORM STYLES
   ============================================ */
.login-pf-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ============================================
   LABEL
   ============================================ */
label,
.control-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
  line-height: 1;
}

/* ============================================
   INPUT FIELDS
   ============================================ */
.form-control,
input[type="text"],
input[type="email"],
input[type="password"] {
  display: flex;
  height: 2.5rem;
  width: 100%;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--input);
  background-color: transparent;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: 'Poppins', sans-serif;
  color: var(--foreground);
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control::placeholder,
input::placeholder {
  color: var(--muted-foreground);
}

.form-control:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px hsla(14, 74%, 51%, 0.2);
}

.form-control:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: 'Poppins', sans-serif;
  height: 2.5rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  border: none;
  transition: background-color 0.15s ease-in-out, opacity 0.15s ease-in-out;
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

.btn:disabled {
  pointer-events: none;
  opacity: 0.5;
}

/* Primary Button */
.btn-primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
  width: 100%;
}

.btn-primary:hover {
  background-color: hsl(14, 74%, 45%);
}

/* Ghost/Link Button */
.btn-link,
.btn-ghost {
  background-color: transparent;
  color: var(--muted-foreground);
  padding: 0;
  height: auto;
  font-size: 0.875rem;
  font-weight: 400;
}

.btn-link:hover,
.btn-ghost:hover {
  text-decoration: underline;
  background-color: transparent;
}

/* Back button with arrow */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background-color: transparent;
  color: var(--foreground);
  padding: 0.375rem 0.5rem;
  margin-left: -0.5rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  border-radius: calc(var(--radius) - 2px);
}

.btn-back:hover {
  background-color: var(--muted);
}

.btn-back svg {
  width: 1rem;
  height: 1rem;
}

/* ============================================
   LINKS
   ============================================ */
a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Forgot password link */
.forgot-password-link {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--muted-foreground);
  padding: 0;
  height: auto;
}

.forgot-password-link:hover {
  text-decoration: underline;
}

.forgot-password-row {
  text-align: center;
  margin-top: 1rem;
}

/* ============================================
   USERNAME CONTEXT (step 2 - signing in as)
   ============================================ */
.username-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--muted, hsl(210, 40%, 96%));
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.username-display {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.username-label {
  font-size: 0.75rem;
  color: var(--muted-foreground, hsl(215, 16%, 47%));
  font-weight: 500;
}

.username-value {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--foreground, hsl(222, 47%, 11%));
}

.change-user-link {
  font-size: 0.8125rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.change-user-link:hover {
  text-decoration: underline;
}

/* ============================================
   ALERT / ERROR MESSAGES
   ============================================ */
.alert {
  position: relative;
  padding: 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.alert-error,
.alert-danger {
  background-color: hsl(0, 84%, 95%);
  border: 1px solid var(--destructive);
  color: var(--destructive);
}

.alert-success {
  background-color: hsl(142, 71%, 95%);
  border: 1px solid var(--success);
  color: var(--success);
}

.alert-warning {
  background-color: hsl(38, 92%, 95%);
  border: 1px solid var(--warning);
  color: hsl(38, 92%, 35%);
}

.alert-info {
  background-color: hsl(210, 40%, 95%);
  border: 1px solid hsl(214, 32%, 70%);
  color: var(--foreground);
}

/* ============================================
   FIELD ERROR MESSAGES
   ============================================ */
.kc-feedback-text,
.error-text {
  font-size: 0.875rem;
  color: var(--destructive);
  margin-top: 0.25rem;
}

/* ============================================
   FORM ROW (side by side fields)
   ============================================ */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 480px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

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

.error-icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  color: var(--destructive);
}

.success-icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  color: var(--success);
}

/* ============================================
   INFO PAGE STYLES
   ============================================ */
.info-page {
  text-align: center;
}

.info-icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  color: var(--primary);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-center {
  text-align: center;
}

.mt-4 {
  margin-top: 1rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.space-y-4 > * + * {
  margin-top: 1rem;
}

.space-y-2 > * + * {
  margin-top: 0.5rem;
}

.w-full {
  width: 100%;
}

.hidden {
  display: none;
}

/* ============================================
   HIDE DEFAULT KEYCLOAK ELEMENTS
   ============================================ */
#kc-header,
#kc-header-wrapper,
.kc-logo-text {
  display: none;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
