/* Custom styles for MARTENS Technical Training & Service */

:root {
  --primary: #004F82;
  --primary-foreground: #ffffff;
  --text-dark: #0a0a0a;
  --text-light: #6b7280;
  --border-light: #e5e7eb;
  --bg-light: #f9fafb;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
}

/* ===== Skip to main content link ===== */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  background: var(--primary);
  color: #ffffff;
  padding: 0.5rem 1rem;
  border-radius: 0 0 0.375rem 0.375rem;
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 0;
  outline: 3px solid #ffffff;
  outline-offset: 2px;
}

/* ===== Global font size adjustments ===== */
body {
  font-size: 16px;
  line-height: 1.6;
}

p, li, span {
  font-size: 1.0625rem; /* 17px */
}

/* Responsive heading sizes */
h1 {
  font-size: clamp(1.875rem, 5vw, 2.75rem);
  line-height: 1.2;
}
h2 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  line-height: 1.25;
}
h3 {
  font-size: clamp(1.25rem, 3vw, 1.875rem);
  line-height: 1.3;
}
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1.125rem; }

/* ===== Responsive images ===== */
img {
  max-width: 100%;
  height: auto;
}

/* ===== Focus styles ===== */
/* Consistent focus ring for all interactive elements */
:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

/* Remove default outline only when focus-visible is supported */
:focus:not(:focus-visible) {
  outline: none;
}

/* Utility classes for focus rings */
.focus-ring:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 2px;
}

/* For dark backgrounds (header/footer links) */
.focus-ring-light:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: 2px;
}

/* ===== Hero background overlay ===== */
.hero-bg {
  background-image: linear-gradient(rgba(0, 79, 130, 0.8), rgba(0, 79, 130, 0.8));
  background-size: cover;
  background-position: center;
}

/* ===== Admin sidebar gradient ===== */
.admin-sidebar {
  background: linear-gradient(135deg, var(--primary), rgba(0, 79, 130, 0.9));
}

/* ===== Form validation styles ===== */
.form-error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-success {
  border-color: var(--success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Error messages for screen readers */
.field-error {
  display: block;
}

/* ===== Loading states ===== */
.loading {
  opacity: 0.7;
  pointer-events: none;
}

.spinner {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ===== Mobile menu animation ===== */
.mobile-menu-enter {
  opacity: 0;
  transform: translateY(-10px);
}

.mobile-menu-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ===== Card hover effects ===== */
.card-hover {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* ===== Modal backdrop ===== */
.modal-backdrop {
  backdrop-filter: blur(4px);
  background-color: rgba(0, 0, 0, 0.5);
}

/* ===== Responsive overflow for tables ===== */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ===== Print styles ===== */
@media print {
  .no-print {
    display: none !important;
  }
  
  .print-only {
    display: block !important;
  }
}

/* ===== High contrast mode ===== */
@media (prefers-contrast: high) {
  :root {
    --primary: #003366;
    --text-dark: #000000;
    --border-light: #333333;
  }
  
  a {
    text-decoration: underline;
  }
}

/* ===== Reduced motion ===== */
@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;
  }
}

/* ===== Custom scrollbar ===== */
.custom-scrollbar::-webkit-scrollbar {
  width: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: var(--bg-light);
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 79, 130, 0.8);
}

/* ===== Screen reader only utility ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
