/* Acre Identity Login Styles - Following Brand Guidelines */
/* Security: No user-generated content should be inserted into CSS */

/* Import system font as fallback (Brand uses Basis Grotesque) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

/* Brand Colors from Guidelines */
:root {
   /* Primary Colors */
   --acre-a1-green: #14c4a2; /* A1-1 Green */
   --acre-a1-navy: #25314d; /* A1-2 Navy */
   --acre-legacy-plum: #3a244a; /* Legacy-1 Plum */

   /* Neutral Colors */
   --acre-cloud-white: #ffffff; /* Cloud-1 White */
   --acre-cloud-light: #f5f5f7; /* Cloud-2 Light */
   --acre-steel-gray: #6b7280; /* Steel-1 Gray */
   --acre-steel-medium: #374151; /* Steel-2 Medium */
   --acre-steel-dark: #111827; /* Steel-3 Dark */

   /* Gradients - Bridge Symbol */
   --bridge-gradient: linear-gradient(135deg, #14c4a2 0%, #25314d 100%);
   --bridge-gradient-soft: linear-gradient(135deg, rgba(20, 196, 162, 0.08) 0%, rgba(37, 49, 77, 0.08) 100%);

   /* Typography */
   --font-primary: 'Inter', Arial, sans-serif; /* Fallback for Basis Grotesque */

   /* Theme-aware colors */
   --bg-primary: #f5f5f7;
   --bg-secondary: #ffffff;
   --text-primary: #111827;
   --text-secondary: #6b7280;
   --border-color: #e5e7eb;
   --shadow-color: rgba(37, 49, 77, 0.1);
}

/* Dark theme variables */
.dark {
   /* Background colors */
   --bg-primary: #0f172a;
   --bg-secondary: #1e293b;

   /* Text colors */
   --text-primary: #f1f5f9;
   --text-secondary: #94a3b8;

   /* Border and shadow */
   --border-color: #334155;
   --shadow-color: rgba(0, 0, 0, 0.5);

   /* Adjusted colors for dark mode */
   --acre-cloud-white: #1e293b;
   --acre-cloud-light: #0f172a;
   --acre-steel-gray: #94a3b8;
   --acre-steel-medium: #cbd5e1;
   --acre-steel-dark: #f1f5f9;

   /* Adjusted gradients for dark mode */
   --bridge-gradient-soft: linear-gradient(135deg, rgba(20, 196, 162, 0.12) 0%, rgba(37, 49, 77, 0.12) 100%);

   /* Keep green button visible in dark mode */
   --acre-a1-green: #14c4a2;
}

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

body {
   font-family: var(--font-primary);
   background: var(--bg-primary);
   color: var(--text-primary);
   line-height: 1.6;
   min-height: 100vh;
   display: flex;
   align-items: center;
   justify-content: center;
   position: relative;
   overflow: hidden;
   transition:
      background-color 0.3s ease,
      color 0.3s ease;
}

/* Background Pattern - Tech Pattern from Brand Guidelines */
body::before {
   content: '';
   position: absolute;
   top: 0;
   left: 0;
   right: 0;
   bottom: 0;
   background-image:
      repeating-linear-gradient(45deg, transparent, transparent 35px, rgba(37, 49, 77, 0.03) 35px, rgba(37, 49, 77, 0.03) 70px),
      repeating-linear-gradient(-45deg, transparent, transparent 35px, rgba(20, 196, 162, 0.03) 35px, rgba(20, 196, 162, 0.03) 70px);
   pointer-events: none;
}

/* Bridge Curve Background Element */
.bridge-curve {
   position: absolute;
   top: -50%;
   right: -20%;
   width: 800px;
   height: 800px;
   background: var(--bridge-gradient);
   opacity: 0.05;
   border-radius: 50%;
   transform: rotate(45deg);
   pointer-events: none;
}

/* Login Container */
.login-container {
   background: var(--bg-secondary);
   border-radius: 12px;
   box-shadow: 0 10px 40px var(--shadow-color);
   width: 100%;
   max-width: 440px;
   padding: 48px;
   position: relative;
   z-index: 1;
   transition:
      background-color 0.3s ease,
      box-shadow 0.3s ease;
}

/* Login Header */
.login-header {
   text-align: center;
   margin-bottom: 40px;
}

.acre-logo {
   max-width: 240px;
   height: auto;
   margin-bottom: 32px;
   display: block;
   margin-left: auto;
   margin-right: auto;
}

.ldap-logo {
   margin-bottom: 32px;
}

.login-header h1 {
   font-size: 28px;
   font-weight: 700;
   color: var(--text-primary);
   margin-bottom: 8px;
   letter-spacing: -0.5px;
}

.login-header p {
   font-size: 16px;
   color: var(--text-secondary);
   font-weight: 400;
}

/* Instance Info */
.instance-info {
   text-align: center;
   font-size: 14px;
   color: var(--text-secondary);
   margin-bottom: 24px;
   padding: 12px;
   background: var(--bridge-gradient-soft);
   border-radius: 6px;
   display: none;
}

.instance-info:not(:empty) {
   display: block;
}

/* Form Styles */
.form-group {
   margin-bottom: 24px;
}

.form-group label {
   display: block;
   font-size: 14px;
   font-weight: 600;
   color: var(--text-primary);
   margin-bottom: 8px;
   letter-spacing: 0.2px;
}

.form-group input {
   width: 100%;
   padding: 14px 16px;
   font-size: 16px;
   border: 2px solid var(--border-color);
   border-radius: 8px;
   background: var(--bg-secondary);
   color: var(--text-primary);
   transition: all 0.3s ease;
   font-family: inherit;
}

.form-group input:focus {
   outline: none;
   border-color: var(--acre-a1-green);
   box-shadow: 0 0 0 3px rgba(20, 196, 162, 0.1);
}

.form-group input::placeholder {
   color: var(--text-secondary);
   opacity: 0.6;
}

/* Button Styles */
.btn {
   display: inline-flex;
   align-items: center;
   justify-content: center;
   padding: 14px 32px;
   font-size: 16px;
   font-weight: 600;
   border: none;
   border-radius: 8px;
   cursor: pointer;
   transition: all 0.3s ease;
   position: relative;
   min-height: 48px;
   font-family: inherit;
   letter-spacing: 0.2px;
}

.btn-primary {
   background: var(--acre-a1-green);
   color: var(--acre-cloud-white);
   width: 100%;
}

.btn-primary:hover:not(:disabled) {
   transform: translateY(-1px);
   box-shadow: 0 4px 12px rgba(20, 196, 162, 0.3);
}

.btn-primary:active:not(:disabled) {
   transform: translateY(0);
}

.btn-primary:disabled {
   opacity: 0.7;
   cursor: not-allowed;
}

/* Loading Spinner */
.spinner {
   display: none;
   width: 20px;
   height: 20px;
   border: 2px solid rgba(255, 255, 255, 0.3);
   border-top: 2px solid var(--acre-white);
   border-radius: 50%;
   animation: spin 0.8s linear infinite;
}

@keyframes spin {
   to {
      transform: rotate(360deg);
   }
}

/* Messages */
.error-message,
.success-message {
   display: none;
   padding: 14px 16px;
   border-radius: 8px;
   margin-bottom: 24px;
   font-size: 14px;
   font-weight: 500;
   text-align: center;
}

.error-message {
   background: rgba(220, 53, 69, 0.1);
   color: #dc3545;
   border: 1px solid rgba(220, 53, 69, 0.2);
}

.success-message {
   background: rgba(20, 196, 162, 0.1);
   color: var(--acre-a1-green);
   border: 1px solid rgba(20, 196, 162, 0.2);
}

/* Info Box */
.info-box {
   margin-top: 32px;
   padding: 16px;
   background: var(--bridge-gradient-soft);
   border-radius: 8px;
   text-align: center;
   font-size: 14px;
   color: var(--text-secondary);
   border: 1px solid var(--border-color);
}

.info-box strong {
   display: block;
   color: var(--text-primary);
   margin-bottom: 4px;
   font-weight: 600;
}

/* Responsive Design */
@media (max-width: 480px) {
   .login-container {
      padding: 32px 24px;
      margin: 16px;
   }

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

   .acre-logo {
      max-width: 160px;
   }
}

/* Animation for page load */
.login-container {
   animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
   from {
      opacity: 0;
      transform: translateY(20px);
   }
   to {
      opacity: 1;
      transform: translateY(0);
   }
}

/* Bridge Curve Background - Following Brand Guidelines */
.login-container::before {
   content: '';
   position: absolute;
   top: -20%;
   right: -10%;
   width: 200px;
   height: 200px;
   opacity: 0.05;
   border-radius: 50% 0 50% 0;
   transform: rotate(-15deg);
   z-index: -1;
}

/* Tech Pattern Background */
.login-container::after {
   content: '';
   position: absolute;
   top: 0;
   left: 0;
   right: 0;
   bottom: 0;
   background-image: repeating-linear-gradient(45deg, transparent, transparent 50px, rgba(37, 49, 77, 0.02) 50px, rgba(37, 49, 77, 0.02) 51px);
   pointer-events: none;
   z-index: -1;
   border-radius: 12px;
}

/* Additional Brand Styling */
.form-actions {
   margin-top: 32px;
}

/* Update button hover state to be more subtle per brand guidelines */
.btn-primary:hover:not(:disabled) {
   background: linear-gradient(135deg, var(--acre-a1-green) 0%, #0fa590 100%);
   transform: translateY(-1px);
   box-shadow: 0 4px 12px rgba(20, 196, 162, 0.2);
}

/* Add brand-appropriate focus states */
input:focus-visible {
   outline: 2px solid var(--acre-a1-green);
   outline-offset: 2px;
}

/* Update loading spinner to use brand color */
.spinner {
   border-color: rgba(255, 255, 255, 0.3);
   border-top-color: var(--acre-cloud-white);
}

/* Add subtle animation to logo on page load */
.acre-logo {
   animation: fadeIn 0.8s ease-out;
}

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

/* Security: Prevent clickjacking with visual indicators */
input:focus {
   outline: 2px solid var(--acre-a1-green) !important;
   outline-offset: 2px !important;
}

/* Security: Disable text selection on sensitive elements */
.btn,
label {
   -webkit-user-select: none;
   -moz-user-select: none;
   -ms-user-select: none;
   user-select: none;
}

/* Security: Ensure form elements are visible and not overlapped */
form input,
form button {
   position: relative;
   z-index: 10;
}

/* Security: Prevent invisible overlays */
.login-container {
   isolation: isolate;
}

/* Security: Disable pointer events on decorative elements */
.login-container::before,
.login-container::after,
body::before {
   pointer-events: none !important;
}

/* Screen-reader-only utility (visually hidden, still announced) */
.sr-only {
   position: absolute;
   width: 1px;
   height: 1px;
   padding: 0;
   margin: -1px;
   overflow: hidden;
   clip-path: inset(50%);
   white-space: nowrap;
}

/* Dark Theme Toggle Button - matches the error page toggle. Anchored to
   .login-container (position: relative), so it sits inside the card. */
.theme-toggle {
   position: absolute;
   top: 16px;
   right: 16px;
   z-index: 2;
   display: inline-flex;
   align-items: center;
   justify-content: center;
   width: 40px;
   height: 40px;
   border-radius: 999px;
   border: 1px solid var(--border-color);
   background: var(--bg-secondary);
   color: var(--text-secondary);
   cursor: pointer;
   transition: all 0.2s ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
   color: var(--text-primary);
   border-color: rgba(20, 196, 162, 0.45);
   box-shadow: 0 10px 24px rgba(20, 196, 162, 0.15);
   outline: none;
}

.theme-toggle svg {
   width: 18px;
   height: 18px;
}

.theme-toggle [data-theme-icon='light'] {
   display: none;
}

.dark .theme-toggle [data-theme-icon='light'] {
   display: inline-flex;
}

.dark .theme-toggle [data-theme-icon='dark'] {
   display: none;
}

@media (max-width: 640px) {
   .theme-toggle {
      top: 16px;
      right: 16px;
      width: 36px;
      height: 36px;
   }
}

/* Dark mode specific adjustments */
.dark .form-group input {
   background: var(--bg-secondary);
   border-color: var(--border-color);
}

.dark .form-group input:focus {
   border-color: var(--acre-a1-green);
   box-shadow: 0 0 0 3px rgba(20, 196, 162, 0.2);
}
