/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
}

:root {
  --primary-color: #4299e1;
  --primary-dark: #3182ce;
  --secondary-color: #2d3748;
  --background-color: #1a202c;
  --text-primary: #f7fafc;
  --text-secondary: #cbd5e0;
  --error-color: #fc8181;
  --success-color: #68d391;
  --border-color: #2d3748;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.3);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 1rem;
}

body {
  background: var(--background-color);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

/* Container Styles */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: clamp(1rem, 5vw, 2rem);
  background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
}

/* Form Styles */
.login-form {
  background: #2d3748;
  padding: clamp(1.5rem, 5vw, 2.5rem);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: min(90vw, 400px);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

@media (hover: hover) {
  .login-form:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg), 0 15px 30px rgba(0, 0, 0, 0.1);
  }
}

/* Heading Styles */
.login-form h2 {
  font-size: clamp(1.5rem, 5vw, 2rem);
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 1.5rem;
  font-weight: 600;
}

/* Form Groups */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  font-weight: 500;
  font-size: clamp(0.875rem, 2vw, 0.95rem);
}

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: clamp(0.875rem, 2vw, 1rem);
  transition: all 0.2s ease;
  outline: none;
  background-color: #1a202c;
  color: var(--text-primary);
}

.form-group input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.15);
}

/* Button Styles */
.login-btn {
  width: 100%;
  padding: clamp(0.75rem, 2vw, 0.875rem);
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: clamp(0.875rem, 2vw, 1rem);
  font-weight: 500;
  cursor: pointer;
  margin-top: 1.5rem;
  transition: all 0.2s ease;
}

@media (hover: hover) {
  .login-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.15);
  }

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

/* Footer Styles */
.form-footer {
  text-align: center;
  margin-top: 1.5rem;
  color: var(--text-secondary);
  font-size: clamp(0.875rem, 2vw, 0.95rem);
}

.form-footer a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

@media (hover: hover) {
  .form-footer a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
  }
}

/* Error States */
.form-group input.error {
  border-color: var(--error-color);
  background-color: #fff5f5;
}

.error-message {
  color: var(--error-color);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

/* Loading State */
.login-btn.loading {
  opacity: 0.7;
  cursor: not-allowed;
  position: relative;
}

.login-btn.loading::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Responsive Adjustments */
@media (max-width: 480px) {
  .login-container {
    padding: 1rem;
  }

  .login-form {
    padding: 1.5rem;
  }

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

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  :root {
    --background-color: #1a202c;
    --text-primary: #f7fafc;
    --text-secondary: #cbd5e0;
    --border-color: #2d3748;
  }

  .login-form {
    background: #2d3748;
  }

  .form-group input {
    background-color: #1a202c;
    color: var(--text-primary);
  }

  .login-container {
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* High Contrast Mode */
@media (forced-colors: active) {
  .login-btn {
    border: 2px solid currentColor;
  }
}

/* Profile Page Styles */
.profile-container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  background: #2d3748;
}

.profile-container h1 {
  color: #f7fafc;
  text-align: center;
  margin-bottom: 30px;
  font-size: 2rem;
  border-bottom: 2px solid #4a5568;
  padding-bottom: 10px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  width: 100%;
  margin: 1rem 0;
}

.profile-info {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  border-radius: var(--radius-sm);
  background-color: var(--secondary-color);
  gap: 0.75rem;
}

.profile-label {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.profile-value {
  word-break: break-word;
}

.logout-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background-color: #e74c3c;
  color: white;
  border: none;
  border-radius: 8px;
  margin-top: 20px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s ease;
}

.logout-btn:hover {
  background-color: #c0392b;
}

/* Profile Page Responsive Styles */
@media (max-width: 480px) {
  .profile-container {
    padding: 20px;
  }

  .profile-container h1 {
    font-size: 1.5rem;
  }

  .profile-info {
    padding: 10px;
  }

  .profile-label {
    display: block;
    margin-bottom: 5px;
  }
}

/* Dark Mode Support for Profile Page */
@media (prefers-color-scheme: dark) {
  .profile-container {
    background: #2d3748;
  }

  .profile-container h1 {
    color: #f7fafc;
    border-bottom-color: #4a5568;
  }

  .profile-info {
    background-color: #1a202c;
  }

  .profile-label {
    color: #e2e8f0;
  }

  .profile-value {
    color: #f7fafc;
  }
}

/* Activity Section Styles */
.form-control {
  width: 100%;
  padding: 8px;
  margin-bottom: 5px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
}

.submit-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  margin-top: 0;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s ease;
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.submit-btn:hover:not(:disabled) {
  background-color: var(--primary-dark);
}

/* Validation Styles */
.form-control.valid {
  border-color: var(--success-color, #28a745);
}

.form-control.invalid {
  border-color: var(--error-color, #dc3545);
}

/* Tooltip for validation requirements */
.form-control:focus + .validation-tooltip {
  display: block;
}

.validation-tooltip {
  display: none;
  position: absolute;
  background: var(--background-color);
  padding: 10px;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-size: 0.875rem;
  margin-top: 5px;
  z-index: 1000;
  border: 1px solid var(--border-color);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .validation-tooltip {
    background: var(--background-color);
    border-color: var(--border-color);
  }
}

.language-switcher {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 10px;
  background: var(--secondary-color);
  padding: 8px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.language-switcher a {
  text-decoration: none;
  color: var(--text-primary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.language-switcher a.active {
  background: var(--primary-color);
  color: white;
}

@media (prefers-color-scheme: dark) {
  .language-switcher {
    background: var(--secondary-color);
  }
}

/* Password Rules Card Styles */
.input-rules-container {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.input-section {
  flex: 1;
  min-width: 280px;
  width: 100%;
}

.password-rules-card {
  flex: 1;
  min-width: 280px;
  background-color: var(--secondary-color);
  border-radius: 8px;
  padding: 20px;
  width: 100%;
}

.password-rules-card h3 {
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  font-weight: 600;
}

#password-rules {
  list-style: none;
  padding: 0;
  margin: 0;
}

.rule {
  display: flex;
  align-items: center;
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
  font-size: clamp(0.875rem, 2vw, 0.95rem);
  transition: color 0.2s ease;
}

.rule i {
  margin-right: 0.75rem;
  width: 1rem;
  text-align: center;
}

.rule i.fa-times {
  color: var(--error-color);
}

.rule i.fa-check {
  color: var(--success-color);
}

/* Dark Mode Support for Password Rules */
@media (prefers-color-scheme: dark) {
  .password-rules-card {
    background-color: var(--secondary-color);
  }
}

/* Responsive Adjustments for Password Rules */
@media (max-width: 768px) {
  .input-rules-container {
    flex-direction: column;
    gap: 15px;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .form-control {
    font-size: 16px;
    padding: 10px;
  }

  .password-rules-card {
    margin-top: 15px;
    padding: 15px;
  }

  .rule {
    font-size: 0.85rem;
    margin-bottom: 8px;
  }

  .profile-info {
    padding: 10px;
  }
}

/* Add styles for very small screens */
@media (max-width: 320px) {
  .input-section,
  .password-rules-card {
    min-width: 100%;
  }

  .profile-container {
    padding: 10px;
  }
}

.popup {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 15px 25px;
  border-radius: 5px;
  color: white;
  font-weight: 500;
  transform: translateX(150%);
  transition: transform 0.3s ease-in-out;
  z-index: 1000;
}

.popup.show {
  transform: translateX(0);
}

.popup.success {
  background-color: var(--success-color, #28a745);
}

.popup.error {
  background-color: var(--error-color, #dc3545);
}

#confirmTextField {
  margin-top: 5px;
}

.math-captcha-container {
  margin: 20px 0;
}

.math-captcha-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.math-question {
  font-size: 18px;
  font-weight: 600;
  color: #495057;
  min-width: 120px;
  text-align: center;
  background: white;
  padding: 10px 15px;
  border-radius: 6px;
  border: 1px solid #dee2e6;
}

.math-captcha-input {
  flex: 1;
  max-width: 100px;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
}

.btn-refresh-captcha {
  background: #6c757d;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 10px;
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-refresh-captcha:hover {
  background: #5a6268;
}

.btn-refresh-captcha:active {
  transform: scale(0.95);
}
