/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
}

/* Animated Background */
.background {
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: -1;
  overflow: hidden;
}

.background .shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.5;
  animation: float 20s infinite ease-in-out;
}

.background .shape:first-child {
  width: 500px;
  height: 500px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  top: -100px;
  left: -100px;
  animation-delay: 0s;
}

.background .shape:last-child {
  width: 600px;
  height: 600px;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  bottom: -150px;
  right: -150px;
  animation-delay: -10s;
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(50px, -50px) scale(1.1);
  }
  66% {
    transform: translate(-50px, 50px) scale(0.9);
  }
}

/* Container */
.container {
  width: 100%;
  max-width: 440px;
  padding: 20px;
  z-index: 1;
}

/* Login Form */
.login-form {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  padding: 50px 40px;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.5s ease-out;
}

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

/* Logo Section */
.logo-container {
  text-align: center;
  margin-bottom: 40px;
}

.logo {
  width: 60px;
  height: 60px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.logo svg {
  width: 32px;
  height: 32px;
  color: white;
}

.login-form h1 {
  font-size: 28px;
  font-weight: 700;
  color: #1a202c;
  margin-bottom: 8px;
}

.subtitle {
  font-size: 14px;
  color: #718096;
  font-weight: 400;
}

/* Form Groups */
.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 8px;
}

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

.input-icon {
  position: absolute;
  left: 16px;
  width: 20px;
  height: 20px;
  color: #a0aec0;
  pointer-events: none;
  z-index: 1;
}

.input-wrapper input {
  width: 100%;
  padding: 14px 16px 14px 48px;
  font-size: 15px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  color: #2d3748;
  transition: all 0.3s ease;
  font-family: inherit;
}

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

.input-wrapper input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.toggle-password {
  position: absolute;
  right: 16px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a0aec0;
  transition: color 0.2s ease;
}

.toggle-password:hover {
  color: #667eea;
}

.toggle-password svg {
  width: 20px;
  height: 20px;
}

/* Form Options */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  font-size: 14px;
}

/* Custom Checkbox */
.checkbox-container {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  position: relative;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid #cbd5e0;
  border-radius: 4px;
  margin-right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.checkbox-container input:checked ~ .checkmark {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: #667eea;
}

.checkbox-container input:checked ~ .checkmark::after {
  content: '';
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-label {
  color: #4a5568;
  font-weight: 500;
}

.forgot-password {
  color: #667eea;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.forgot-password:hover {
  color: #764ba2;
}

/* Submit Button */
.submit-btn {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  font-family: inherit;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
}

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

.btn-icon {
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
}

.submit-btn:hover .btn-icon {
  transform: translateX(4px);
}

/* Divider */
.divider {
  display: flex;
  align-items: center;
  margin: 32px 0;
  color: #a0aec0;
  font-size: 14px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

.divider span {
  padding: 0 16px;
}

/* Social Login */
.social-login {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
}

.social-btn {
  flex: 1;
  padding: 14px;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

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

.social-btn:hover {
  border-color: #cbd5e0;
  background: #f7fafc;
  transform: translateY(-2px);
}

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

/* Signup Link */
.signup-link {
  text-align: center;
  font-size: 14px;
  color: #4a5568;
}

.signup-link a {
  color: #667eea;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.signup-link a:hover {
  color: #764ba2;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.modal.active {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background: white;
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  animation: modalSlideUp 0.3s ease;
}

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

.modal-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: shake 0.5s ease;
}

.modal-icon.error {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.modal-icon svg {
  width: 40px;
  height: 40px;
  color: white;
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

.modal-content h2 {
  font-size: 24px;
  font-weight: 700;
  color: #1a202c;
  margin-bottom: 12px;
}

.modal-content p {
  font-size: 15px;
  color: #718096;
  margin-bottom: 28px;
  line-height: 1.6;
}

.modal-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

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

/* Responsive Design */

/* Tablets and small desktops */
@media (max-width: 768px) {
  .container {
    max-width: 500px;
    padding: 16px;
  }

  .login-form {
    padding: 45px 35px;
  }

  .background .shape:first-child {
    width: 400px;
    height: 400px;
  }

  .background .shape:last-child {
    width: 500px;
    height: 500px;
  }
}

/* Mobile devices */
@media (max-width: 480px) {
  body {
    overflow-x: hidden;
  }

  .container {
    padding: 12px;
    max-width: 100%;
  }

  .login-form {
    padding: 35px 24px;
    border-radius: 16px;
  }
  
  .logo-container {
    margin-bottom: 32px;
  }

  .logo {
    width: 52px;
    height: 52px;
  }

  .logo svg {
    width: 28px;
    height: 28px;
  }
  
  .login-form h1 {
    font-size: 24px;
  }

  .subtitle {
    font-size: 13px;
  }

  .form-group {
    margin-bottom: 20px;
  }

  .form-group label {
    font-size: 13px;
  }

  .input-wrapper input {
    padding: 13px 16px 13px 44px;
    font-size: 16px; /* Prevents iOS zoom on focus */
  }

  .input-icon {
    width: 18px;
    height: 18px;
    left: 14px;
  }

  .toggle-password {
    right: 12px;
  }

  .toggle-password svg {
    width: 18px;
    height: 18px;
  }

  .form-options {
    margin-bottom: 24px;
    font-size: 13px;
    flex-wrap: wrap;
    gap: 12px;
  }

  .checkbox-label {
    font-size: 13px;
  }

  .forgot-password {
    font-size: 13px;
  }

  .submit-btn {
    padding: 15px;
    font-size: 15px;
  }

  .divider {
    margin: 28px 0;
    font-size: 13px;
  }
  
  .social-login {
    flex-direction: row;
    gap: 10px;
  }

  .social-btn {
    padding: 12px;
    min-height: 48px; /* Touch target size */
  }

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

  .signup-link {
    font-size: 13px;
  }
  
  .modal-content {
    padding: 32px 24px;
    border-radius: 16px;
    width: 92%;
  }

  .modal-icon {
    width: 70px;
    height: 70px;
    margin-bottom: 20px;
  }

  .modal-icon svg {
    width: 35px;
    height: 35px;
  }

  .modal-content h2 {
    font-size: 22px;
  }

  .modal-content p {
    font-size: 14px;
    margin-bottom: 24px;
  }

  .modal-btn {
    padding: 13px;
    font-size: 15px;
  }

  /* Adjust background shapes for mobile */
  .background .shape:first-child {
    width: 300px;
    height: 300px;
    top: -80px;
    left: -80px;
  }

  .background .shape:last-child {
    width: 350px;
    height: 350px;
    bottom: -100px;
    right: -100px;
  }
}

/* Extra small mobile devices */
@media (max-width: 360px) {
  .login-form {
    padding: 30px 20px;
  }

  .login-form h1 {
    font-size: 22px;
  }

  .logo {
    width: 48px;
    height: 48px;
  }

  .logo svg {
    width: 24px;
    height: 24px;
  }

  .input-wrapper input {
    padding: 12px 14px 12px 42px;
  }

  .social-login {
    gap: 8px;
  }

  .social-btn {
    padding: 10px;
  }

  .modal-content {
    padding: 28px 20px;
  }
}

/* Landscape orientation on mobile */
@media (max-height: 600px) and (orientation: landscape) {
  body {
    overflow-y: auto;
    align-items: flex-start;
    padding: 20px 0;
  }

  .container {
    margin: 20px auto;
  }

  .login-form {
    padding: 25px 30px;
  }

  .logo-container {
    margin-bottom: 20px;
  }

  .logo {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
  }

  .login-form h1 {
    font-size: 22px;
  }

  .subtitle {
    font-size: 12px;
  }

  .form-group {
    margin-bottom: 16px;
  }

  .divider {
    margin: 20px 0;
  }

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

  .modal-content {
    padding: 25px 20px;
    max-height: 90vh;
    overflow-y: auto;
  }

  .modal-icon {
    width: 60px;
    height: 60px;
    margin-bottom: 16px;
  }
}

/* Prevent horizontal scroll on all devices */
@media (max-width: 768px) {
  body {
    overflow-x: hidden;
  }

  .container {
    overflow-x: hidden;
  }
}

/* Loading State */
.submit-btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.submit-btn.loading .btn-text::after {
  content: '...';
  animation: dots 1.5s infinite;
}

@keyframes dots {
  0%, 20% {
    content: '.';
  }
  40% {
    content: '..';
  }
  60%, 100% {
    content: '...';
  }
}

