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

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

:root {
  --bg-primary: #0a0f1e;
  --bg-secondary: #1e293b;
  --bg-tertiary: #0f172a;
  --border-color: rgba(148, 163, 184, 0.2);
  --text-primary: #e2e8f0;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --accent-blue: #3b82f6;
  --accent-blue-hover: #2563eb;
  --accent-green: #10b981;
  --accent-red: #ef4444;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  line-height: 1.6;
}

/* ============================================
   LOGIN PAGE LAYOUT
   ============================================ */

.login-page {
  background: linear-gradient(135deg, #0a0f1e 0%, #1a1f35 50%, #0f172a 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.login-container {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 480px;
  padding: 2rem;
}

.login-card {
  background: rgba(30, 41, 59, 0.8);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 1.5rem;
  padding: 3rem 2.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.6s ease-out;
}

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

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

.login-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.login-logo {
  margin-bottom: 1.5rem;
  animation: float 3s ease-in-out infinite;
}

.login-logo svg {
  filter: drop-shadow(0 0 20px rgba(59, 130, 246, 0.3));
}

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

.login-header h1 {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #3b82f6, #10b981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.login-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

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

.error-message {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 1rem 1.25rem;
  border-radius: 0.75rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 500;
  animation: shake 0.5s ease-in-out;
}

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

.error-message.fade-out {
  animation: fadeOut 0.3s ease-out forwards;
}

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

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

.login-form {
  margin-bottom: 2rem;
}

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

.form-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.9rem;
}

.form-group label svg {
  color: #64748b;
}

/* ============================================
   INPUT WRAPPER
   ============================================ */

.input-wrapper {
  position: relative;
  transition: all 0.3s ease;
}

.input-wrapper input {
  width: 100%;
  padding: 1rem 3rem 1rem 3rem;
  background: rgba(15, 23, 42, 0.5);
  border: 2px solid rgba(148, 163, 184, 0.2);
  border-radius: 0.75rem;
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.3s ease;
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--accent-blue);
  background: rgba(15, 23, 42, 0.8);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.input-wrapper input::placeholder {
  color: #64748b;
}

.input-wrapper.focused {
  transform: translateY(-2px);
}

.input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  pointer-events: none;
  transition: color 0.3s ease;
}

.input-wrapper input:focus ~ .input-icon {
  color: var(--accent-blue);
}

/* ============================================
   PASSWORD TOGGLE
   ============================================ */

.toggle-password {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  transition: color 0.2s ease;
}

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

.toggle-password:focus {
  outline: none;
}

/* ============================================
   CHECKBOX
   ============================================ */

.form-options {
  margin-bottom: 1.5rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  display: none;
}

.checkbox-custom {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(148, 163, 184, 0.3);
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  position: relative;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-green));
  border-color: transparent;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
  content: "✓";
  color: white;
  font-size: 14px;
  font-weight: bold;
}

.checkbox-label span:last-child {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

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

.btn {
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(
    135deg,
    var(--accent-blue),
    var(--accent-blue-hover)
  );
  color: white;
}

.btn-block {
  width: 100%;
  padding: 1.125rem;
  font-size: 1.05rem;
  border-radius: 0.75rem;
}

.btn-block::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.btn-block:hover::before {
  left: 100%;
}

.btn-block:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
}

.btn-block:active {
  transform: translateY(0);
}

.btn-block:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-block.loading {
  background: linear-gradient(135deg, var(--accent-blue-hover), #1d4ed8);
}

/* ============================================
   BUTTON LOADER
   ============================================ */

.btn-text,
.btn-loader {
  display: inline-block;
}

.spinner {
  animation: rotate 1s linear infinite;
}

.spinner .path {
  stroke: white;
  stroke-linecap: round;
  animation: dash 1.5s ease-in-out infinite;
}

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

@keyframes dash {
  0% {
    stroke-dasharray: 1, 150;
    stroke-dashoffset: 0;
  }
  50% {
    stroke-dasharray: 90, 150;
    stroke-dashoffset: -35;
  }
  100% {
    stroke-dasharray: 90, 150;
    stroke-dashoffset: -124;
  }
}

/* ============================================
   FOOTER
   ============================================ */

.login-footer {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.security-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 2rem;
  color: #6ee7b7;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

.copyright {
  color: #64748b;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

/* ============================================
   ANIMATED BACKGROUND
   ============================================ */

.login-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  overflow: hidden;
}

.bg-shape {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.15), transparent);
  filter: blur(80px);
  animation: float-shape 25s ease-in-out infinite;
}

.shape-1 {
  width: 500px;
  height: 500px;
  top: -250px;
  left: -250px;
  animation-delay: 0s;
}

.shape-2 {
  width: 700px;
  height: 700px;
  bottom: -350px;
  right: -350px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.15), transparent);
  animation-delay: 8s;
}

.shape-3 {
  width: 600px;
  height: 600px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(139, 92, 246, 0.1), transparent);
  animation-delay: 16s;
}

@keyframes float-shape {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(100px, -100px) scale(1.2);
  }
  66% {
    transform: translate(-100px, 100px) scale(0.8);
  }
}

/* ============================================
   GRID BACKGROUND
   ============================================ */

.bg-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: grid-move 20s linear infinite;
}

@keyframes grid-move {
  0% {
    transform: translate(0, 0);
  }
  100% {
    transform: translate(50px, 50px);
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

*:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

button:focus-visible {
  outline-offset: 4px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .login-container {
    padding: 1rem;
  }

  .login-card {
    padding: 2rem 1.5rem;
    border-radius: 1.25rem;
  }

  .login-header h1 {
    font-size: 1.75rem;
  }

  .login-header p {
    font-size: 0.9rem;
  }

  .input-wrapper input {
    padding: 0.875rem 2.75rem 0.875rem 2.75rem;
    font-size: 0.95rem;
  }

  .btn-block {
    padding: 1rem;
    font-size: 1rem;
  }

  .bg-shape {
    filter: blur(60px);
  }
}

@media (max-width: 480px) {
  .login-card {
    padding: 1.5rem 1.25rem;
  }

  .login-header {
    margin-bottom: 2rem;
  }

  .login-logo {
    margin-bottom: 1rem;
  }

  .login-logo svg {
    width: 60px;
    height: 60px;
  }

  .login-header h1 {
    font-size: 1.5rem;
  }

  .form-group {
    margin-bottom: 1.25rem;
  }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */

@media (prefers-color-scheme: light) {
  /* Keep dark theme for login page */
  /* This ensures consistent branding */
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  .login-background {
    display: none;
  }

  .login-card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}
