/**
 * Login Page Styles
 * Based on Mockup 18-login.html
 *
 * Note: Most CSS variables are defined in bootstrap2.css
 * This file only contains login-specific styles and extends variables
 */

/* Login-specific variables (extends bootstrap2.css) */
:root {
  --text-placeholder: var(--grey-400, #9ca3af);
  --hover-bg: var(--grey-100, #f3f4f6);
  --hover-bg-light: var(--grey-50, #f9fafb);
  --selected-bg: var(--primary-light, #eff6ff);
  --selected-bg-strong: var(--info-light, #e0f2fe);
  --status-error-bg: var(--error-light, #fef2f2);
  --status-warning-bg: var(--warning-light, #fffbeb);
  --status-success-bg: var(--success-light, #f0fdf4);
  --status-info-bg: var(--primary-light, #eff6ff);
  --panel-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  --focus-ring: 0 0 0 3px rgba(0, 122, 187, 0.1);
  --transition-fast: 0.2s;
  --transition-normal: 0.3s;
}

/* Base Layout */
.login-page {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #e4e9f0 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  margin: 0;
}

/* Global SVG size reset for login page - prevents bootstrap2.css conflicts */
.login-page svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Support for custom background image (White Label) */
.login-page.has-background-image {
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}

/* Logo Area */
.logo-container {
  margin-bottom: 28px;
  text-align: center;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.logo-icon {
  width: 48px;
  height: 48px;
  background: var(--primary-color);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-page .logo-icon svg {
  width: 28px;
  height: 28px;
  stroke: white;
}

.login-page .logo-icon .mdi {
  color: white;
}

.logo-icon img {
  max-height: 40px;
  width: auto;
}

.logo-text {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-color);
}

.logo-text span {
  color: var(--grey-color);
  font-weight: 400;
}

/* Custom logo (White Label) */
.logo-custom img,
.brand-logo {
  max-height: 65px;
  width: auto;
}

/* Login Card */
.login-card {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 40px;
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-header h1 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.login-header p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

/* Form Elements */
.form-group {
  margin-bottom: 20px;
}

/* Letztes form-group vor Button: 24px (wie Login mit .form-options) */
.login-card form > .form-group:last-of-type {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group label .required {
  color: var(--error-color);
}

.input-wrapper {
  position: relative;
}

.input-wrapper .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.login-page .input-wrapper .input-icon svg {
  width: 18px;
  height: 18px;
}

.input-wrapper input {
  width: 100%;
  padding: 12px 14px 12px 44px;
  border: none;
  border-bottom: 1px solid var(--border-color);
  border-radius: 0;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color var(--transition-fast);
  box-sizing: border-box;
}

.input-wrapper input::placeholder {
  color: var(--text-placeholder);
}

.input-wrapper input:focus {
  outline: none;
  border-bottom: 2px solid var(--primary-color);
  margin-bottom: -1px;
  box-shadow: none;
}

.input-wrapper .toggle-password {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.input-wrapper .toggle-password:hover {
  color: var(--text-secondary);
}

.login-page .input-wrapper .toggle-password svg {
  width: 18px;
  height: 18px;
}

/* Input without icon */
.input-wrapper.no-icon input {
  padding-left: 14px;
}

/* ========================================
   Text-Input Component Integration
   Styles for _text_input.html.twig in login context
   ======================================== */
.login-page .text-input-component.login-input {
  gap: 0;
}

.login-page .text-input-component.login-input .text-input-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.login-page .text-input-component.login-input .text-input-label-required {
  color: var(--error-color);
}

.login-page .text-input-component.login-input .text-input-wrapper {
  position: relative;
  min-height: auto;
}

.login-page .text-input-component.login-input .text-input-field {
  width: 100%;
  padding: 12px 44px 12px 44px;
  border: none;
  border-bottom: 1px solid var(--border-color);
  border-radius: 0;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color var(--transition-fast);
  box-sizing: border-box;
}

.login-page .text-input-component.login-input .text-input-field:focus {
  outline: none;
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 11px;
}

.login-page .text-input-component.login-input .text-input-icon.icon-left {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: auto;
  height: auto;
  color: var(--text-muted);
  pointer-events: none;
}

.login-page .text-input-component.login-input .text-input-icon.icon-left svg,
.login-page .text-input-component.login-input .text-input-icon.icon-left .mdi {
  width: 18px;
  height: 18px;
}

.login-page .text-input-component.login-input .toggle-password {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.login-page .text-input-component.login-input .toggle-password:hover {
  color: var(--text-secondary);
}

.login-page .text-input-component.login-input .toggle-password svg,
.login-page .text-input-component.login-input .toggle-password .mdi {
  width: 18px;
  height: 18px;
}

/* Form Options (Remember Me & Forgot Password) */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.form-options.end {
  justify-content: flex-end;
}

.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-wrapper input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary-color);
  cursor: pointer;
}

.checkbox-wrapper label {
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  margin-bottom: 0;
}

.forgot-password {
  font-size: 14px;
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
  width: 100%;
  text-decoration: none;
}

.login-page .btn svg {
  width: 18px;
  height: 18px;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-darken);
}

.btn-secondary {
  background-color: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--hover-bg);
  border-color: var(--grey-light);
}

.btn-sso {
  background-color: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-sso:hover {
  background-color: var(--hover-bg);
  border-color: var(--grey-light);
}

.login-page .btn-sso .sso-icon {
  width: 20px;
  height: 20px;
}

/* Text-Divider (nur div.divider, nicht hr.divider) */
div.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
  border-top: none !important;
}

div.divider::before,
div.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background-color: var(--border-color);
}

div.divider span {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Back Link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 32px;
}

.back-link:hover {
  color: var(--primary-color);
}

.login-page .back-link svg {
  width: 16px;
  height: 16px;
}

/* 2FA User Info */
.twofa-user-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--hover-bg);
  border-radius: 8px;
  margin-bottom: 24px;
}

.login-page .twofa-user-info svg {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.twofa-user-info span {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* 2FA Code Input */
.code-input-wrapper {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
}

.code-input {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 24px;
  font-weight: 600;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.code-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: var(--focus-ring);
}

/* 2FA Help */
.twofa-help {
  text-align: center;
  margin-top: 16px;
}

.twofa-help p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.twofa-help a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
}

.twofa-help a:hover {
  text-decoration: underline;
}

/* Footer */
.login-footer {
  margin-top: 32px;
  text-align: center;
}

.login-footer p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 8px;
}

.footer-links a {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--primary-color);
}

/* Language Switcher */
.language-switcher {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  padding: 6px 10px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border-color);
  z-index: 100;
}

.login-page .language-switcher svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.language-btn {
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.language-btn:hover {
  background: var(--hover-bg);
  color: var(--text-secondary);
}

.language-btn.active {
  background: var(--selected-bg);
  color: var(--primary-color);
}

.language-divider {
  width: 1px;
  height: 16px;
  background: var(--border-color);
}

/* Cookie Login Notice */
.cookie-notice {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

.cookie-notice a {
  color: var(--primary-color);
  text-decoration: none;
}

.cookie-notice a:hover {
  text-decoration: underline;
}

/* Small form field error */
.field-error {
  font-size: 12px;
  color: var(--error-color);
  margin-top: 4px;
}

/* Password Requirements Box */
.password-requirements {
  background: var(--hover-bg, #f3f4f6);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 20px;
  font-size: 13px;
}

.password-requirements h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary, #374151);
}

.requirements-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.requirement {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--text-muted, #6b7280);
  transition: color 0.2s ease;
}

.requirement .req-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.requirement .req-icon svg {
  width: 16px;
  height: 16px;
}

.requirement .icon-checked {
  display: none;
  stroke: var(--success-color);
}

.requirement .icon-unchecked {
  display: block;
  stroke: #9ca3af;
}

.requirement.met {
  color: var(--success-color);
}

.requirement.met .icon-checked {
  display: block;
}

.requirement.met .icon-unchecked {
  display: none;
}

.requirement-sub {
  list-style: none;
  margin-left: 24px;
}

.category-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.category-list .requirement {
  margin-bottom: 4px;
  font-size: 12px;
}

.login-card-wide {
  max-width: 480px;
}

/* MDI Icon Styles */
.login-page .mdi {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.input-icon .mdi {
  color: var(--text-muted);
}

.back-link .mdi {
  margin-right: 2px;
}

.twofa-user-info .mdi {
  color: var(--text-muted);
}

.language-switcher .mdi {
  color: var(--text-muted);
}

/* Password toggle with MDI icons */
.toggle-password .mdi.eye-closed {
  display: none;
}

/* Password requirements with MDI icons */
.requirement .mdi.icon-checked {
  display: none;
  color: var(--success-color);
}

.requirement .mdi.icon-unchecked {
  display: inline-flex;
  color: #9ca3af;
}

.requirement.met .mdi.icon-checked {
  display: inline-flex;
}

.requirement.met .mdi.icon-unchecked {
  display: none;
}

/* Public-page fixes for login/error pages:
   Move gradient to body, prevent scrolling, include footer in viewport */
body.public-page:has(.login-page) {
  background: linear-gradient(135deg, #f5f7fa 0%, #e4e9f0 100%);
  background-attachment: fixed;
  height: 100vh !important;
  overflow: hidden !important;
  display: flex;
  flex-direction: column;
}

body.public-page:has(.login-page) > main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.public-page .login-page {
  background: transparent;
  min-height: 0;
  flex: 1;
}

/* Responsive */
@media (max-width: 480px) {
  .login-card {
    padding: 24px;
  }

  .login-header h1 {
    font-size: 20px;
  }

  .code-input {
    width: 40px;
    height: 48px;
    font-size: 20px;
  }

  .language-switcher {
    top: 10px;
    right: 10px;
  }
}
