/* ----- Login Page ----- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-lg);
}

.login-card {
  margin: 0 auto;
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.6s ease;
  position: relative;
  z-index: 10;
}

.login-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.login-header .brand-icon {
  width: 56px;
  height: 56px;
  font-size: var(--text-2xl);
  margin: 0 auto var(--space-md);
  border-radius: var(--radius-md);
}

.login-header h1 {
  font-size: var(--text-2xl);
  font-weight: 700;
  margin-bottom: var(--space-sm);
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-header p {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.login-error {
  padding: var(--space-md);
  background: var(--danger-bg);
  border: 1px solid hsla(0, 72%, 51%, 0.2);
  border-radius: var(--radius-md);
  color: var(--danger);
  font-size: var(--text-sm);
  margin-bottom: var(--space-lg);
  display: none;
  animation: shake 0.4s ease;
}

.login-error.visible {
  display: block;
}

/* Ensure login form inputs work properly */
.login-card .form-input,
.login-card .form-textarea,
.login-card .btn {
  position: relative;
  z-index: 11;
  pointer-events: all;
}

.login-card .form-input:focus,
.login-card .form-textarea:focus {
  z-index: 11;
}

/* ----- Access Request Section ----- */
.access-request {
  margin-top: var(--space-lg);
  text-align: center;
}

.access-request-text {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

/* ----- Modal Styles ----- */
/* ----- Modal Styles (Standardized via base.css) ----- */

/* .modal-overlay.show removed in favor of .modal-overlay.active in base.css */

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideInUp 0.3s ease;
  pointer-events: all;
  position: relative;
  z-index: 1001;
}

/* Ensure form inputs work properly in modal */
.modal-content .form-input,
.modal-content .form-textarea {
  position: relative;
  z-index: 1002;
  pointer-events: all;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.modal-content .form-input:focus,
.modal-content .form-textarea:focus {
  z-index: 1002;
  pointer-events: all;
}

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

.modal-header h2 {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: var(--text-2xl);
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-xs);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Form actions for access modal */
#access-form .form-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: flex-end;
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-color);
}

#access-form .form-actions .btn {
  min-width: 120px;
}

/* ----- Mobile Responsive Design ----- */
@media (max-width: 768px) {
  /* .modal-overlay override removed (standardized in base.css) */

  .modal-content {
    padding: var(--space-lg);
    max-width: 95vw;
    width: 100%;
    margin: var(--space-md);
    max-height: 85vh;
  }

  .modal-header {
    margin-bottom: var(--space-lg);
    flex-wrap: nowrap;
    gap: var(--space-sm);
  }

  .modal-header h2 {
    font-size: var(--text-lg);
    line-height: 1.3;
    flex: 1;
    min-width: 0;
  }

  .modal-close {
    font-size: var(--text-xl);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .form-group {
    margin-bottom: var(--space-md);
  }

  .form-label {
    font-size: var(--text-sm);
    margin-bottom: var(--space-xs);
    font-weight: 500;
  }

  .form-input,
  .form-textarea {
    padding: 12px 14px;
    font-size: var(--text-sm);
    min-height: 44px;
    /* iOS touch target size */
  }

  .form-textarea {
    min-height: 100px;
    resize: vertical;
  }

  .form-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-color);
  }

  .form-actions .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
    /* iOS touch target size */
    padding: 12px 20px;
    font-size: var(--text-sm);
  }

  .form-actions .btn-primary {
    order: 2;
    /* Primary button second on mobile */
  }

  .form-actions .btn-secondary {
    order: 1;
    /* Secondary button first on mobile */
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  /* .modal-overlay override removed (standardized in base.css) */

  .modal-content {
    padding: var(--space-md);
    margin: var(--space-sm);
    max-height: 90vh;
    border-radius: var(--radius-lg);
  }

  .modal-header {
    margin-bottom: var(--space-md);
  }

  .modal-header h2 {
    font-size: var(--text-base);
  }

  .modal-close {
    width: 28px;
    height: 28px;
    font-size: var(--text-lg);
  }

  .form-input,
  .form-textarea {
    padding: 10px 12px;
    font-size: 16px;
    /* Prevent zoom on iOS */
  }

  .form-actions {
    gap: var(--space-xs);
    margin-top: var(--space-md);
  }

  .form-actions .btn {
    padding: 10px 16px;
    font-size: var(--text-sm);
  }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .modal-content {
    max-height: 95vh;
    overflow-y: auto;
  }

  .form-textarea {
    min-height: 80px;
  }
}

.form-textarea {
  width: 100%;
  padding: var(--space-md);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: inherit;
  resize: vertical;
  min-height: 100px;
  transition: all 0.2s ease;
}

.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: flex-end;
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-color);
}

/* ----- Animations ----- */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideInUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}