/* ===== MOBILE-FIRST RESPONSIVE DESIGN SYSTEM ===== */

/* Base Mobile Styles (320px and up) */
:root {
  --container-padding: 1rem;
  --section-padding: 2rem 1rem;
  --card-padding: 1rem;
  --button-padding: 0.75rem 1rem;
  --font-scale: 1;
}

/* Enhanced Container System */
.container-fluid {
  width: 100%;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

.container-sm {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

.container-md {
  width: 100%;
  max-width: 768px;
  margin: 0 auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

.container-lg {
  width: 100%;
  max-width: 1024px;
  margin: 0 auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

.container-xl {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

/* Responsive Grid System */
.grid {
  display: grid;
  gap: 1rem;
}

.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);
}

/* Responsive 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;
}

.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;
}

.items-start {
  align-items: flex-start;
}
.items-center {
  align-items: center;
}
.items-end {
  align-items: flex-end;
}
.items-stretch {
  align-items: stretch;
}

/* Responsive Spacing */
.p-0 {
  padding: 0;
}
.p-1 {
  padding: 0.25rem;
}
.p-2 {
  padding: 0.5rem;
}
.p-3 {
  padding: 0.75rem;
}
.p-4 {
  padding: 1rem;
}
.p-5 {
  padding: 1.25rem;
}
.p-6 {
  padding: 1.5rem;
}
.p-8 {
  padding: 2rem;
}

.m-0 {
  margin: 0;
}
.m-1 {
  margin: 0.25rem;
}
.m-2 {
  margin: 0.5rem;
}
.m-3 {
  margin: 0.75rem;
}
.m-4 {
  margin: 1rem;
}
.m-5 {
  margin: 1.25rem;
}
.m-6 {
  margin: 1.5rem;
}
.m-8 {
  margin: 2rem;
}

/* Responsive Text Sizes */
.text-xs {
  font-size: 0.75rem;
  line-height: 1rem;
}
.text-sm {
  font-size: 0.875rem;
  line-height: 1.25rem;
}
.text-base {
  font-size: 1rem;
  line-height: 1.5rem;
}
.text-lg {
  font-size: 1.125rem;
  line-height: 1.75rem;
}
.text-xl {
  font-size: 1.25rem;
  line-height: 1.75rem;
}
.text-2xl {
  font-size: 1.5rem;
  line-height: 2rem;
}
.text-3xl {
  font-size: 1.875rem;
  line-height: 2.25rem;
}

/* Responsive Display Utilities */
.block {
  display: block;
}
.inline-block {
  display: inline-block;
}
.inline {
  display: inline;
}
.hidden {
  display: none;
}

/* Mobile-First Breakpoints */

/* Small phones (375px and up) */
@media (min-width: 375px) {
  :root {
    --container-padding: 1.25rem;
  }
}

/* Large phones (480px and up) */
@media (min-width: 480px) {
  :root {
    --container-padding: 1.5rem;
    --card-padding: 1.25rem;
  }

  .grid-cols-sm-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-cols-sm-3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .flex-sm-row {
    flex-direction: row;
  }
  .flex-sm-col {
    flex-direction: column;
  }

  .text-sm-lg {
    font-size: 1.125rem;
    line-height: 1.75rem;
  }
  .text-sm-xl {
    font-size: 1.25rem;
    line-height: 1.75rem;
  }

  .hidden-sm {
    display: none;
  }
  .block-sm {
    display: block;
  }
}

/* Small tablets (640px and up) */
@media (min-width: 640px) {
  :root {
    --container-padding: 2rem;
    --section-padding: 3rem 2rem;
    --card-padding: 1.5rem;
    --button-padding: 0.875rem 1.5rem;
    --font-scale: 1.1;
  }

  .container-sm {
    padding-left: 2rem;
    padding-right: 2rem;
  }

  .grid-cols-sm-1 {
    grid-template-columns: repeat(1, 1fr);
  }
  .grid-cols-sm-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-cols-sm-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .grid-cols-sm-4 {
    grid-template-columns: repeat(4, 1fr);
  }

  .flex-sm-row {
    flex-direction: row;
  }
  .flex-sm-col {
    flex-direction: column;
  }

  .justify-sm-start {
    justify-content: flex-start;
  }
  .justify-sm-center {
    justify-content: center;
  }
  .justify-sm-end {
    justify-content: flex-end;
  }
  .justify-sm-between {
    justify-content: space-between;
  }

  .text-sm-base {
    font-size: 1rem;
    line-height: 1.5rem;
  }
  .text-sm-lg {
    font-size: 1.125rem;
    line-height: 1.75rem;
  }
  .text-sm-xl {
    font-size: 1.25rem;
    line-height: 1.75rem;
  }
  .text-sm-2xl {
    font-size: 1.5rem;
    line-height: 2rem;
  }

  .hidden-sm {
    display: none;
  }
  .block-sm {
    display: block;
  }
  .inline-block-sm {
    display: inline-block;
  }
}

/* Medium tablets (768px and up) */
@media (min-width: 768px) {
  :root {
    --container-padding: 2.5rem;
    --section-padding: 4rem 2.5rem;
    --card-padding: 2rem;
    --font-scale: 1.2;
  }

  .container-md {
    padding-left: 2.5rem;
    padding-right: 2.5rem;
  }

  .grid-cols-md-1 {
    grid-template-columns: repeat(1, 1fr);
  }
  .grid-cols-md-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-cols-md-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .grid-cols-md-4 {
    grid-template-columns: repeat(4, 1fr);
  }
  .grid-cols-md-5 {
    grid-template-columns: repeat(5, 1fr);
  }

  .flex-md-row {
    flex-direction: row;
  }
  .flex-md-col {
    flex-direction: column;
  }

  .justify-md-start {
    justify-content: flex-start;
  }
  .justify-md-center {
    justify-content: center;
  }
  .justify-md-end {
    justify-content: flex-end;
  }
  .justify-md-between {
    justify-content: space-between;
  }

  .text-md-lg {
    font-size: 1.125rem;
    line-height: 1.75rem;
  }
  .text-md-xl {
    font-size: 1.25rem;
    line-height: 1.75rem;
  }
  .text-md-2xl {
    font-size: 1.5rem;
    line-height: 2rem;
  }
  .text-md-3xl {
    font-size: 1.875rem;
    line-height: 2.25rem;
  }

  .hidden-md {
    display: none;
  }
  .block-md {
    display: block;
  }
  .inline-block-md {
    display: inline-block;
  }

  /* Sidebar becomes visible on tablets */
  .sidebar-desktop {
    position: relative;
    width: 16rem;
    height: auto;
    transform: translateX(0);
  }

  .main-content-with-sidebar {
    margin-left: 16rem;
  }
}

/* Large tablets and small desktops (1024px and up) */
@media (min-width: 1024px) {
  :root {
    --container-padding: 3rem;
    --section-padding: 5rem 3rem;
    --card-padding: 2.5rem;
    --font-scale: 1.3;
  }

  .container-lg {
    padding-left: 3rem;
    padding-right: 3rem;
  }

  .grid-cols-lg-1 {
    grid-template-columns: repeat(1, 1fr);
  }
  .grid-cols-lg-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-cols-lg-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .grid-cols-lg-4 {
    grid-template-columns: repeat(4, 1fr);
  }
  .grid-cols-lg-5 {
    grid-template-columns: repeat(5, 1fr);
  }
  .grid-cols-lg-6 {
    grid-template-columns: repeat(6, 1fr);
  }

  .flex-lg-row {
    flex-direction: row;
  }
  .flex-lg-col {
    flex-direction: column;
  }

  .justify-lg-start {
    justify-content: flex-start;
  }
  .justify-lg-center {
    justify-content: center;
  }
  .justify-lg-end {
    justify-content: flex-end;
  }
  .justify-lg-between {
    justify-content: space-between;
  }

  .text-lg-xl {
    font-size: 1.25rem;
    line-height: 1.75rem;
  }
  .text-lg-2xl {
    font-size: 1.5rem;
    line-height: 2rem;
  }
  .text-lg-3xl {
    font-size: 1.875rem;
    line-height: 2.25rem;
  }
  .text-lg-4xl {
    font-size: 2.25rem;
    line-height: 2.5rem;
  }

  .hidden-lg {
    display: none;
  }
  .block-lg {
    display: block;
  }
  .inline-block-lg {
    display: inline-block;
  }
}

/* Extra large desktops (1280px and up) */
@media (min-width: 1280px) {
  :root {
    --container-padding: 4rem;
    --section-padding: 6rem 4rem;
    --font-scale: 1.4;
  }

  .container-xl {
    padding-left: 4rem;
    padding-right: 4rem;
  }

  .grid-cols-xl-1 {
    grid-template-columns: repeat(1, 1fr);
  }
  .grid-cols-xl-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-cols-xl-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .grid-cols-xl-4 {
    grid-template-columns: repeat(4, 1fr);
  }
  .grid-cols-xl-5 {
    grid-template-columns: repeat(5, 1fr);
  }
  .grid-cols-xl-6 {
    grid-template-columns: repeat(6, 1fr);
  }

  .flex-xl-row {
    flex-direction: row;
  }
  .flex-xl-col {
    flex-direction: column;
  }

  .text-xl-2xl {
    font-size: 1.5rem;
    line-height: 2rem;
  }
  .text-xl-3xl {
    font-size: 1.875rem;
    line-height: 2.25rem;
  }
  .text-xl-4xl {
    font-size: 2.25rem;
    line-height: 2.5rem;
  }
  .text-xl-5xl {
    font-size: 3rem;
    line-height: 1;
  }

  .hidden-xl {
    display: none;
  }
  .block-xl {
    display: block;
  }
  .inline-block-xl {
    display: inline-block;
  }
}

/* Ultra-wide screens (1536px and up) */
@media (min-width: 1536px) {
  :root {
    --container-padding: 5rem;
    --section-padding: 8rem 5rem;
    --font-scale: 1.5;
  }

  .grid-cols-2xl-1 {
    grid-template-columns: repeat(1, 1fr);
  }
  .grid-cols-2xl-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-cols-2xl-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .grid-cols-2xl-4 {
    grid-template-columns: repeat(4, 1fr);
  }
  .grid-cols-2xl-5 {
    grid-template-columns: repeat(5, 1fr);
  }
  .grid-cols-2xl-6 {
    grid-template-columns: repeat(6, 1fr);
  }
  .grid-cols-2xl-7 {
    grid-template-columns: repeat(7, 1fr);
  }
  .grid-cols-2xl-8 {
    grid-template-columns: repeat(8, 1fr);
  }
}

/* Responsive Component Adjustments */
@media (max-width: 639px) {
  /* Mobile-specific adjustments */
  .hero-section {
    min-height: calc(100vh - 4rem);
    padding: 1.5rem 1rem;
  }

  .hero-content h1 {
    font-size: clamp(1.75rem, 8vw, 2.5rem);
  }

  .hero-content p {
    font-size: clamp(0.875rem, 4vw, 1rem);
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .hero-buttons {
    flex-direction: column;
    gap: 0.75rem;
  }

  .form-container {
    margin: 1rem;
    padding: 1.5rem;
    border-radius: 1rem;
  }

  .sidebar {
    width: 0;
    transition: width 0.3s ease;
  }

  .sidebar.open {
    width: 85vw;
    max-width: 300px;
  }

  .bottom-nav {
    padding: 0.75rem 0.5rem;
  }

  .bottom-nav-item {
    padding: 0.5rem;
  }

  .bottom-nav-icon {
    width: 1.25rem;
    height: 1.25rem;
  }

  .bottom-nav span {
    font-size: 0.625rem;
  }
}

/* Landscape phone adjustments */
@media (max-width: 767px) and (orientation: landscape) {
  .hero-section {
    min-height: calc(100vh - 3rem);
    padding: 1rem;
  }

  .hero-content h1 {
    font-size: clamp(1.5rem, 6vw, 2rem);
    margin-bottom: 1rem;
  }

  .hero-content p {
    font-size: clamp(0.75rem, 3vw, 0.875rem);
    margin-bottom: 1.5rem;
  }

  .hero-buttons {
    flex-direction: row;
    gap: 1rem;
  }

  .btn {
    width: auto;
    min-width: 120px;
  }
}

/* Print styles */
@media print {
  .sidebar,
  .bottom-nav,
  .menu-icon,
  .close-btn,
  .btn,
  .toast {
    display: none !important;
  }

  .container {
    max-width: none;
    padding: 0;
  }

  #main-content {
    margin-left: 0;
    padding: 0;
  }

  .hero-section {
    background: none;
    color: #000;
    padding: 2rem 0;
  }

  .card {
    border: 1px solid #000;
    box-shadow: none;
    background: #fff;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .card {
    border: 2px solid #000;
  }

  .btn {
    border: 2px solid #000;
  }

  .form-input {
    border: 2px solid #000;
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .hero-section::before {
    animation: none;
  }

  .loading-spinner {
    animation: none;
    border: 3px solid #3b82f6;
  }

  .loading-dots span {
    animation: none;
  }

  .progress-bar-fill::before {
    animation: none;
  }
}
