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

/* ========================================
   TABLET BREAKPOINT (768px)
   ======================================== */

@media (max-width: 768px) {
  :root {
    --spacing-xl: 1.5rem;
    --spacing-2xl: 2rem;
    --spacing-3xl: 2.5rem;
  }

  html {
    font-size: 15px;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.25rem;
  }

  h4 {
    font-size: 1.125rem;
  }

  .container {
    padding: 0 1rem;
  }

  /* Typography */
  p {
    font-size: 0.95rem;
  }

  small {
    font-size: 0.8rem;
  }

  /* Buttons */
  .btn,
  button,
  input[type="button"],
  input[type="reset"],
  input[type="submit"] {
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
  }

  /* Forms */
  input,
  textarea,
  select {
    padding: 0.75rem;
    font-size: 16px; /* Prevent zoom on iOS */
  }

  /* Grid */
  .grid-cols-2 {
    grid-template-columns: 1fr;
  }

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

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

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

  /* Tables */
  table {
    font-size: 0.9rem;
  }

  th,
  td {
    padding: 0.75rem;
  }

  /* Cards */
  .card {
    padding: 1rem;
  }

  /* Flexbox */
  .flex-wrap {
    flex-direction: column;
  }

  /* Spacing */
  .mb-4 {
    margin-bottom: 1.5rem;
  }

  .mt-4 {
    margin-top: 1.5rem;
  }

  .p-4 {
    padding: 1.5rem;
  }
}

/* ========================================
   MOBILE BREAKPOINT (480px)
   ======================================== */

@media (max-width: 480px) {
  :root {
    --spacing-lg: 1rem;
    --spacing-xl: 1.25rem;
    --spacing-2xl: 1.5rem;
    --spacing-3xl: 2rem;
  }

  html {
    font-size: 14px;
  }

  body {
    font-size: 0.95rem;
    line-height: 1.5;
  }

  h1 {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
  }

  h2 {
    font-size: 1.375rem;
    margin-bottom: 0.625rem;
  }

  h3 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
  }

  h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
  }

  h5, h6 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
  }

  p {
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
  }

  small {
    font-size: 0.75rem;
  }

  .container {
    padding: 0 0.75rem;
  }

  /* Buttons */
  .btn,
  button,
  input[type="button"],
  input[type="reset"],
  input[type="submit"] {
    padding: 0.625rem 1rem;
    font-size: 0.9rem;
    min-height: 44px; /* Touch target size */
  }

  .btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
  }

  .btn-large {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
  }

  /* Forms */
  input,
  textarea,
  select {
    padding: 0.625rem;
    font-size: 16px; /* Prevent zoom on iOS */
    min-height: 44px; /* Touch target size */
  }

  label {
    font-size: 0.85rem;
    margin-bottom: 0.375rem;
  }

  .form-group {
    margin-bottom: 1rem;
  }

  /* Images */
  img {
    border-radius: 0.5rem;
  }

  /* Tables */
  table {
    font-size: 0.85rem;
    margin-bottom: 1rem;
  }

  th,
  td {
    padding: 0.5rem;
  }

  /* Lists */
  ul, ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
  }

  li {
    margin-bottom: 0.375rem;
  }

  /* Blockquotes */
  blockquote {
    padding: 1rem;
    margin: 1rem 0;
    border-left-width: 3px;
  }

  /* Cards */
  .card {
    padding: 0.875rem;
  }

  .card-header {
    margin-bottom: 0.875rem;
    padding-bottom: 0.875rem;
  }

  .card-footer {
    padding-top: 0.875rem;
  }

  /* Alerts */
  .alert {
    padding: 0.875rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
  }

  /* Badges */
  .badge {
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
  }

  /* Grid */
  .grid-cols-1 {
    grid-template-columns: 1fr;
  }

  .grid-cols-2 {
    grid-template-columns: 1fr;
  }

  .grid-cols-3 {
    grid-template-columns: 1fr;
  }

  .grid-cols-4 {
    grid-template-columns: 1fr;
  }

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

  .grid-gap-1 {
    gap: 0.375rem;
  }

  .grid-gap-2 {
    gap: 0.625rem;
  }

  .grid-gap-3 {
    gap: 0.875rem;
  }

  .grid-gap-4 {
    gap: 1rem;
  }

  /* Flexbox */
  .flex-wrap {
    flex-direction: column;
  }

  .gap-1 {
    gap: 0.375rem;
  }

  .gap-2 {
    gap: 0.625rem;
  }

  .gap-3 {
    gap: 0.875rem;
  }

  .gap-4 {
    gap: 1rem;
  }

  /* Spacing */
  .mb-0 { margin-bottom: 0; }
  .mb-1 { margin-bottom: 0.375rem; }
  .mb-2 { margin-bottom: 0.625rem; }
  .mb-3 { margin-bottom: 0.875rem; }
  .mb-4 { margin-bottom: 1rem; }

  .mt-0 { margin-top: 0; }
  .mt-1 { margin-top: 0.375rem; }
  .mt-2 { margin-top: 0.625rem; }
  .mt-3 { margin-top: 0.875rem; }
  .mt-4 { margin-top: 1rem; }

  .p-0 { padding: 0; }
  .p-1 { padding: 0.375rem; }
  .p-2 { padding: 0.625rem; }
  .p-3 { padding: 0.875rem; }
  .p-4 { padding: 1rem; }

  /* Rounded corners */
  .rounded {
    border-radius: 0.5rem;
  }

  .rounded-sm {
    border-radius: 0.25rem;
  }

  .rounded-md {
    border-radius: 0.375rem;
  }

  .rounded-lg {
    border-radius: 0.5rem;
  }

  .rounded-xl {
    border-radius: 0.75rem;
  }

  .rounded-2xl {
    border-radius: 1rem;
  }

  /* Text utilities */
  .text-center {
    text-align: center;
  }

  .text-left {
    text-align: left;
  }

  .text-right {
    text-align: right;
  }

  /* Line clamp */
  .line-clamp-2 {
    -webkit-line-clamp: 2;
  }

  .line-clamp-3 {
    -webkit-line-clamp: 3;
  }

  /* Shadows */
  .shadow {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  }

  .shadow-lg {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  }

  .shadow-xl {
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
  }

  .shadow-2xl {
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
  }

  /* Opacity */
  .opacity-50 {
    opacity: 0.5;
  }

  .opacity-75 {
    opacity: 0.75;
  }

  .opacity-100 {
    opacity: 1;
  }
}

/* ========================================
   SMALL MOBILE BREAKPOINT (360px)
   ======================================== */

@media (max-width: 360px) {
  html {
    font-size: 13px;
  }

  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  h3 {
    font-size: 1rem;
  }

  .container {
    padding: 0 0.5rem;
  }

  /* Buttons */
  .btn,
  button,
  input[type="button"],
  input[type="reset"],
  input[type="submit"] {
    padding: 0.5rem 0.875rem;
    font-size: 0.85rem;
  }

  /* Forms */
  input,
  textarea,
  select {
    padding: 0.5rem;
  }

  /* Cards */
  .card {
    padding: 0.75rem;
  }

  /* Grid */
  .grid-cols-6 {
    grid-template-columns: 1fr;
  }

  /* Spacing */
  .mb-4 { margin-bottom: 0.75rem; }
  .mt-4 { margin-top: 0.75rem; }
  .p-4 { padding: 0.75rem; }
}

/* ========================================
   LANDSCAPE ORIENTATION
   ======================================== */

@media (max-height: 500px) and (orientation: landscape) {
  .site-header {
    padding: 0.5rem 1rem;
  }

  .site-branding-text {
    display: none;
  }

  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  .container {
    padding: 0.5rem;
  }
}

/* ========================================
   HIGH RESOLUTION DISPLAYS
   ======================================== */

@media (min-width: 1920px) {
  html {
    font-size: 18px;
  }

  .container {
    max-width: 1600px;
    padding: 0 3rem;
  }

  h1 {
    font-size: 3rem;
  }

  h2 {
    font-size: 2.5rem;
  }

  h3 {
    font-size: 2rem;
  }
}

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

@media print {
  * {
    background: transparent !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]:after {
    content: " (" attr(href) ")";
  }

  img {
    max-width: 100% !important;
  }

  @page {
    margin: 0.5cm;
  }

  p,
  h1,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }

  h1,
  h2,
  h3 {
    page-break-after: avoid;
  }

  .no-print,
  .site-header,
  .site-footer,
  .main-navigation {
    display: none !important;
  }
}

/* ========================================
   REDUCED MOTION
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========================================
   DARK MODE (if system preference)
   ======================================== */

@media (prefers-color-scheme: dark) {
  body {
    background-color: #0f172a;
    color: #e2e8f0;
  }

  input,
  textarea,
  select {
    background-color: #1e293b;
    color: #e2e8f0;
    border-color: #475569;
  }

  a {
    color: #818cf8;
  }

  a:visited {
    color: #a78bfa;
  }
}

/* ========================================
   LIGHT MODE (if system preference)
   ======================================== */

@media (prefers-color-scheme: light) {
  body {
    background-color: #f8fafc;
    color: #1e293b;
  }

  input,
  textarea,
  select {
    background-color: #ffffff;
    color: #1e293b;
    border-color: #cbd5e1;
  }

  a {
    color: #0ea5e9;
  }

  a:visited {
    color: #06b6d4;
  }

  .site-header {
    background-color: rgba(248, 250, 252, 0.95);
    border-bottom-color: #e2e8f0;
  }

  .site-footer {
    background-color: #f1f5f9;
    border-top-color: #e2e8f0;
  }
}
