/* ============================================
   Login Page — MAC Tools
   "Refined Blue & Gold" — Stitch Design System
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&display=swap');

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

:root {
  --primary-700: #001b3d;
  --primary-600: #002a5c;
  --primary-500: #31476b;
  --primary-50: #d6e3ff;
  --accent-400: #fdd400;
  --accent-500: #C4A055;
  --accent-600: #d4a017;
  --gray-50: #f8f9ff;
  --gray-100: #eff4ff;
  --gray-300: #dce9ff;
  --gray-500: #74777f;
  --gray-600: #44474e;
  --gray-800: #1e293b;
  --gray-900: #0b1c30;
  --danger: #ba1a1a;
  --danger-light: #ffdad6;
  --success: #2e7d32;
  --success-light: #e8f5e9;
  --info: #1d4ed8;
  --info-light: #eff6ff;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── Split Layout ── */
.login-page {
  display: flex;
  min-height: 100vh;
}

/* ── Left Panel (Brand) ── */
.login-brand {
  flex: 0 0 45%;
  background: linear-gradient(160deg, var(--primary-700) 0%, #000d1f 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 3rem;
  position: relative;
  overflow: hidden;
}

/* Decorative elements */
.login-brand::before {
  content: '';
  position: absolute;
  top: -15%;
  right: -20%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(196, 160, 85, 0.08) 0%, transparent 70%);
  border-radius: 50%;
}
.login-brand::after {
  content: '';
  position: absolute;
  bottom: -10%;
  left: -15%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(196, 160, 85, 0.06) 0%, transparent 70%);
  border-radius: 50%;
}

/* Grid pattern overlay */
.brand-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 60px 60px;
}

.brand-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 380px;
}

.brand-logo {
  width: 120px;
  height: auto;
  border-radius: 16px;
  margin-bottom: 1rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.brand-line {
  width: 48px;
  height: 3px;
  background: var(--accent-500);
  border-radius: 2px;
  margin: 0 auto 1.5rem;
}

.brand-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.brand-subtitle {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.45);
  line-height: 1.6;
  font-weight: 400;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2rem;
  padding: 8px 16px;
  background: rgba(196, 160, 85, 0.1);
  border: 1px solid rgba(196, 160, 85, 0.2);
  border-radius: 50px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-500);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.brand-badge::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--accent-500);
  border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.brand-footer {
  position: absolute;
  bottom: 2rem;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.65rem;
  color: rgba(255,255,255,0.2);
  z-index: 1;
}

/* ── Right Panel (Form) ── */
.login-form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  background: var(--gray-50);
  position: relative;
}

.login-wrapper {
  width: 100%;
  max-width: 420px;
}

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

.login-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-500);
  margin-bottom: 0.75rem;
}

.login-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--gray-500);
  line-height: 1.5;
}

/* Alert */
.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  margin-bottom: 1.25rem;
  display: none;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  line-height: 1.4;
}
.alert .material-symbols-outlined { font-size: 18px; flex-shrink: 0; }
.alert.error { display: flex; background: var(--danger-light); color: var(--danger); border-left: 3px solid var(--danger); }
.alert.success { display: flex; background: var(--success-light); color: var(--success); border-left: 3px solid var(--success); }
.alert.info { display: flex; background: var(--info-light); color: var(--info); border-left: 3px solid var(--info); }

/* Form */
.form-group {
  margin-bottom: 1.25rem;
  position: relative;
}

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

.form-input-wrap .input-icon {
  position: absolute;
  left: 14px;
  font-size: 20px;
  color: var(--gray-500);
  pointer-events: none;
  transition: color 0.2s;
}

.form-input {
  width: 100%;
  padding: 12px 14px 12px 46px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--gray-800);
  background: #fff;
  border: 1.5px solid #dce9ff;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  outline: none;
}
.form-input:focus {
  border-color: var(--primary-600);
  box-shadow: 0 0 0 3px rgba(0, 27, 61, 0.08);
}
.form-input:focus ~ .input-icon,
.form-input:focus + .input-icon {
  color: var(--primary-600);
}
.form-input::placeholder { color: #b0b8c4; }

/* Password toggle */
.toggle-password {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-500);
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}
.toggle-password:hover { color: var(--primary-600); }
.toggle-password .material-symbols-outlined { font-size: 20px; }

/* Submit Button */
.btn-submit {
  width: 100%;
  padding: 13px;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  background: var(--primary-700);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 27, 61, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 0.5rem;
}
.btn-submit:hover {
  background: var(--primary-600);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 27, 61, 0.35);
}
.btn-submit:active { transform: translateY(0); }
.btn-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}
.btn-submit .material-symbols-outlined { font-size: 18px; }

/* Spinner */
.btn-spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Forgot Password Link */
.forgot-link {
  display: block;
  text-align: center;
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--gray-500);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s;
}
.forgot-link:hover { color: var(--primary-600); }

/* ── Forgot Password Panel ── */
.forgot-panel {
  display: none;
}
.forgot-panel.active {
  display: block;
  animation: fadeSlideUp 0.3s ease;
}

.forgot-panel .forgot-header {
  margin-bottom: 1.5rem;
}

.forgot-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--gray-500);
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  padding: 0;
  margin-bottom: 1rem;
  transition: color 0.2s;
}
.forgot-back:hover { color: var(--primary-600); }
.forgot-back .material-symbols-outlined { font-size: 16px; }

/* Setup Mode */
.setup-mode .hide-on-setup { display: none; }
.setup-mode .show-on-setup { display: block; }
.show-on-setup { display: none; }

/* ── Animations ── */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-enter { animation: fadeSlideUp 0.3s ease forwards; }

/* ── Mobile Logo (hidden on desktop) ── */
.mobile-logo {
  display: none;
  text-align: center;
  margin-bottom: 1.5rem;
}
.mobile-logo img {
  width: 80px;
  height: auto;
  border-radius: 12px;
}
/* ── Maintenance Panel ── */
.maintenance-panel {
  display: none;
  text-align: center;
  animation: fadeSlideUp 0.4s ease;
}
.maintenance-panel.active {
  display: block;
}

.maintenance-content { padding: 1rem 0; }

.maintenance-icon {
  width: 72px; height: 72px;
  margin: 0 auto 1.5rem;
  background: linear-gradient(135deg, rgba(0,27,61,0.06), rgba(196,160,85,0.1));
  border: 2px solid rgba(196,160,85,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: iconSpin 8s linear infinite;
}
.maintenance-icon .material-symbols-outlined {
  font-size: 32px;
  color: var(--accent-500);
}
@keyframes iconSpin {
  0% { transform: rotate(0deg); }
  25% { transform: rotate(15deg); }
  50% { transform: rotate(0deg); }
  75% { transform: rotate(-15deg); }
  100% { transform: rotate(0deg); }
}

.maintenance-panel .login-title {
  font-size: 1.3rem;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
}
.maintenance-panel .login-subtitle {
  font-size: 0.85rem;
  color: var(--gray-500);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.maintenance-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(196,160,85,0.08);
  border: 1px solid rgba(196,160,85,0.15);
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-500);
  letter-spacing: 0.02em;
  margin-bottom: 1.25rem;
}

.maintenance-pulse {
  width: 8px; height: 8px;
  background: var(--accent-500);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.maintenance-progress {
  width: 100%;
  height: 3px;
  background: var(--gray-300);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}
.maintenance-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-500), var(--primary-600));
  border-radius: 3px;
  width: 0%;
  transition: width 1s linear;
}

.maintenance-countdown {
  font-size: 0.7rem;
  color: var(--gray-500);
  font-weight: 500;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .login-brand { display: none; }
  .login-form-panel { padding: 2rem 1.5rem; }
  .mobile-logo { display: block; }
}
