/**
 * Login Page Styles
 * Credit: lautandigital.id
 */

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

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #a5b4fc;
  --purple: #8b5cf6;
  --error: #ef4444;
  --success: #22c55e;
  --text: #1e1b4b;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --bg-input: #f9fafb;
  --white: #ffffff;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 24px rgba(99,102,241,0.12);
  --shadow-lg: 0 20px 60px rgba(99,102,241,0.18);
  --radius: 12px;
  --radius-lg: 20px;
  --transition: 0.2s ease;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 50%, #ede9fe 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
  position: relative;
  overflow-x: hidden;
}

/* Background shapes */
.bg-shapes {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.35;
}

.shape-1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #6366f1, #8b5cf6);
  top: -120px;
  right: -80px;
  animation: float 8s ease-in-out infinite;
}

.shape-2 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, #a78bfa, #c4b5fd);
  bottom: -60px;
  left: -60px;
  animation: float 10s ease-in-out infinite reverse;
}

.shape-3 {
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, #818cf8, #6366f1);
  top: 40%;
  left: 15%;
  animation: float 7s ease-in-out infinite 2s;
}

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-24px) scale(1.04); }
}

/* Card */
.card {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  animation: slideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

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

/* Header */
.card-header {
  text-align: center;
  margin-bottom: 32px;
}

.logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  filter: drop-shadow(0 4px 12px rgba(99,102,241,0.35));
}

.logo svg {
  width: 100%;
  height: 100%;
}

.card-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.card-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

/* Form fields */
.field-group {
  margin-bottom: 18px;
}

.field-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 13px;
  width: 17px;
  height: 17px;
  color: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
  transition: color var(--transition);
}

.input-wrapper input {
  width: 100%;
  height: 46px;
  padding: 0 42px 0 40px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.92rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.input-wrapper input::placeholder {
  color: #b0b7c3;
}

.input-wrapper input:focus {
  border-color: var(--primary);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

.input-wrapper input:focus + .input-icon,
.input-wrapper:focus-within .input-icon {
  color: var(--primary);
}

.input-wrapper input.is-error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.1);
}

.input-wrapper input.is-valid {
  border-color: var(--success);
}

.toggle-password {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  border-radius: 6px;
  transition: color var(--transition), background var(--transition);
}

.toggle-password:hover {
  color: var(--primary);
  background: rgba(99,102,241,0.08);
}

.eye-icon {
  width: 18px;
  height: 18px;
}

.field-error {
  display: block;
  font-size: 0.78rem;
  color: var(--error);
  margin-top: 5px;
  min-height: 16px;
  padding-left: 2px;
}

/* Captcha */
.captcha-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.captcha-display {
  flex: 1;
  height: 54px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4c1d95 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--white);
  user-select: none;
  font-family: 'Courier New', monospace;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.captcha-display::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='100' height='54' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='27' x2='100' y2='27' stroke='rgba(255,255,255,0.1)' stroke-width='1'/%3E%3Cline x1='0' y1='18' x2='100' y2='38' stroke='rgba(255,255,255,0.06)' stroke-width='1'/%3E%3Cline x1='0' y1='38' x2='100' y2='14' stroke='rgba(255,255,255,0.06)' stroke-width='1'/%3E%3C/svg%3E");
}

.captcha-refresh {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition);
}

.captcha-refresh svg {
  width: 18px;
  height: 18px;
}

.captcha-refresh:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(99,102,241,0.06);
  transform: rotate(180deg);
}

/* Row options */
.row-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
  user-select: none;
}

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

.checkmark {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
}

.checkbox-label input:checked ~ .checkmark {
  background: var(--primary);
  border-color: var(--primary);
}

.checkbox-label input:checked ~ .checkmark::after {
  content: '';
  display: block;
  width: 5px;
  height: 9px;
  border: 2px solid white;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translate(-1px, -1px);
}

.forgot-link {
  font-size: 0.85rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition);
}

.forgot-link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* Submit button */
.btn-submit {
  width: 100%;
  height: 48px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--purple) 100%);
  border: none;
  border-radius: var(--radius);
  color: white;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition);
  box-shadow: 0 4px 14px rgba(99,102,241,0.4);
  letter-spacing: 0.01em;
}

.btn-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99,102,241,0.5);
}

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

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

.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Divider */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}

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

/* Social login */
.social-login {
  margin-bottom: 20px;
}

.btn-social {
  width: 100%;
  height: 46px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.btn-social svg {
  width: 20px;
  height: 20px;
}

.btn-social:hover {
  border-color: #c7d2fe;
  background: #f5f3ff;
  box-shadow: 0 2px 8px rgba(99,102,241,0.1);
}

/* Register text */
.register-text {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.register-text a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  transition: color var(--transition);
}

.register-text a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* Toast */
.toast {
  position: absolute;
  bottom: -70px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e1b4b;
  color: white;
  padding: 12px 20px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(30,27,75,0.25);
  transition: bottom 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
  opacity: 0;
}

.toast.show {
  bottom: 24px;
  opacity: 1;
}

.toast-icon {
  width: 16px;
  height: 16px;
  color: var(--success);
  flex-shrink: 0;
}

.toast.error .toast-icon {
  color: #fca5a5;
}

/* Utilities */
.hidden {
  display: none !important;
}

/* Credit footer */
.credit {
  position: fixed;
  bottom: 14px;
  right: 18px;
  z-index: 10;
  font-size: 0.75rem;
}

.credit a {
  color: rgba(99,102,241,0.7);
  text-decoration: none;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color var(--transition);
}

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

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

  .card-header h1 {
    font-size: 1.4rem;
  }
}
