/* PrintMyWorksheets - Custom CSS Styles */
/* Built on top of Tailwind CSS for educational website */

/* Worksheet Gallery Specific Styles */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.worksheet-card {
  transition: all 0.3s ease;
}

.worksheet-card:hover {
  transform: translateY(-2px);
}

.worksheet-card img {
  transition: transform 0.3s ease;
}

.worksheet-card:hover img {
  transform: scale(1.05);
}

/* Loading animation */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #f3f3f3;
  border-radius: 50%;
  border-top-color: #2E86AB;
  animation: spin 1s ease-in-out infinite;
}

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

/* Modal styles */
#worksheet-modal {
  backdrop-filter: blur(4px);
}

/* Responsive grid improvements */
@media (min-width: 640px) {
  .worksheet-grid-responsive {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .worksheet-grid-responsive {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1280px) {
  .worksheet-grid-responsive {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Filter section improvements */
.filter-section {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

/* CSS Variables for Design System */
:root {
  --primary-blue: #2E86AB;
  --accent-orange: #F24236;
  --neutral-gray: #4A4A4A;
  --light-gray: #F8F9FA;
  --white: #FFFFFF;
  
  /* 8pt Grid System */
  --spacing-xs: 0.25rem;  /* 4px */
  --spacing-sm: 0.5rem;   /* 8px */
  --spacing-md: 1rem;     /* 16px */
  --spacing-lg: 1.5rem;   /* 24px */
  --spacing-xl: 2rem;     /* 32px */
  --spacing-2xl: 3rem;    /* 48px */
  --spacing-3xl: 4rem;    /* 64px */
  
  /* Typography Scale */
  --font-size-xs: 0.75rem;   /* 12px */
  --font-size-sm: 0.875rem;  /* 14px */
  --font-size-base: 1rem;    /* 16px */
  --font-size-lg: 1.125rem;  /* 18px */
  --font-size-xl: 1.25rem;   /* 20px */
  --font-size-2xl: 1.5rem;   /* 24px */
  --font-size-3xl: 1.875rem; /* 30px */
  --font-size-4xl: 2.25rem;  /* 36px */
  --font-size-5xl: 3rem;     /* 48px */
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  /* Border Radius */
  --border-radius-sm: 0.25rem;
  --border-radius-md: 0.375rem;
  --border-radius-lg: 0.5rem;
  --border-radius-xl: 0.75rem;
}

/* Base Styles and Reset */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Roboto Slab', 'Georgia', serif;
  line-height: 1.6;
  color: var(--neutral-gray);
  background-color: var(--white);
}

/* Typography Enhancements */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Inter', 'Roboto', sans-serif;
  font-weight: 600;
  line-height: 1.2;
  color: var(--primary-blue);
}

h1 { font-size: var(--font-size-5xl); }
h2 { font-size: var(--font-size-4xl); }
h3 { font-size: var(--font-size-3xl); }
h4 { font-size: var(--font-size-2xl); }
h5 { font-size: var(--font-size-xl); }
h6 { font-size: var(--font-size-lg); }

/* Link Styles */
a {
  text-decoration: none;
  transition: color 0.2s ease-in-out;
}

a:hover {
  text-decoration: none;
}

/* Button Enhancements */
button, .btn {
  font-family: 'Inter', 'Roboto', sans-serif;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  min-height: 44px; /* Touch-friendly size */
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

/* Focus Styles for Accessibility */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px rgba(46, 134, 171, 0.2);
}

/* Custom Component Styles */

/* Header Enhancements */
.header-shadow {
  box-shadow: var(--shadow-md);
  transition: box-shadow 0.2s ease-in-out;
}

/* Mobile Menu Enhancements */
.mobile-menu-backdrop {
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

/* Dropdown Animation */
.group:hover .group-hover\\:opacity-100 {
  animation: fadeInDown 0.2s ease-out;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Card Hover Effects */
.card-hover {
  transition: all 0.3s ease-in-out;
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

/* Hero Section Enhancements */
.hero-floating-animation {
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* Image Aspect Ratios */
.aspect-worksheet {
  aspect-ratio: 3/4; /* Standard worksheet ratio */
}

.aspect-hero {
  aspect-ratio: 16/9; /* Hero image ratio */
}

.aspect-square {
  aspect-ratio: 1/1; /* Square images */
}

/* Loading States */
.loading-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Newsletter Section */
.newsletter-bg {
  background: linear-gradient(135deg, var(--primary-blue) 0%, #1e6591 100%);
}

/* Footer Enhancements */
footer {
  background: linear-gradient(135deg, var(--neutral-gray) 0%, #3a3a3a 100%);
}

/* Testimonial Cards */
.testimonial-card {
  position: relative;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.testimonial-card::before {
  content: '"';
  position: absolute;
  top: -10px;
  left: 20px;
  font-size: 4rem;
  color: var(--accent-orange);
  font-family: serif;
  opacity: 0.3;
}

/* Image Optimization */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

.img-cover {
  object-fit: cover;
  object-position: center;
}

.img-contain {
  object-fit: contain;
  object-position: center;
}

/* Responsive Images */
@media (max-width: 640px) {
  .responsive-img-sm {
    width: 100%;
    height: auto;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .responsive-img-md {
    width: 100%;
    height: auto;
  }
}

/* Print Styles */
@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.4;
  }
  
  h1, h2, h3, h4, h5, h6 {
    break-after: avoid;
  }
  
  img {
    max-width: 100% !important;
    height: auto !important;
  }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  :root {
    --primary-blue: #1a5f7a;
    --accent-orange: #d63031;
    --neutral-gray: #2d3436;
  }
  
  button, .btn {
    border: 2px solid currentColor;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Dark Mode Support (if needed) */
@media (prefers-color-scheme: dark) {
  /* Dark mode styles would go here if implemented */
  /* Currently not implemented to maintain brand consistency */
}

/* Grid System Utilities */
.grid-auto-fit {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-auto-fill {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

/* Spacing Utilities (8pt grid) */
.space-8pt > * + * {
  margin-top: var(--spacing-sm);
}

.space-16pt > * + * {
  margin-top: var(--spacing-md);
}

.space-24pt > * + * {
  margin-top: var(--spacing-lg);
}

/* Text Selection */
::selection {
  background-color: rgba(46, 134, 171, 0.2);
  color: var(--primary-blue);
}

::-moz-selection {
  background-color: rgba(46, 134, 171, 0.2);
  color: var(--primary-blue);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--light-gray);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-blue);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #1e6591;
}

/* Performance Optimizations */
.gpu-accelerated {
  transform: translateZ(0);
  will-change: transform;
}

/* Utility Classes */
.text-balance {
  text-wrap: balance;
}

.text-pretty {
  text-wrap: pretty;
}

/* Container Queries Support */
@container (min-width: 768px) {
  .container-responsive {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: var(--spacing-xl);
  }
}

/* Modern CSS Features */
.backdrop-blur {
  backdrop-filter: blur(10px);
}

.gradient-text {
  background: linear-gradient(135deg, var(--primary-blue), var(--accent-orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Error States */
.error-state {
  border-color: var(--accent-orange) !important;
  box-shadow: 0 0 0 2px rgba(242, 66, 54, 0.2) !important;
}

.success-state {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2) !important;
}

/* Interactive States */
.interactive:hover {
  transform: scale(1.02);
  transition: transform 0.2s ease-in-out;
}

.interactive:active {
  transform: scale(0.98);
}