/*
 * Shoehorn Developer Portal - Keycloak Login Theme
 * Modern, shadcn-inspired design with dark/light theme support
 */

/* ============================================
   CSS Variables - shadcn-inspired color palette
   ============================================ */
:root {
  /* Light Theme Colors */
  --sh-background: 0 0% 100%;
  --sh-foreground: 222.2 84% 4.9%;
  --sh-card: 0 0% 100%;
  --sh-card-foreground: 222.2 84% 4.9%;
  --sh-popover: 0 0% 100%;
  --sh-popover-foreground: 222.2 84% 4.9%;
  --sh-primary: 221.2 83.2% 53.3%;
  --sh-primary-foreground: 210 40% 98%;
  --sh-secondary: 210 40% 96.1%;
  --sh-secondary-foreground: 222.2 47.4% 11.2%;
  --sh-muted: 210 40% 96.1%;
  --sh-muted-foreground: 215.4 16.3% 46.9%;
  --sh-accent: 210 40% 96.1%;
  --sh-accent-foreground: 222.2 47.4% 11.2%;
  --sh-destructive: 0 84.2% 60.2%;
  --sh-destructive-foreground: 210 40% 98%;
  --sh-border: 214.3 31.8% 91.4%;
  --sh-input: 214.3 31.8% 91.4%;
  --sh-ring: 221.2 83.2% 53.3%;
  --sh-radius: 0.5rem;

  /* Success colors */
  --sh-success: 142.1 76.2% 36.3%;
  --sh-success-foreground: 138.5 76.5% 96.7%;

  /* Warning colors */
  --sh-warning: 38 92% 50%;
  --sh-warning-foreground: 48 96% 89%;

  /* Typography */
  --sh-font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --sh-font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Monaco, Consolas, monospace;
}

/* Dark Theme */
@media (prefers-color-scheme: dark) {
  :root {
    --sh-background: 222.2 84% 4.9%;
    --sh-foreground: 210 40% 98%;
    --sh-card: 222.2 84% 4.9%;
    --sh-card-foreground: 210 40% 98%;
    --sh-popover: 222.2 84% 4.9%;
    --sh-popover-foreground: 210 40% 98%;
    --sh-primary: 217.2 91.2% 59.8%;
    --sh-primary-foreground: 222.2 47.4% 11.2%;
    --sh-secondary: 217.2 32.6% 17.5%;
    --sh-secondary-foreground: 210 40% 98%;
    --sh-muted: 217.2 32.6% 17.5%;
    --sh-muted-foreground: 215 20.2% 65.1%;
    --sh-accent: 217.2 32.6% 17.5%;
    --sh-accent-foreground: 210 40% 98%;
    --sh-destructive: 0 62.8% 30.6%;
    --sh-destructive-foreground: 210 40% 98%;
    --sh-border: 217.2 32.6% 17.5%;
    --sh-input: 217.2 32.6% 17.5%;
    --sh-ring: 224.3 76.3% 48%;
  }
}

/* ============================================
   Reset & Base Styles
   ============================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body,
.sh-body {
  font-family: var(--sh-font-sans);
  background-color: hsl(var(--sh-background));
  color: hsl(var(--sh-foreground));
  line-height: 1.5;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

/* ============================================
   Layout Structure
   ============================================ */
.sh-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.sh-layout {
  width: 100%;
  max-width: 1200px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

/* Left Column - Branding */
.sh-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

.sh-branding {
  max-width: 450px;
}

.sh-mascot {
  width: 240px;
  height: 240px;
  margin-bottom: 2rem;
  border-radius: 1rem;
  background-color: hsl(var(--sh-muted));
  padding: 2rem;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

.sh-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: hsl(var(--sh-foreground));
  margin-bottom: 1rem;
}

.sh-subtitle {
  font-size: 1rem;
  color: hsl(var(--sh-muted-foreground));
  line-height: 1.6;
  margin: 0;
}

/* Right Column - Form */
.sh-right {
  display: flex;
  align-items: center;
  justify-content: center;
}

.sh-card {
  width: 100%;
  max-width: 400px;
  background-color: hsl(var(--sh-card));
  border: 1px solid hsl(var(--sh-border));
  border-radius: calc(var(--sh-radius) * 2);
  padding: 2rem;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

@media (prefers-color-scheme: dark) {
  .sh-card {
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.4), 0 1px 2px -1px rgb(0 0 0 / 0.3);
  }
}

/* ============================================
   Form Elements
   ============================================ */
#kc-form,
#kc-form-wrapper {
  width: 100%;
}

.sh-form-group {
  margin-bottom: 1.5rem;
}

.sh-form-group:last-child {
  margin-bottom: 0;
}

/* Labels */
.sh-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--sh-foreground));
  margin-bottom: 0.5rem;
  line-height: 1;
}

.sh-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

/* Input Fields */
.sh-input {
  width: 100%;
  height: 2.5rem;
  padding: 0 0.75rem;
  font-size: 0.875rem;
  font-family: var(--sh-font-sans);
  color: hsl(var(--sh-foreground));
  background-color: hsl(var(--sh-background));
  border: 1px solid hsl(var(--sh-input));
  border-radius: var(--sh-radius);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.sh-input::placeholder {
  color: hsl(var(--sh-muted-foreground));
}

.sh-input:focus {
  border-color: hsl(var(--sh-ring));
  box-shadow: 0 0 0 3px hsl(var(--sh-ring) / 0.1);
}

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

.sh-input[aria-invalid="true"] {
  border-color: hsl(var(--sh-destructive));
}

.sh-input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px hsl(var(--sh-destructive) / 0.1);
}

/* Buttons */
.sh-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 2.5rem;
  padding: 0 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--sh-font-sans);
  border-radius: var(--sh-radius);
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  outline: none;
  white-space: nowrap;
}

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

.sh-button-primary {
  background-color: hsl(var(--sh-primary));
  color: hsl(var(--sh-primary-foreground));
}

.sh-button-primary:hover {
  background-color: hsl(var(--sh-primary) / 0.9);
}

.sh-button-primary:active {
  transform: scale(0.98);
}

/* Checkbox */
.sh-checkbox-group {
  margin-bottom: 1rem;
}

.sh-checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sh-checkbox {
  width: 1rem;
  height: 1rem;
  border: 1px solid hsl(var(--sh-input));
  border-radius: calc(var(--sh-radius) * 0.5);
  cursor: pointer;
  margin: 0;
}

.sh-checkbox:checked {
  background-color: hsl(var(--sh-primary));
  border-color: hsl(var(--sh-primary));
}

.sh-checkbox-label {
  font-size: 0.875rem;
  color: hsl(var(--sh-foreground));
  cursor: pointer;
  user-select: none;
  margin: 0;
}

/* Links */
a,
.sh-link {
  color: hsl(var(--sh-primary));
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

a:hover,
.sh-link:hover {
  color: hsl(var(--sh-primary) / 0.8);
}

.sh-link-sm {
  font-size: 0.875rem;
  color: hsl(var(--sh-muted-foreground));
  font-weight: 500;
}

.sh-link-sm:hover {
  color: hsl(var(--sh-primary));
}

/* ============================================
   Alerts & Messages
   ============================================ */
.sh-alert {
  padding: 0.75rem 1rem;
  border-radius: var(--sh-radius);
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  line-height: 1.5;
  border: 1px solid;
}

.sh-alert-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sh-alert-error {
  background-color: hsl(var(--sh-destructive) / 0.1);
  border-color: hsl(var(--sh-destructive) / 0.2);
  color: hsl(var(--sh-destructive-foreground));
}

@media (prefers-color-scheme: dark) {
  .sh-alert-error {
    background-color: hsl(var(--sh-destructive) / 0.2);
    color: hsl(var(--sh-destructive-foreground));
  }
}

.sh-alert-success {
  background-color: hsl(var(--sh-success) / 0.1);
  border-color: hsl(var(--sh-success) / 0.2);
  color: hsl(var(--sh-success-foreground));
}

.sh-alert-warning {
  background-color: hsl(var(--sh-warning) / 0.1);
  border-color: hsl(var(--sh-warning) / 0.2);
  color: hsl(var(--sh-warning-foreground));
}

.sh-alert-info {
  background-color: hsl(var(--sh-primary) / 0.1);
  border-color: hsl(var(--sh-primary) / 0.2);
  color: hsl(var(--sh-primary-foreground));
}

.sh-error-text {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: hsl(var(--sh-destructive));
  font-weight: 500;
}

/* ============================================
   Social Providers
   ============================================ */
.sh-social-providers {
  margin-top: 1.5rem;
}

.sh-divider {
  position: relative;
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
}

.sh-divider::before,
.sh-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid hsl(var(--sh-border));
}

.sh-divider-text {
  padding: 0 1rem;
  font-size: 0.875rem;
  color: hsl(var(--sh-muted-foreground));
  white-space: nowrap;
}

.sh-social-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sh-social-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  height: 2.5rem;
  padding: 0 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--sh-foreground));
  background-color: hsl(var(--sh-background));
  border: 1px solid hsl(var(--sh-border));
  border-radius: var(--sh-radius);
  transition: all 0.2s;
  text-decoration: none;
}

.sh-social-button:hover {
  background-color: hsl(var(--sh-accent));
  border-color: hsl(var(--sh-ring));
  color: hsl(var(--sh-foreground));
}

.sh-social-button:active {
  transform: scale(0.98);
}

/* ============================================
   Disclaimer Banner
   ============================================ */
.sh-disclaimer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 0.5rem 1rem;
  background-color: hsl(var(--sh-warning) / 0.1);
  border-bottom: 1px solid hsl(var(--sh-warning) / 0.2);
  text-align: center;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.sh-disclaimer-text {
  font-size: 0.8125rem;
  color: hsl(var(--sh-foreground));
  margin: 0;
  font-weight: 500;
}

.sh-disclaimer-emoji {
  font-size: 1rem;
  margin-right: 0.5rem;
}

/* ============================================
   Demo Info Box
   ============================================ */
.sh-demo-info {
  position: fixed;
  top: 3rem;
  left: 50%;
  transform: translateX(-50%);
  max-width: 400px;
  padding: 0.75rem 1rem;
  background-color: hsl(var(--sh-primary) / 0.1);
  border: 1px solid hsl(var(--sh-primary) / 0.2);
  border-radius: var(--sh-radius);
  text-align: center;
  z-index: 99;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sh-demo-info-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: hsl(var(--sh-primary));
  margin: 0 0 0.25rem 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sh-demo-info-text {
  font-size: 0.875rem;
  color: hsl(var(--sh-foreground));
  margin: 0;
  font-family: 'Courier New', monospace;
  font-weight: 500;
}

/* ============================================
   Footer
   ============================================ */
.sh-footer {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid hsl(var(--sh-border));
  text-align: center;
}

.sh-footer-text {
  font-size: 0.875rem;
  color: hsl(var(--sh-muted-foreground));
  margin: 0;
}

.sh-footer-full {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.75rem 1rem;
  background-color: hsl(var(--sh-background) / 0.95);
  border-top: 1px solid hsl(var(--sh-border));
  text-align: center;
  font-size: 0.85rem;
  color: hsl(var(--sh-muted-foreground));
  line-height: 1.5;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.sh-footer-line {
  margin: 0.2rem 0;
}

.sh-footer-link {
  color: hsl(var(--sh-primary));
  text-decoration: none;
  transition: color 0.2s;
}

.sh-footer-link:hover {
  color: hsl(var(--sh-primary) / 0.8);
  text-decoration: underline;
}

.sh-footer-heart {
  color: #e74c3c;
  font-size: 0.8rem;
}

/* ============================================
   Language Selector
   ============================================ */
.sh-locale {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

.sh-locale select {
  height: 2rem;
  padding: 0 2rem 0 0.75rem;
  font-size: 0.875rem;
  color: hsl(var(--sh-foreground));
  background-color: hsl(var(--sh-background));
  border: 1px solid hsl(var(--sh-border));
  border-radius: var(--sh-radius);
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 12px;
}

.sh-locale select:hover {
  border-color: hsl(var(--sh-ring));
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1024px) {
  .sh-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
    max-width: 500px;
  }

  .sh-left {
    padding: 1rem;
  }

  .sh-mascot {
    width: 180px;
    height: 180px;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
  }

  .sh-title {
    font-size: 1.75rem;
  }

  .sh-subtitle {
    font-size: 0.875rem;
  }
}

@media (max-width: 640px) {
  .sh-container {
    padding: 0.5rem;
  }

  .sh-card {
    padding: 1.5rem;
  }

  .sh-mascot {
    width: 140px;
    height: 140px;
    margin-bottom: 1rem;
    padding: 1rem;
  }

  .sh-title {
    font-size: 1.5rem;
  }

  .sh-subtitle {
    font-size: 0.8125rem;
  }

  .sh-locale {
    position: static;
    margin-bottom: 1rem;
    text-align: right;
  }
}

/* ============================================
   Accessibility
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .sh-mascot {
    animation: none;
  }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
  outline: 2px solid hsl(var(--sh-ring));
  outline-offset: 2px;
}
