/**
 * UTTOP JPO 2026 - Login Page
 * "Campus Morning" Aesthetic - Soft Geometric Minimalism
 *
 * Design Philosophy:
 * - Refined serif (Crimson Pro) + modern sans (Plus Jakarta Sans)
 * - Soft multi-layer gradients with UTTOP palette
 * - Floating geometric shapes suggesting campus architecture
 * - Strong glassmorphism for elevated card
 * - Generous spacing and breathing room
 * - Gentle animations on load
 */

/* === CSS VARIABLES === */

:root {
  /* UTTOP Brand Colors */
  --uttop-blue: #004F78;
  --uttop-green: #10997D;
  --uttop-light-green: #45DB97;
  --uttop-yellow: #F5D837;
  --uttop-pink: #FF99D6;
  --uttop-purple: #586DDD;

  /* Typography */
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2.5rem;
  --spacing-xl: 4rem;

  /* Elevation */
  --shadow-soft: 0 8px 32px rgba(0, 79, 120, 0.08);
  --shadow-medium: 0 16px 48px rgba(0, 79, 120, 0.12);
  --shadow-strong: 0 24px 64px rgba(0, 79, 120, 0.16);

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  /* Transitions */
  --transition-fast: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* === RESET & BASE === */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body.login-page {
  font-family: var(--font-body);
  color: var(--uttop-blue);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;

  /* Multi-layer gradient background */
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 153, 214, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(69, 219, 151, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(245, 216, 55, 0.08) 0%, transparent 60%),
    linear-gradient(135deg, #f8f9fa 0%, #f5f5f5 50%, #f0f2f5 100%);
  background-attachment: fixed;
}

/* === BACKGROUND DECORATIONS === */

.bg-decorations {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-shape {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  animation: floatIn 1.2s ease-out forwards;
}

.bg-shape-1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(16, 153, 125, 0.12) 0%, transparent 70%);
  top: -100px;
  left: -100px;
  animation-delay: 200ms;
}

.bg-shape-2 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(245, 216, 55, 0.1) 0%, transparent 70%);
  bottom: 10%;
  right: -50px;
  border-radius: var(--radius-xl);
  animation-delay: 400ms;
}

.bg-shape-3 {
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(255, 153, 214, 0.1) 0%, transparent 70%);
  top: 40%;
  right: 10%;
  animation-delay: 600ms;
}

.bg-shape-4 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(69, 219, 151, 0.08) 0%, transparent 70%);
  bottom: -80px;
  left: 20%;
  border-radius: var(--radius-lg);
  animation-delay: 800ms;
}

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

/* === MAIN CONTAINER === */

.login-container {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-lg) var(--spacing-md);
  gap: var(--spacing-lg);
  max-width: 1200px;
  margin: 0 auto;
}

/* === LOGO HEADER === */

.login-header {
  text-align: center;
  opacity: 0;
  animation: fadeInDown 800ms ease-out 300ms forwards;
}

.logo-mark {
  width: 60px;
  height: 60px;
  margin: 0 auto var(--spacing-sm);
  filter: drop-shadow(0 4px 12px rgba(0, 79, 120, 0.15));
}

.logo-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  color: var(--uttop-blue);
  letter-spacing: -0.02em;
  margin-bottom: var(--spacing-xs);
}

.logo-subtitle {
  font-size: clamp(0.95rem, 2vw, 1.125rem);
  font-weight: 500;
  color: var(--uttop-green);
  letter-spacing: 0.02em;
}

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

/* === LOGIN CARD === */

.login-card {
  width: 100%;
  max-width: 500px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-strong);
  overflow: hidden;
  opacity: 0;
  animation: floatUp 1s ease-out 500ms forwards;
}

.card-inner {
  padding: var(--spacing-lg) var(--spacing-lg);
}

@keyframes floatUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* === WELCOME SECTION === */

.welcome-section {
  text-align: center;
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-lg);
  border-bottom: 1px solid rgba(0, 79, 120, 0.1);
}

.welcome-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  font-weight: 700;
  color: var(--uttop-blue);
  letter-spacing: -0.02em;
  margin-bottom: var(--spacing-sm);
}

.welcome-text {
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(0, 79, 120, 0.75);
  margin-bottom: var(--spacing-md);
}

.welcome-date {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-md);
  background: linear-gradient(135deg,
    rgba(16, 153, 125, 0.1) 0%,
    rgba(69, 219, 151, 0.1) 100%
  );
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--uttop-green);
}

.date-icon {
  display: flex;
  align-items: center;
}

/* === LOGIN FORM === */

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.form-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--uttop-blue);
  letter-spacing: 0.01em;
}

.label-required {
  color: var(--uttop-pink);
  font-weight: 700;
}

.label-optional {
  font-weight: 400;
  color: rgba(0, 79, 120, 0.5);
  font-size: 0.85rem;
}

.input-wrapper {
  position: relative;
}

.form-input {
  width: 100%;
  padding: var(--spacing-md) var(--spacing-sm);
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--uttop-blue);
  background: rgba(255, 255, 255, 0.6);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  outline: none;
  transition: all var(--transition-base);
}

.form-input::placeholder {
  color: rgba(0, 79, 120, 0.4);
  font-weight: 400;
}

.form-input:focus {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--uttop-green);
  box-shadow: 0 0 0 4px rgba(16, 153, 125, 0.1);
}

.form-input:focus + .input-underline {
  transform: scaleX(1);
}

.input-underline {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    var(--uttop-green) 0%,
    var(--uttop-light-green) 100%
  );
  transform: scaleX(0);
  transition: transform var(--transition-base);
  border-radius: 2px;
}

/* === ERROR MESSAGE === */

.error-message {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  background: rgba(255, 59, 48, 0.08);
  border: 1px solid rgba(255, 59, 48, 0.2);
  border-radius: var(--radius-md);
  color: #d32f2f;
  font-size: 0.9rem;
  font-weight: 500;
  animation: shake 400ms ease-out;
}

.error-icon {
  flex-shrink: 0;
  color: #d32f2f;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* === SUBMIT BUTTON === */

.submit-button {
  width: 100%;
  padding: var(--spacing-md) var(--spacing-lg);
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: white;
  background: linear-gradient(135deg,
    var(--uttop-green) 0%,
    var(--uttop-light-green) 100%
  );
  border: none;
  border-radius: var(--radius-lg);
  box-shadow:
    0 4px 12px rgba(16, 153, 125, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.submit-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  transition: left 500ms ease;
}

.submit-button:hover::before {
  left: 100%;
}

.submit-button:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 20px rgba(16, 153, 125, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.submit-button:active {
  transform: translateY(0);
  box-shadow:
    0 2px 8px rgba(16, 153, 125, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.submit-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.button-text {
  position: relative;
  z-index: 1;
}

.button-arrow {
  position: relative;
  z-index: 1;
  transition: transform var(--transition-base);
}

.submit-button:hover .button-arrow {
  transform: translateX(4px);
}

/* === PRIVACY INFO === */

.privacy-info {
  display: flex;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  background: rgba(16, 153, 125, 0.05);
  border-radius: var(--radius-md);
  border: 1px solid rgba(16, 153, 125, 0.1);
}

.privacy-icon {
  flex-shrink: 0;
  color: var(--uttop-green);
  opacity: 0.8;
}

.privacy-text {
  font-size: 0.85rem;
  line-height: 1.5;
  color: rgba(0, 79, 120, 0.75);
}

.privacy-text strong {
  color: var(--uttop-green);
  font-weight: 600;
  display: block;
  margin-bottom: 0.25rem;
}

/* === FOOTER === */

.login-footer {
  text-align: center;
  opacity: 0;
  animation: fadeIn 800ms ease-out 800ms forwards;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--uttop-blue);
  text-decoration: none;
  margin-bottom: var(--spacing-sm);
  padding: var(--spacing-xs) var(--spacing-md);
  border-radius: var(--radius-sm);
  transition: all var(--transition-base);
}

.footer-link:hover {
  background: rgba(16, 153, 125, 0.1);
  color: var(--uttop-green);
}

.footer-link svg {
  transition: transform var(--transition-base);
}

.footer-link:hover svg {
  transform: translateX(-4px);
}

.footer-copyright {
  font-size: 0.85rem;
  color: rgba(0, 79, 120, 0.5);
  margin-top: var(--spacing-sm);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* === LOADING OVERLAY === */

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-md);
}

.loading-spinner {
  position: relative;
  width: 60px;
  height: 60px;
}

.spinner-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 3px solid transparent;
  border-radius: 50%;
  animation: spin 1.5s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.spinner-ring:nth-child(1) {
  border-top-color: var(--uttop-green);
  animation-delay: 0ms;
}

.spinner-ring:nth-child(2) {
  border-top-color: var(--uttop-light-green);
  animation-delay: -0.5s;
  width: 80%;
  height: 80%;
  top: 10%;
  left: 10%;
}

.spinner-ring:nth-child(3) {
  border-top-color: var(--uttop-pink);
  animation-delay: -1s;
  width: 60%;
  height: 60%;
  top: 20%;
  left: 20%;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loading-text {
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--uttop-blue);
}

/* === RESPONSIVE === */

@media (min-width: 640px) {
  .card-inner {
    padding: var(--spacing-xl) var(--spacing-xl);
  }

  .login-container {
    padding: var(--spacing-xl) var(--spacing-lg);
  }
}

@media (min-width: 768px) {
  .bg-shape-1 {
    width: 500px;
    height: 500px;
  }

  .bg-shape-2 {
    width: 400px;
    height: 400px;
  }

  .bg-shape-3 {
    width: 350px;
    height: 350px;
  }

  .bg-shape-4 {
    width: 450px;
    height: 450px;
  }

  .login-card {
    max-width: 540px;
  }
}

/* === GPS CONSENT SECTION === */

.gps-consent-section {
  margin-top: var(--spacing-lg);
  padding: var(--spacing-md);
  background: rgba(16, 153, 125, 0.03);
  border-radius: var(--radius-md);
  border: 1px solid rgba(16, 153, 125, 0.1);
}

.consent-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-sm);
}

.consent-header .form-label {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  margin-bottom: 0;
  font-weight: 600;
  color: var(--uttop-green);
}

.consent-icon {
  color: var(--uttop-green);
  flex-shrink: 0;
}

.consent-badge {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 12px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  color: var(--text-secondary, #666);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 56px;
  height: 32px;
  cursor: pointer;
  user-select: none;
}

.toggle-input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 32px;
  transition: all var(--transition-base);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 24px;
  width: 24px;
  left: 4px;
  bottom: 4px;
  background: white;
  border-radius: 50%;
  transition: all var(--transition-base);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.toggle-input:checked + .toggle-slider {
  background: var(--uttop-green);
  box-shadow: 0 0 0 2px rgba(16, 153, 125, 0.2);
}

.toggle-input:checked + .toggle-slider::before {
  transform: translateX(24px);
}

.toggle-input:focus + .toggle-slider {
  outline: 3px solid rgba(16, 153, 125, 0.3);
  outline-offset: 2px;
}

/* Consent Help Text */
.consent-help {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-xs);
  margin-top: var(--spacing-sm);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-secondary, #666);
}

.consent-help svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--uttop-blue);
  opacity: 0.6;
}

/* === ACCESSIBILITY === */

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

  .bg-shape {
    opacity: 1;
  }

  .login-header,
  .login-card,
  .login-footer {
    opacity: 1;
  }
}

@media (prefers-color-scheme: dark) {
  /* Optional: Keep light theme even in dark mode for consistency */
  /* Remove this block if dark mode variant is desired */
}

/* === PRINT === */

@media print {
  .bg-decorations,
  .loading-overlay {
    display: none !important;
  }
}
