/**
 * common.css - Shared styles for English Buddy application
 * 
 * This file contains styles used across multiple pages:
 * - Basic setup and CSS variables
 * - Page structure and layout
 * - Header and logo styling
 * - Background animations and effects
 */

/* CSS Variables - define colors and values in one place for easy changes */
:root {
  --blur-size: 100px;              /* Size of background blur effects */
  --primary-color: #3d48e0;        /* Main brand color (blue) */
  --secondary-color: #ff66c4;      /* Secondary brand color (pink) */
  --secondary-dark: #cc2b89;       /* Darker version of secondary color for hover states */
  --bg-color: #f4f9ff;             /* Background color (light blue) */
  --white: #ffffff;                /* Pure white */
  --shadow-light: rgba(0, 0, 0, 0.08); /* Light shadow for subtle effects */
  --shadow-med: rgba(0, 0, 0, 0.12);   /* Medium shadow for more pronounced effects */
}

/* CSS Reset - ensures consistent styling across browsers */
* {
  box-sizing: border-box;          /* Width/height includes padding and border */
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

/* Base body styling */
body {
  margin: 0;                       /* Remove default margin */
  padding: 0;                      /* Remove default padding */
  font-family: 'Outfit', sans-serif; /* Use Outfit font from Google Fonts */
  background: var(--bg-color);     /* Light blue background */
  position: relative;              /* For positioning child elements */
  height: 100vh;                   /* Full viewport height */
  display: flex;                   /* Use flexbox for layout */
  flex-direction: column;          /* Stack children vertically */
  width: 100%;                     /* Ensure full width */
  overflow-x: hidden;              /* Prevent horizontal scrolling */
}

/* Homepage specific styles */
body.home-page {
  overflow: hidden;                /* Hide overflow to prevent scrolling on home page only */
  position: fixed;                 /* Fix position to prevent mobile scrolling */
  width: 100%;                     /* Full width */
  height: 100%;                    /* Full height */
}

/* Main content container */
.page-content {
  flex: 1;                         /* Take remaining space */
  display: flex;                   /* Use flexbox */
  flex-direction: column;          /* Stack content vertically */
  position: relative;              /* For positioning child elements */
  z-index: 1;                      /* Position above background blurs */
  width: 100%;                     /* Ensure full width */
  overflow-x: hidden;              /* Prevent horizontal scrolling */
}

/* Home page specific content styling */
body.home-page .page-content {
  justify-content: center;         /* Center content vertically - only on home page */
  align-items: center;             /* Center content horizontally - only on home page */
  height: 100%;                    /* Full height */
}

/* Header bar styling */
header {
  background: var(--white);        /* White background */
  box-shadow: 0 2px 12px var(--shadow-light); /* Subtle shadow for depth */
  padding: 20px 64px;              /* Spacing inside header (top/bottom, left/right) */
  display: flex;                   /* Use flexbox for layout */
  align-items: center;             /* Center items vertically */
  z-index: 10;                     /* Position above other elements */
  position: relative;              /* For positioning */
  width: 100%;                     /* Full width */
}

/* App logo styling */
.logo {
  font-size: 1.6rem;               /* Logo text size */
  font-weight: 600;                /* Semi-bold font weight */
  color: var(--primary-color);     /* Blue text color */
  text-decoration: none;           /* Remove underline from link */
  display: flex;                   /* Use flexbox for layout */
  align-items: center;             /* Center items vertically */
  transition: color 0.3s ease;     /* Smooth color transition on hover */
}

/* Logo hover effect */
.logo:hover {
  color: var(--secondary-color);   /* Change to pink on hover */
}

/* Logo active (pressed) effect */
.logo:active {
  color: var(--secondary-dark);    /* Change to darker pink when clicked */
}

/* Logo icon styling */
.logo i {
  margin-right: 10px;              /* Space between icon and text */
  color: var(--primary-color);     /* Blue icon color */
  transition: color 0.3s ease;     /* Smooth color transition on hover */
}

/* Logo icon hover effect */
.logo:hover i {
  color: var(--secondary-color);   /* Change icon to pink on hover */
}

/* Logo icon active effect */
.logo:active i {
  color: var(--secondary-dark);    /* Change icon to darker pink when clicked */
}

/* Background blur decorative elements */
.blur-before,
.blur-after {
  position: absolute;              /* Position relative to viewport */
  width: 400px;                    /* Size of blur circles */
  height: 400px;
  border-radius: 50%;              /* Make them circular */
  filter: blur(var(--blur-size));  /* Apply blur effect */
  opacity: 0.7;                    /* Make them semi-transparent */
  z-index: 0;                      /* Position behind content */
  pointer-events: none;            /* Don't block mouse events */
  top: 50%;                        /* Center vertically */
  left: 50%;                       /* Center horizontally */
  transform: translate(-50%, -50%); /* Precise centering */
  transform-origin: center;        /* For rotation animations */
}

/* Blue blur circle */
.blur-before {
  background: #a4c8ff;             /* Light blue color */
  animation: orbitFullBefore 30s linear infinite; /* Apply rotation animation */
}

/* Pink blur circle */
.blur-after {
  background: #f49bd2;             /* Light pink color */
  animation: orbitFullAfter 30s linear infinite; /* Apply rotation animation */
}

/* Animation for blue blur circle */
@keyframes orbitFullBefore {
  0% {
    transform: translate(-50%, -50%) rotate(0deg) translateX(-300px) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg) translateX(-300px) rotate(-360deg);
  }
}

/* Animation for pink blur circle */
@keyframes orbitFullAfter {
  0% {
    transform: translate(-50%, -50%) rotate(180deg) translateX(-300px) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(540deg) translateX(-300px) rotate(-360deg);
  }
}

/* Animation for elements fading in from below */
@keyframes fadeInUp {
  0% { opacity: 0; transform: translateY(20px); }  /* Start invisible and below */
  100% { opacity: 1; transform: translateY(0); }   /* End visible and in place */
}

/* Mobile responsiveness - adjusts layout for small screens */
@media (max-width: 600px) {
  body.home-page {
    position: fixed;               /* Prevent scrolling on mobile */
    height: 100%;                  /* Full viewport height */
    width: 100%;                   /* Full viewport width */
    overflow: hidden;              /* Disable scrolling */
  }
  
  header {
    padding: 15px 20px;            /* Reduce padding on small screens */
    justify-content: center;       /* Center the logo */
    height: auto;                  /* Automatic height based on content */
  }

  .logo {
    font-size: 1.3rem;             /* Smaller logo text on mobile */
  }
  
  /* Adjust blur positions for smaller screens */
  .blur-before,
  .blur-after {
    width: 300px;                  /* Smaller blur size on mobile */
    height: 300px;
  }
} 

/* Auth pages layout */
.auth-container {
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 20px;
  width: 100%;
}

.auth-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  min-height: 70vh;
  align-items: center;
}

.auth-hero-icon {
  width: 64px;
  height: 64px;
  background: #eef2ff;
  color: var(--primary-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px var(--shadow-light);
}

.auth-hero h1 {
  font-size: 40px;
  line-height: 1.1;
  margin: 0 0 8px;
  color: #0f172a;
}

.auth-hero p {
  color: #475569;
  font-size: 18px;
  margin: 0 0 24px;
}

.auth-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  color: #334155;
}

.auth-card {
  background: #fff;
  border: 1px solid #eef0f3;
  border-radius: 24px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  padding: 28px;
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid #f1f5f9;
  margin: -28px -28px 16px;
}

.auth-tab {
  flex: 1;
  text-align: center;
  font-weight: 600;
  padding: 12px 0;
  text-decoration: none;
  color: #475569;
}

.auth-tab.active {
  background: linear-gradient(90deg, #3d48e0, #6a74ff);
  color: #fff;
}

.auth-sep {
  display: flex;
  align-items: center;
  color: #94a3b8;
  margin: 16px 0;
}
.auth-sep > div { flex: 1; height: 1px; background: #e2e8f0; }
.auth-sep > span { padding: 0 12px; font-size: 12px; }

.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  outline: none;
  color: #111827;
}
.form-control:focus { border-color: #c7d2fe; box-shadow: 0 0 0 3px rgba(61,72,224,0.15); }

.btn-primary {
  width: 100%;
  background: var(--primary-color);
  color: #fff;
  font-weight: 600;
  border: none;
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
}

.btn-muted {
  text-decoration: none;
  background: #f3f4f6;
  color: #111827;
  font-weight: 600;
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
}

.btn-danger {
  text-decoration: none;
  background: #fee2e2;
  color: #b91c1c;
  font-weight: 600;
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
}

.text-muted { color: #6b7280; }
.text-link { text-decoration: none; color: var(--secondary-color); font-weight: 600; }

@media (max-width: 900px) {
  .auth-grid { grid-template-columns: 1fr; gap: 20px; min-height: auto; }
}