/* ============================================
   GLOBAL STYLES
   Used on ALL pages - foundation for entire site
   ============================================ */

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
  /* Colors - Preheim Pools Brand (UPDATED) */
  --primary-blue: #2B7FBF;          /* Deeper, more professional blue */
  --secondary-blue: #1E5A8E;        /* Darker blue for contrast */
  --accent-blue: #4A9FD8;           /* Lighter blue for accents */
  --accent-aqua: #5BC0DE;           /* Fresh water color */
  
  --bg-main: #F8FAFB;               /* Very light blue-gray (modern, clean) */
  --bg-white: #FFFFFF;              /* Pure white */
  --card-bg: #FFFFFF;               /* Cards are pure white */
  
  --text-dark: #1A1A1A;             /* Darker text (better contrast) */
  --text-medium: #525252;           /* Medium gray */
  --text-light: #999999;            /* Light gray */
  --text-on-blue: #FFFFFF;          /* White text on blue */
  
  --success-green: #28A745;         /* Standard success green */
  --error-red: #DC3545;             /* Standard error red */
  --warning-yellow: #FFC107;        /* Standard warning yellow */
  
  --border-light: #E1E8ED;          /* Subtle blue-gray border */
  --shadow-color: rgba(43, 127, 191, 0.08); /* Blue-tinted shadow */
  
  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-page-title: 28px;
  --font-section-header: 22px;
  --font-body: 16px;
  --font-button: 16px;
  --font-small: 14px;
  --font-tiny: 12px;
  
  /* Spacing */
  --page-padding: 20px;
  --section-spacing: 40px;
  --card-padding: 16px;
  --button-padding: 12px 24px;
  --input-padding: 12px 16px;
  
  /* Border Radius */
  --radius-small: 8px;
  --radius-medium: 12px;
  --radius-large: 16px;
  --radius-circle: 50%;
  
  /* Shadows (blue-tinted for modern look) */
  --shadow-sm: 0 2px 8px rgba(43, 127, 191, 0.08);
  --shadow-md: 0 4px 16px rgba(43, 127, 191, 0.12);
  --shadow-lg: 0 8px 24px rgba(43, 127, 191, 0.15);
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
  
  /* Z-index */
  --z-dropdown: 1000;
  --z-overlay: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-tooltip: 1070;
  --z-notification: 1080;
}
/* ============================================
   RESET & BASE STYLES
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-body);
  line-height: 1.6;
  color: var(--text-dark);
  background-color: var(--bg-main); 
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: var(--text-dark);
}

h1 {
  font-size: var(--font-page-title);
}

h2 {
  font-size: var(--font-section-header);
}

h3 {
  font-size: 20px;
}

h4 {
  font-size: 18px;
}

h5 {
  font-size: var(--font-body);
}

h6 {
  font-size: var(--font-small);
}

@media (min-width: 768px) {
  h1 {
    font-size: 36px;
  }
}

@media (min-width: 768px) {
  h2 {
    font-size: 28px;
  }
}

p {
  margin-bottom: 1rem;
  color: var(--text-medium);
}

a {
  color: var(--primary-blue);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--secondary-blue);
}

a:focus {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

strong, b {
  font-weight: 700;
}

em, i {
  font-style: italic;
}

ul, ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.5rem;
  color: var(--text-medium);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-block;
  padding: var(--button-padding);
  font-size: var(--font-button);
  font-weight: 600;
  text-align: center;
  border: none;
  border-radius: var(--radius-small);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  font-family: var(--font-family);
  min-height: 44px;
}

.btn:focus {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

@media (min-width: 768px) {
  .btn {
    padding: 14px 32px;
  }
}

.btn-primary {
  background-color: var(--primary-blue);
  color: var(--text-on-blue);
}

.btn-primary:hover {
  background-color: var(--secondary-blue);
  color: var(--text-on-blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background-color: transparent;
  color: var(--primary-blue);
  border: 2px solid var(--primary-blue);
}

.btn-secondary:hover {
  background-color: var(--primary-blue);
  color: var(--text-on-blue);
}

.btn-danger {
  background-color: var(--error-red);
  color: var(--text-on-blue);
}

.btn-danger:hover {
  background-color: #E55555;
  color: var(--text-on-blue);
}

.btn-large {
  padding: 16px 40px;
  font-size: 18px;
  min-height: 52px;
}

.btn-small {
  padding: 8px 16px;
  font-size: var(--font-small);
  min-height: 36px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   INPUTS & FORMS
   ============================================ */
.form-group {
  margin-bottom: 20px;
}

@media (min-width: 768px) {
  .form-group {
    margin-bottom: 24px;
  }
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-dark);
  font-size: var(--font-small);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="number"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: var(--input-padding);
  font-size: var(--font-body);
  font-family: var(--font-family);
  color: var(--text-dark);
  background-color: #FFFFFF;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-small);
  transition: border-color var(--transition-fast);
  min-height: 44px;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(91, 159, 216, 0.1);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%23333' d='M0 0l6 8 6-8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-light);
}

.input-error {
  border-color: var(--error-red);
}

.input-error:focus {
  border-color: var(--error-red);
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

.error-message {
  display: block;
  margin-top: 6px;
  font-size: var(--font-small);
  color: var(--error-red);
}

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-medium);
  padding: var(--card-padding);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal);
}

@media (min-width: 768px) {
  .card {
    padding: 24px;
  }
}

.card:hover {
  box-shadow: var(--shadow-md);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--page-padding);
}

@media (min-width: 768px) {
  .container {
    padding: 0 40px;
  }
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-left {
  text-align: left;
}

.mt-small {
  margin-top: 20px;
}

.mt-medium {
  margin-top: 40px;
}

.mt-large {
  margin-top: 60px;
}

.mb-small {
  margin-bottom: 20px;
}

.mb-medium {
  margin-bottom: 40px;
}

.mb-large {
  margin-bottom: 60px;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   LOADING SPINNER
   ============================================ */
.loading-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-light);
  border-top-color: var(--primary-blue);
  border-radius: var(--radius-circle);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-overlay);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 16px 20px;
  background-color: var(--text-dark);
  color: var(--text-on-blue);
  border-radius: var(--radius-small);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-notification);
  max-width: 90%;
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@media (min-width: 768px) {
  .toast {
    max-width: 400px;
  }
}

.toast-success {
  background-color: var(--success-green);
}

.toast-error {
  background-color: var(--error-red);
}

.toast-warning {
  background-color: var(--warning-yellow);
  color: var(--text-dark);
}

/* ============================================
   MODALS
   ============================================ */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: var(--z-modal-backdrop);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.active {
  display: flex;
}

.modal {
  background-color: #FFFFFF;
  border-radius: var(--radius-medium);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: var(--text-medium);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
}

.modal-close-btn:hover {
  color: var(--text-dark);
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ============================================
   ANIMATIONS
   ============================================ */
.fade-in {
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.slide-up {
  animation: slideUp 0.5s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: var(--bg-cream);
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary-blue);
  color: var(--text-on-blue);
  padding: 8px 16px;
  text-decoration: none;
  z-index: 100;
}

.skip-to-content:focus {
  top: 0;
}

/* Ensure sufficient color contrast */
::selection {
  background-color: var(--primary-blue);
  color: var(--text-on-blue);
}

/* Focus visible for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@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;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  body {
    background-color: white;
    color: black;
  }
  
  .no-print {
    display: none !important;
  }
}