/**
 * ISO 14046 Water Footprint - Responsive Styles (HydroBlue ISO Theme)
 * Responsive design utilities and breakpoints
 */

/* ============================================
   RESPONSIVE BREAKPOINTS - HydroBlue ISO
   ============================================ */

:root {
  /* Breakpoint variables */
  --breakpoint-xs: 480px;
  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
  --breakpoint-2xl: 1536px;
  
  /* Container widths - match main layout */
  --container-xs: 100%;
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
  --container-2xl: 1300px; /* Matches main container max-width */
  
  /* HydroBlue ISO Colors for responsive overrides */
  --primary-blue: #0b61ff;
  --primary-blue-dark: #084fd8;
  --dark-navy: #072035;
  --dark-text: #07122a;
  --light-blue-bg: #f4f7fb;
  --light-blue-border: #e6eef9;
  --light-blue-subtle: #eef2ff;
  --white: #ffffff;
  --off-white: #fbfdff;
  --slate-gray: #475569;
  --light-gray: #64748b;
  --border-gray: #f1f5f9;
  --success-green: #065f46;
  --success-bg: #ecffef;
  --warning-orange: #f97316;
  --warning-bg: #fffbeb;
  --error-red: #ef4444;
  --error-bg: #fef2f2;
}

/* ============================================
   CONTAINER UTILITIES
   ============================================ */

.container {
  width: 100%;
  margin: 0 auto;
  padding: 0 12px; /* 12px matches HydroBlue spacing */
}

@media (min-width: 640px) {
  .container {
    max-width: var(--container-sm);
    padding: 0 16px; /* 16px matches HydroBlue spacing */
  }
}

@media (min-width: 768px) {
  .container {
    max-width: var(--container-md);
  }
}

@media (min-width: 1024px) {
  .container {
    max-width: var(--container-lg);
  }
}

@media (min-width: 1280px) {
  .container {
    max-width: var(--container-xl);
  }
}

@media (min-width: 1536px) {
  .container {
    max-width: var(--container-2xl);
  }
}

.container-fluid {
  width: 100%;
  padding: 0 12px; /* 12px matches HydroBlue spacing */
}

.container-narrow {
  max-width: 800px;
  margin: 0 auto;
}

/* ============================================
   GRID SYSTEM - HydroBlue ISO Spacing
   ============================================ */

.grid {
  display: grid;
  gap: 16px; /* 16px matches HydroBlue spacing */
}

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-5 { grid-template-columns: repeat(5, 1fr); }
.grid-cols-6 { grid-template-columns: repeat(6, 1fr); }
.grid-cols-12 { grid-template-columns: repeat(12, 1fr); }

.gap-0 { gap: 0; }
.gap-1 { gap: 4px; }      /* HydroBlue: --spacing-xs */
.gap-2 { gap: 8px; }      /* HydroBlue: --spacing-sm */
.gap-3 { gap: 12px; }     /* HydroBlue: --spacing-md */
.gap-4 { gap: 16px; }     /* HydroBlue: --spacing-lg */
.gap-5 { gap: 20px; }     /* HydroBlue: --spacing-xl */
.gap-6 { gap: 24px; }     /* HydroBlue: --spacing-2xl */
.gap-8 { gap: 32px; }     /* Additional spacing */
.gap-10 { gap: 40px; }    /* Additional spacing */
.gap-12 { gap: 48px; }    /* Additional spacing */

/* ============================================
   FLEXBOX UTILITIES
   ============================================ */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }

.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.items-stretch { align-items: stretch; }

.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.justify-evenly { justify-content: space-evenly; }

.flex-1 { flex: 1 1 0%; }
.flex-auto { flex: 1 1 auto; }
.flex-initial { flex: 0 1 auto; }
.flex-none { flex: none; }

/* ============================================
   SPACING UTILITIES - HydroBlue ISO Scale
   ============================================ */

.m-0 { margin: 0; }
.m-1 { margin: 4px; }
.m-2 { margin: 8px; }
.m-3 { margin: 12px; }
.m-4 { margin: 16px; }
.m-5 { margin: 20px; }
.m-6 { margin: 24px; }
.m-8 { margin: 32px; }
.m-10 { margin: 40px; }
.m-12 { margin: 48px; }
.m-auto { margin: auto; }

.mx-0 { margin-left: 0; margin-right: 0; }
.mx-1 { margin-left: 4px; margin-right: 4px; }
.mx-2 { margin-left: 8px; margin-right: 8px; }
.mx-3 { margin-left: 12px; margin-right: 12px; }
.mx-4 { margin-left: 16px; margin-right: 16px; }
.mx-5 { margin-left: 20px; margin-right: 20px; }
.mx-6 { margin-left: 24px; margin-right: 24px; }
.mx-8 { margin-left: 32px; margin-right: 32px; }
.mx-auto { margin-left: auto; margin-right: auto; }

.my-0 { margin-top: 0; margin-bottom: 0; }
.my-1 { margin-top: 4px; margin-bottom: 4px; }
.my-2 { margin-top: 8px; margin-bottom: 8px; }
.my-3 { margin-top: 12px; margin-bottom: 12px; }
.my-4 { margin-top: 16px; margin-bottom: 16px; }
.my-5 { margin-top: 20px; margin-bottom: 20px; }
.my-6 { margin-top: 24px; margin-bottom: 24px; }
.my-8 { margin-top: 32px; margin-bottom: 32px; }
.my-auto { margin-top: auto; margin-bottom: auto; }

.p-0 { padding: 0; }
.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-5 { padding: 20px; }
.p-6 { padding: 24px; }
.p-8 { padding: 32px; }
.p-10 { padding: 40px; }
.p-12 { padding: 48px; }

.px-0 { padding-left: 0; padding-right: 0; }
.px-1 { padding-left: 4px; padding-right: 4px; }
.px-2 { padding-left: 8px; padding-right: 8px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.px-5 { padding-left: 20px; padding-right: 20px; }
.px-6 { padding-left: 24px; padding-right: 24px; }
.px-8 { padding-left: 32px; padding-right: 32px; }

.py-0 { padding-top: 0; padding-bottom: 0; }
.py-1 { padding-top: 4px; padding-bottom: 4px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }
.py-5 { padding-top: 20px; padding-bottom: 20px; }
.py-6 { padding-top: 24px; padding-bottom: 24px; }
.py-8 { padding-top: 32px; padding-bottom: 32px; }

/* ============================================
   TEXT UTILITIES - HydroBlue ISO Typography
   ============================================ */

.text-xs { font-size: 11px; line-height: 1.4; }      /* HydroBlue: --font-size-xs */
.text-sm { font-size: 12px; line-height: 1.5; }      /* HydroBlue: --font-size-sm */
.text-base { font-size: 13px; line-height: 1.5; }    /* HydroBlue: --font-size-base */
.text-md { font-size: 14px; line-height: 1.5; }      /* HydroBlue: --font-size-md */
.text-lg { font-size: 16px; line-height: 1.5; }      /* HydroBlue: --font-size-lg */
.text-xl { font-size: 18px; line-height: 1.4; }      /* HydroBlue: --font-size-xl */
.text-2xl { font-size: 20px; line-height: 1.4; }     /* HydroBlue: --font-size-2xl */
.text-3xl { font-size: 24px; line-height: 1.3; }     /* Additional for larger headings */
.text-4xl { font-size: 30px; line-height: 1.3; }     /* Additional for largest headings */

.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }  /* HydroBlue default for medium */
.font-bold { font-weight: 700; }      /* HydroBlue default for headings */

.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-justify { text-align: justify; }

.text-primary { color: var(--dark-navy); }
.text-secondary { color: var(--slate-gray); }
.text-tertiary { color: var(--light-gray); }
.text-blue { color: var(--primary-blue); }

.leading-none { line-height: 1; }
.leading-tight { line-height: 1.25; }
.leading-normal { line-height: 1.5; }  /* HydroBlue default */
.leading-relaxed { line-height: 1.625; }
.leading-loose { line-height: 2; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.break-words { word-wrap: break-word; }
.break-all { word-break: break-all; }

/* ============================================
   VISIBILITY UTILITIES
   ============================================ */

/* Hide on all screens */
.hidden { display: none; }

/* Hide on extra small screens */
@media (max-width: 480px) {
  .xs-hidden { display: none; }
  .xs-block { display: block; }
  .xs-flex { display: flex; }
  .xs-grid { display: grid; }
}

/* Hide on small screens */
@media (max-width: 640px) {
  .sm-hidden { display: none; }
  .sm-block { display: block; }
  .sm-flex { display: flex; }
  .sm-grid { display: grid; }
}

/* Hide on medium screens */
@media (max-width: 768px) {
  .md-hidden { display: none; }
  .md-block { display: block; }
  .md-flex { display: flex; }
  .md-grid { display: grid; }
}

/* Hide on large screens */
@media (max-width: 1024px) {
  .lg-hidden { display: none; }
  .lg-block { display: block; }
  .lg-flex { display: flex; }
  .lg-grid { display: grid; }
}

/* Hide on extra large screens */
@media (max-width: 1280px) {
  .xl-hidden { display: none; }
  .xl-block { display: block; }
  .xl-flex { display: flex; }
  .xl-grid { display: grid; }
}

/* Show only on specific screens */
.sm-only { display: none; }
@media (min-width: 640px) and (max-width: 767px) {
  .sm-only { display: block; }
}

.md-only { display: none; }
@media (min-width: 768px) and (max-width: 1023px) {
  .md-only { display: block; }
}

.lg-only { display: none; }
@media (min-width: 1024px) and (max-width: 1279px) {
  .lg-only { display: block; }
}

.xl-only { display: none; }
@media (min-width: 1280px) and (max-width: 1535px) {
  .xl-only { display: block; }
}

.2xl-only { display: none; }
@media (min-width: 1536px) {
  .2xl-only { display: block; }
}

/* ============================================
   LAYOUT UTILITIES
   ============================================ */

.w-full { width: 100%; }
.w-screen { width: 100vw; }
.w-min { width: min-content; }
.w-max { width: max-content; }
.w-fit { width: fit-content; }

.h-full { height: 100%; }
.h-screen { height: 100vh; }
.h-min { height: min-content; }
.h-max { height: max-content; }
.h-fit { height: fit-content; }

.min-w-0 { min-width: 0; }
.min-w-full { min-width: 100%; }
.min-w-min { min-width: min-content; }
.min-w-max { min-width: max-content; }

.min-h-0 { min-height: 0; }
.min-h-full { min-height: 100%; }
.min-h-screen { min-height: 100vh; }

.max-w-xs { max-width: 320px; }
.max-w-sm { max-width: 384px; }
.max-w-md { max-width: 448px; }
.max-w-lg { max-width: 512px; }
.max-w-xl { max-width: 576px; }
.max-w-2xl { max-width: 672px; }
.max-w-3xl { max-width: 768px; }
.max-w-4xl { max-width: 896px; }
.max-w-5xl { max-width: 1024px; }
.max-w-6xl { max-width: 1152px; }
.max-w-7xl { max-width: 1280px; }
.max-w-full { max-width: 100%; }
.max-w-screen-sm { max-width: 640px; }
.max-w-screen-md { max-width: 768px; }
.max-w-screen-lg { max-width: 1024px; }
.max-w-screen-xl { max-width: 1280px; }
.max-w-screen-2xl { max-width: 1536px; }

.max-h-0 { max-height: 0; }
.max-h-full { max-height: 100%; }
.max-h-screen { max-height: 100vh; }

/* ============================================
   RESPONSIVE IMAGES
   ============================================ */

.img-responsive {
  max-width: 100%;
  height: auto;
  display: block;
}

.img-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.img-contain {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ============================================
   RESPONSIVE FORMS - HydroBlue ISO Style
   ============================================ */

@media (max-width: 640px) {
  .form-row-responsive {
    flex-direction: column;
    gap: 12px; /* HydroBlue spacing */
  }
  
  .form-group-responsive {
    width: 100%;
  }
  
  .form-label-responsive {
    font-size: 12px; /* HydroBlue --font-size-sm */
    font-weight: 600; /* HydroBlue label weight */
    margin-bottom: 6px; /* HydroBlue spacing */
    color: var(--dark-navy);
  }
  
  .form-input-responsive {
    font-size: 13px; /* HydroBlue --font-size-base */
    padding: 10px 12px; /* HydroBlue input padding */
    border: 1px solid var(--light-blue-border);
    border-radius: 8px; /* HydroBlue border radius */
    background: var(--off-white);
    color: var(--dark-text);
  }
  
  .form-input-responsive:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(11, 97, 255, 0.1);
  }
  
  .form-button-responsive {
    width: 100%;
    padding: 12px 16px; /* Larger for mobile */
    font-size: 14px;
    font-weight: 600;
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
  }
}

/* ============================================
   RESPONSIVE NAVIGATION - HydroBlue ISO Style
   ============================================ */

.nav-mobile-toggle {
  display: none;
}

@media (max-width: 768px) {
  .nav-mobile-toggle {
    display: block;
    background: none;
    border: 1px solid var(--light-blue-border);
    border-radius: 6px;
    color: var(--slate-gray);
    cursor: pointer;
    padding: 8px;
    width: 40px;
    height: 40px;
    transition: all 0.2s;
  }
  
  .nav-mobile-toggle:hover {
    background: var(--light-blue-subtle);
    color: var(--primary-blue);
  }
  
  .nav-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--white);
    padding: 16px; /* HydroBlue spacing */
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    border-right: 1px solid var(--light-blue-border);
  }
  
  .nav-menu.open {
    transform: translateX(0);
  }
  
  .nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(7, 32, 53, 0.5); /* Dark navy with opacity */
    z-index: 999;
    display: none;
  }
  
  .nav-overlay.open {
    display: block;
  }
}

/* ============================================
   RESPONSIVE TABLES - HydroBlue ISO Style
   ============================================ */

@media (max-width: 768px) {
  .table-responsive {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--light-blue-border);
    border-radius: 8px;
    background: var(--white);
  }
  
  .table-responsive table {
    min-width: 600px;
  }
  
  .table-stacked {
    display: block;
  }
  
  .table-stacked thead {
    display: none;
  }
  
  .table-stacked tbody,
  .table-stacked tr,
  .table-stacked td {
    display: block;
    width: 100%;
  }
  
  .table-stacked tr {
    margin-bottom: 12px;
    border: 1px solid var(--light-blue-border);
    border-radius: 8px;
    padding: 12px;
    background: var(--white);
  }
  
  .table-stacked td {
    border: none;
    padding: 8px 0;
    border-bottom: 1px solid var(--light-blue-border);
    color: var(--dark-text);
    font-size: 13px;
  }
  
  .table-stacked td:last-child {
    border-bottom: none;
  }
  
  .table-stacked td::before {
    content: attr(data-label);
    font-weight: 600;
    display: block;
    color: var(--dark-navy);
    margin-bottom: 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
}

/* ============================================
   RESPONSIVE CARDS - HydroBlue ISO Style
   ============================================ */

@media (max-width: 768px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
  
  .card {
    margin-bottom: 12px;
    background: var(--white);
    border: 1px solid var(--light-blue-border);
    border-radius: 10px;
    padding: 16px;
  }
  
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
  }
  
  .card-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 12px;
  }
}

/* ============================================
   RESPONSIVE MODALS - HydroBlue ISO Style
   ============================================ */

@media (max-width: 768px) {
  .modal {
    width: 95%;
    max-width: 95%;
    margin: 12px auto;
    border-radius: 10px;
    background: var(--white);
    border: 1px solid var(--light-blue-border);
    box-shadow: 0 20px 40px rgba(12, 22, 42, 0.15);
  }
  
  .modal-header {
    padding: 16px;
    border-bottom: 1px solid var(--light-blue-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--dark-navy);
  }
  
  .modal-body {
    padding: 16px;
    max-height: 60vh;
    overflow-y: auto;
  }
  
  .modal-footer {
    padding: 16px;
    border-top: 1px solid var(--light-blue-border);
    flex-direction: column;
    gap: 8px;
  }
  
  .modal-footer button {
    width: 100%;
  }
}

/* ============================================
   RESPONSIVE TABS - HydroBlue ISO Style
   ============================================ */

@media (max-width: 640px) {
  .tabs {
    flex-direction: column;
    border-bottom: none;
  }
  
  .tab {
    width: 100%;
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--light-blue-border);
    border-radius: 0;
    background: var(--white);
    color: var(--slate-gray);
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
  }
  
  .tab:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
  }
  
  .tab:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
  }
  
  .tab:hover {
    background: var(--light-blue-subtle);
    color: var(--primary-blue);
  }
  
  .tab.active {
    background: var(--light-blue-subtle);
    color: var(--primary-blue);
    border-bottom-color: var(--primary-blue);
  }
}

/* ============================================
   RESPONSIVE ACCORDION - HydroBlue ISO Style
   ============================================ */

@media (max-width: 768px) {
  .accordion-item {
    margin-bottom: 8px;
    border: 1px solid var(--light-blue-border);
    border-radius: 8px;
    background: var(--white);
  }
  
  .accordion-header {
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--dark-navy);
    background: var(--off-white);
    border-bottom: 1px solid var(--light-blue-border);
    cursor: pointer;
  }
  
  .accordion-content {
    padding: 12px;
    font-size: 13px;
    color: var(--dark-text);
    background: var(--white);
  }
}

/* ============================================
   PRINT STYLES - HydroBlue ISO Compatible
   ============================================ */

@media print {
  /* Hide non-essential elements */
  .no-print {
    display: none !important;
  }
  
  /* Adjust layouts for print */
  .print-full-width {
    width: 100% !important;
    max-width: 100% !important;
  }
  
  .print-block {
    display: block !important;
  }
  
  .print-grid {
    display: grid !important;
  }
  
  /* Remove backgrounds for better printing */
  body {
    background: white !important;
    color: black !important;
    font-size: 12pt !important;
  }
  
  .container {
    max-width: 100% !important;
    padding: 0 !important;
  }
  
  /* Adjust text sizes */
  h1, h2, h3, h4, h5, h6 {
    color: black !important;
  }
  
  /* Remove shadows and borders */
  .card, .panel, .calculator-container {
    border: 1px solid #ddd !important;
    box-shadow: none !important;
    background: white !important;
    break-inside: avoid;
  }
  
  /* Page breaks */
  .page-break-before {
    page-break-before: always;
  }
  
  .page-break-after {
    page-break-after: always;
  }
  
  .page-break-inside-avoid {
    page-break-inside: avoid;
  }
  
  /* Links */
  a {
    color: black !important;
    text-decoration: underline;
  }
  
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 10pt;
    color: #666;
  }
  
  /* Tables */
  table {
    border-collapse: collapse !important;
    width: 100% !important;
    break-inside: avoid;
  }
  
  th, td {
    border: 1px solid #ddd !important;
    padding: 6px !important;
    background: white !important;
    color: black !important;
  }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */

@media (hover: none) and (pointer: coarse) {
  button,
  input[type="button"],
  input[type="submit"],
  input[type="reset"],
  .btn {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 16px;
  }
  
  input,
  select,
  textarea {
    font-size: 16px; /* Prevents iOS zoom on focus */
    min-height: 44px;
  }
  
  .touch-target {
    padding: 12px;
    min-height: 44px;
    min-width: 44px;
  }
  
  .touch-separated > * {
    margin: 12px;
  }
}

/* ============================================
   HIGH DPI SCREENS
   ============================================ */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Ensure crisp borders */
  .border-1px {
    border-width: 0.5px;
  }
}

/* ============================================
   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;
  }
}