/**
 * CountryTaxCalc.com - Global Design Enhancements
 *
 * Purpose: Bring homepage-quality modern design to all 231 pages
 * Strategy: Additive CSS only - uses .ctc-modern-* prefix to avoid conflicts
 * Safety: Can be disabled by removing link tag from BaseLayout.astro
 *
 * Last Updated: March 29, 2026
 */

/* ============================================================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   ============================================================================ */

:root {
  /* Gradients - matching homepage aesthetic */
  --ctc-primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --ctc-secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --ctc-accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --ctc-success-gradient: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);

  /* Colors */
  --ctc-success-color: #10b981;
  --ctc-warning-color: #f59e0b;
  --ctc-error-color: #ef4444;
  --ctc-text-primary: #1f2937;
  --ctc-text-secondary: #6b7280;
  --ctc-text-muted: #9ca3af;
  --ctc-bg-primary: #fafbfc;
  --ctc-bg-secondary: #ffffff;
  --ctc-border-color: #e5e7eb;

  /* Shadows - layered depth system */
  --ctc-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --ctc-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --ctc-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --ctc-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* Border Radius */
  --ctc-radius-sm: 8px;
  --ctc-radius-md: 12px;
  --ctc-radius-lg: 16px;
  --ctc-radius-xl: 20px;

  /* Transitions */
  --ctc-transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --ctc-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --ctc-transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================================
   GLOBAL TYPOGRAPHY - Modern Font System
   ============================================================================ */

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ctc-text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-weight: 700;
  color: var(--ctc-text-primary);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

/* ============================================================================
   ENHANCE EXISTING PAGE HEADERS (Calculator, Comparison, Report Pages)
   ============================================================================ */

/* Calculator headers - enhance existing .calc-header class */
.calc-header {
  box-shadow: var(--ctc-shadow-xl) !important;
  border-radius: var(--ctc-radius-lg) !important;
  position: relative !important;
  overflow: hidden !important;
  padding: 3rem 2rem !important;
}

/* Subtle texture overlay for calculator headers */
.calc-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="50" height="50" patternUnits="userSpaceOnUse"><circle cx="12.5" cy="12.5" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="37.5" cy="37.5" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
  opacity: 0.3;
  pointer-events: none;
}

.calc-header h1 {
  position: relative;
  z-index: 2;
  font-size: clamp(2rem, 4vw, 2.5rem) !important;
  font-weight: 800 !important;
  letter-spacing: -0.02em !important;
}

.calc-header p {
  position: relative;
  z-index: 2;
  font-size: clamp(1rem, 2vw, 1.1rem) !important;
}

/* Comparison page headers - enhance existing .page-header */
.page-header {
  box-shadow: var(--ctc-shadow-xl) !important;
  position: relative !important;
  overflow: hidden !important;
}

.page-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="50" height="50" patternUnits="userSpaceOnUse"><circle cx="12.5" cy="12.5" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="37.5" cy="37.5" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
  opacity: 0.3;
  pointer-events: none;
}

.page-header h1 {
  position: relative;
  z-index: 2;
  font-weight: 800 !important;
  letter-spacing: -0.02em !important;
}

.page-header .subtitle,
.page-header p {
  position: relative;
  z-index: 2;
}

/* Optional: Modern header utility class for new pages */
.ctc-modern-header {
  background: var(--ctc-primary-gradient);
  color: white;
  padding: 3rem 2rem;
  border-radius: var(--ctc-radius-lg);
  margin-bottom: 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--ctc-shadow-xl);
}

.ctc-modern-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="50" height="50" patternUnits="userSpaceOnUse"><circle cx="12.5" cy="12.5" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="37.5" cy="37.5" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
  opacity: 0.3;
  pointer-events: none;
}

.ctc-modern-header h1 {
  position: relative;
  z-index: 2;
  font-size: clamp(2rem, 4vw, 2.5rem);
  font-weight: 800;
  margin-bottom: 1rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.ctc-modern-header .subtitle {
  position: relative;
  z-index: 2;
  font-size: clamp(1rem, 2vw, 1.2rem);
  opacity: 0.95;
  font-weight: 300;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

/* ============================================================================
   ENHANCE EXISTING CARDS & SECTIONS
   ============================================================================ */

/* Enhance calculator content sections */
.content-section {
  box-shadow: var(--ctc-shadow-lg) !important;
  border-radius: var(--ctc-radius-md) !important;
  transition: var(--ctc-transition) !important;
  border: 1px solid rgba(0, 0, 0, 0.05) !important;
}

.content-section:hover {
  box-shadow: var(--ctc-shadow-xl) !important;
  transform: translateY(-2px) !important;
}

/* Enhance comparison sections */
.section {
  box-shadow: var(--ctc-shadow-lg) !important;
  border-radius: var(--ctc-radius-md) !important;
  transition: var(--ctc-transition) !important;
  border: 1px solid rgba(0, 0, 0, 0.05) !important;
}

.section:hover {
  box-shadow: var(--ctc-shadow-xl) !important;
  transform: translateY(-2px) !important;
}

/* Enhance key facts boxes */
.key-facts-box {
  box-shadow: var(--ctc-shadow-md) !important;
  border-radius: var(--ctc-radius-md) !important;
  transition: var(--ctc-transition) !important;
}

.key-facts-box:hover {
  transform: translateY(-1px) !important;
  box-shadow: var(--ctc-shadow-lg) !important;
}

/* Modern card utility class */
.ctc-modern-card {
  background: var(--ctc-bg-secondary);
  border-radius: var(--ctc-radius-lg);
  box-shadow: var(--ctc-shadow-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: var(--ctc-transition);
}

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

.ctc-modern-card h2,
.ctc-modern-card h3 {
  color: var(--ctc-text-primary);
  font-weight: 700;
  margin-bottom: 1rem;
}

/* Section wrapper utility class */
.ctc-modern-section {
  background: var(--ctc-bg-secondary);
  padding: 2.5rem;
  border-radius: var(--ctc-radius-lg);
  margin-bottom: 2rem;
  box-shadow: var(--ctc-shadow-md);
  border: 1px solid var(--ctc-border-color);
}

/* ============================================================================
   MODERN BUTTONS
   ============================================================================ */

.ctc-modern-btn {
  padding: 1rem 2rem;
  border: none;
  border-radius: var(--ctc-radius-md);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--ctc-transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: center;
  min-height: 52px;
  position: relative;
  overflow: hidden;
}

/* Shimmer effect on hover */
.ctc-modern-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.ctc-modern-btn:hover::before {
  left: 100%;
}

.ctc-modern-btn-primary {
  background: var(--ctc-primary-gradient);
  color: white;
  box-shadow: var(--ctc-shadow-md);
}

.ctc-modern-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--ctc-shadow-lg);
}

.ctc-modern-btn-secondary {
  background: var(--ctc-bg-secondary);
  color: var(--ctc-text-primary);
  border: 2px solid var(--ctc-border-color);
}

.ctc-modern-btn-secondary:hover {
  border-color: #667eea;
  background: #f8fafc;
  transform: translateY(-1px);
}

.ctc-modern-btn-success {
  background: var(--ctc-success-color);
  color: white;
  box-shadow: var(--ctc-shadow-md);
}

.ctc-modern-btn-success:hover {
  background: #059669;
  transform: translateY(-2px);
  box-shadow: var(--ctc-shadow-lg);
}

/* ============================================================================
   ENHANCED TYPOGRAPHY
   ============================================================================ */

.ctc-modern-text-primary {
  color: var(--ctc-text-primary);
  font-weight: 600;
}

.ctc-modern-text-secondary {
  color: var(--ctc-text-secondary);
}

.ctc-modern-text-muted {
  color: var(--ctc-text-muted);
  font-size: 0.9rem;
}

.ctc-modern-heading {
  font-weight: 700;
  color: var(--ctc-text-primary);
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.ctc-modern-subheading {
  font-weight: 600;
  color: var(--ctc-text-secondary);
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}

/* ============================================================================
   INFO BOXES & HIGHLIGHTS
   ============================================================================ */

.ctc-modern-info-box {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 2px solid #bae6fd;
  border-radius: var(--ctc-radius-md);
  padding: 1.5rem;
  margin: 1.5rem 0;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.ctc-modern-info-box::before {
  content: 'ℹ️';
  font-size: 1.5rem;
  flex-shrink: 0;
}

.ctc-modern-success-box {
  background: var(--ctc-success-gradient);
  border: 2px solid var(--ctc-success-color);
  border-radius: var(--ctc-radius-md);
  padding: 1.5rem;
  margin: 1.5rem 0;
  text-align: center;
}

.ctc-modern-success-box h3 {
  color: #065f46;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.ctc-modern-warning-box {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 2px solid var(--ctc-warning-color);
  border-radius: var(--ctc-radius-md);
  padding: 1.5rem;
  margin: 1.5rem 0;
}

/* ============================================================================
   GLASSMORPHISM EFFECTS
   ============================================================================ */

.ctc-modern-glass {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--ctc-shadow-lg);
}

/* ============================================================================
   GRID LAYOUTS
   ============================================================================ */

.ctc-modern-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin: 2rem 0;
}

.ctc-modern-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

@keyframes ctc-fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ctc-modern-fade-in-up {
  animation: ctc-fadeInUp 0.6s ease-out;
}

@keyframes ctc-slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.ctc-modern-slide-in {
  animation: ctc-slideIn 0.5s ease-out;
}

/* ============================================================================
   ENHANCE EXISTING TABLES
   ============================================================================ */

/* Enhance bracket tables on calculator pages */
.bracket-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  border-radius: var(--ctc-radius-md) !important;
  overflow: hidden !important;
  box-shadow: var(--ctc-shadow-md) !important;
}

.bracket-table thead {
  background: var(--ctc-primary-gradient) !important;
}

.bracket-table th {
  letter-spacing: 0.3px !important;
  font-size: 0.95rem !important;
}

.bracket-table tbody tr {
  transition: var(--ctc-transition-fast) !important;
}

.bracket-table tbody tr:hover {
  background: #f0f9ff !important;
}

/* Enhance examples tables */
.examples-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  border-radius: var(--ctc-radius-md) !important;
  overflow: hidden !important;
  box-shadow: var(--ctc-shadow-md) !important;
}

.examples-table thead {
  background: var(--ctc-primary-gradient) !important;
}

.examples-table tbody tr {
  transition: var(--ctc-transition-fast) !important;
}

.examples-table tbody tr:hover {
  background: #f0f9ff !important;
}

/* Enhance comparison tables */
.comparison-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  border-radius: var(--ctc-radius-md) !important;
  overflow: hidden !important;
  box-shadow: var(--ctc-shadow-md) !important;
}

.comparison-table thead {
  background: var(--ctc-primary-gradient) !important;
}

.comparison-table tbody tr {
  transition: var(--ctc-transition-fast) !important;
}

.comparison-table tbody tr:hover {
  background: #f0f9ff !important;
}

/* Modern table utility class */
.ctc-modern-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--ctc-radius-md);
  overflow: hidden;
  box-shadow: var(--ctc-shadow-md);
  margin: 2rem 0;
}

.ctc-modern-table thead {
  background: var(--ctc-primary-gradient);
  color: white;
}

.ctc-modern-table th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.3px;
}

.ctc-modern-table tbody tr {
  background: var(--ctc-bg-secondary);
  transition: var(--ctc-transition-fast);
}

.ctc-modern-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.ctc-modern-table tbody tr:hover {
  background: #f0f9ff;
  transform: scale(1.01);
}

.ctc-modern-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--ctc-border-color);
}

/* ============================================================================
   BADGES & LABELS
   ============================================================================ */

.ctc-modern-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.ctc-modern-badge-success {
  background: var(--ctc-success-gradient);
  color: #065f46;
  border: 2px solid var(--ctc-success-color);
}

.ctc-modern-badge-primary {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1e40af;
  border: 2px solid #3b82f6;
}

.ctc-modern-badge-warning {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border: 2px solid var(--ctc-warning-color);
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 768px) {
  .ctc-modern-header {
    padding: 2rem 1.5rem;
  }

  .ctc-modern-header h1 {
    font-size: 1.8rem;
  }

  .ctc-modern-card,
  .ctc-modern-section {
    padding: 1.5rem;
  }

  .ctc-modern-btn {
    padding: 0.875rem 1.5rem;
    font-size: 0.95rem;
  }

  .ctc-modern-grid-2,
  .ctc-modern-grid-3 {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  .ctc-modern-header {
    padding: 1.5rem 1rem;
    border-radius: var(--ctc-radius-md);
  }

  .ctc-modern-card,
  .ctc-modern-section {
    padding: 1.25rem;
    border-radius: var(--ctc-radius-md);
  }
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

.ctc-modern-text-center {
  text-align: center;
}

.ctc-modern-mb-1 { margin-bottom: 0.5rem; }
.ctc-modern-mb-2 { margin-bottom: 1rem; }
.ctc-modern-mb-3 { margin-bottom: 1.5rem; }
.ctc-modern-mb-4 { margin-bottom: 2rem; }

.ctc-modern-mt-1 { margin-top: 0.5rem; }
.ctc-modern-mt-2 { margin-top: 1rem; }
.ctc-modern-mt-3 { margin-top: 1.5rem; }
.ctc-modern-mt-4 { margin-top: 2rem; }

.ctc-modern-p-1 { padding: 0.5rem; }
.ctc-modern-p-2 { padding: 1rem; }
.ctc-modern-p-3 { padding: 1.5rem; }
.ctc-modern-p-4 { padding: 2rem; }

/* ============================================================================
   ENHANCE EXISTING LINKS & BUTTONS
   ============================================================================ */

/* Enhance related links on calculator and comparison pages */
.related-link {
  transition: var(--ctc-transition) !important;
  box-shadow: var(--ctc-shadow-sm) !important;
  border-radius: var(--ctc-radius-md) !important;
}

.related-link:hover {
  transform: translateY(-2px) !important;
  box-shadow: var(--ctc-shadow-md) !important;
  border-color: #667eea !important;
}

/* ============================================================================
   AFFILIATE SECTION ENHANCEMENTS (Non-intrusive)
   ============================================================================ */

/* Enhance existing affiliate sections without breaking tracking */
.affiliate-section {
  position: relative;
  box-shadow: var(--ctc-shadow-md) !important;
  border-radius: var(--ctc-radius-md) !important;
  transition: var(--ctc-transition) !important;
}

.affiliate-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--ctc-primary-gradient);
  border-radius: var(--ctc-radius-lg) var(--ctc-radius-lg) 0 0;
}

.affiliate-section:hover {
  box-shadow: var(--ctc-shadow-lg) !important;
}

/* Make affiliate buttons more prominent (without changing HTML) */
a[data-affiliate-id] {
  transition: var(--ctc-transition) !important;
  box-shadow: var(--ctc-shadow-sm) !important;
}

a[data-affiliate-id]:hover {
  transform: translateY(-2px) !important;
  box-shadow: var(--ctc-shadow-lg) !important;
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
  .ctc-modern-header {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
  }

  .ctc-modern-card,
  .ctc-modern-section {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }

  .ctc-modern-btn {
    display: none !important;
  }
}

/* ============================================================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================================================ */

/* Focus states for keyboard navigation */
.ctc-modern-btn:focus-visible,
a[data-affiliate-id]:focus-visible {
  outline: 3px solid #667eea;
  outline-offset: 2px;
}

/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .ctc-modern-card,
  .ctc-modern-section {
    border: 2px solid currentColor;
  }

  .ctc-modern-btn {
    border: 2px solid currentColor;
  }
}
