/**
 * OpenLifeOS Responsive Design System
 * Comprehensive breakpoints for all devices
 */

/* Base styles - Mobile First Approach */
/* Extra small devices (phones, less than 480px) */
:root {
  --container-padding: 15px;
  --grid-gap: 15px;
  --font-size-base: 14px;
  --heading-scale: 1.2;
}

/* Small devices (large phones, 480px and up) */
@media (min-width: 480px) {
  :root {
    --container-padding: 20px;
    --grid-gap: 20px;
    --font-size-base: 15px;
  }

  .container {
    max-width: 100%;
    padding: var(--container-padding);
  }

  .demo-grid {
    grid-template-columns: 1fr;
  }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
  :root {
    --container-padding: 30px;
    --grid-gap: 25px;
    --font-size-base: 16px;
    --heading-scale: 1.3;
  }

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

  .demo-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--grid-gap);
  }

  .hero-section {
    padding: 80px 0;
  }

  .hero-title {
    font-size: 3rem;
  }

  .nav-menu {
    display: flex;
    flex-direction: row;
    position: static;
    background: transparent;
  }

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

/* Large devices (desktops, 1024px and up) */
@media (min-width: 1024px) {
  :root {
    --container-padding: 40px;
    --grid-gap: 30px;
    --heading-scale: 1.4;
  }

  .container {
    max-width: 980px;
  }

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

  .hero-title {
    font-size: 4rem;
  }

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

  .sidebar {
    display: block;
    position: sticky;
    top: 20px;
  }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }

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

  .hero-section {
    padding: 120px 0;
  }

  .hero-title {
    font-size: 5rem;
  }
}

/* Ultra wide screens (1920px and up) */
@media (min-width: 1920px) {
  .container {
    max-width: 1400px;
  }

  .demo-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* Responsive Typography */
@media (max-width: 767px) {
  h1 { font-size: calc(1.5rem + 2vw); }
  h2 { font-size: calc(1.3rem + 1.5vw); }
  h3 { font-size: calc(1.1rem + 1vw); }
  h4 { font-size: calc(1rem + 0.5vw); }
  
  .hero-title {
    font-size: clamp(2rem, 8vw, 3.5rem);
    line-height: 1.2;
  }
  
  .hero-subtitle {
    font-size: clamp(1rem, 4vw, 1.5rem);
  }
}

/* Responsive Images */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Responsive Tables */
@media (max-width: 767px) {
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

/* Responsive Forms */
@media (max-width: 480px) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  textarea,
  select {
    width: 100%;
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  .form-row {
    flex-direction: column;
  }
  
  .form-row > * {
    margin-bottom: 10px;
  }
}

/* Responsive Navigation */
@media (max-width: 767px) {
  .nav-menu {
    position: fixed;
    left: -100%;
    top: 60px;
    flex-direction: column;
    background-color: var(--bg-primary);
    width: 100%;
    text-align: center;
    transition: 0.3s;
    box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
    z-index: 9999;
  }

  .nav-menu.active {
    left: 0;
  }

  .nav-item {
    margin: 1rem 0;
  }

  .hamburger {
    display: block;
    cursor: pointer;
  }

  .hamburger.active .bar:nth-child(2) {
    opacity: 0;
  }

  .hamburger.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }

  .hamburger.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }
}

/* Responsive Cards */
.card-grid {
  display: grid;
  gap: var(--grid-gap);
}

@media (min-width: 480px) {
  .card-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }
}

@media (min-width: 768px) {
  .card-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
}

/* Responsive Utilities */
/* Hide on mobile */
@media (max-width: 767px) {
  .hide-mobile {
    display: none !important;
  }
}

/* Hide on tablet */
@media (min-width: 768px) and (max-width: 1023px) {
  .hide-tablet {
    display: none !important;
  }
}

/* Hide on desktop */
@media (min-width: 1024px) {
  .hide-desktop {
    display: none !important;
  }
}

/* Show only on mobile */
@media (min-width: 768px) {
  .show-mobile {
    display: none !important;
  }
}

/* Show only on tablet */
@media (max-width: 767px), (min-width: 1024px) {
  .show-tablet {
    display: none !important;
  }
}

/* Show only on desktop */
@media (max-width: 1023px) {
  .show-desktop {
    display: none !important;
  }
}

/* Responsive Spacing */
@media (max-width: 767px) {
  .section {
    padding: 40px 0;
  }
  
  .mb-5 { margin-bottom: 2rem !important; }
  .mt-5 { margin-top: 2rem !important; }
  .py-5 { padding-top: 2rem !important; padding-bottom: 2rem !important; }
  .px-5 { padding-left: 1rem !important; padding-right: 1rem !important; }
}

/* Responsive Flexbox */
@media (max-width: 767px) {
  .flex-row {
    flex-direction: column;
  }
  
  .flex-md-row {
    flex-direction: column;
  }
}

@media (min-width: 768px) {
  .flex-md-row {
    flex-direction: row;
  }
}

/* Responsive Grid System */
.row {
  display: flex;
  flex-wrap: wrap;
  margin-right: calc(var(--grid-gap) * -0.5);
  margin-left: calc(var(--grid-gap) * -0.5);
}

.col {
  flex: 1 0 0%;
  padding-right: calc(var(--grid-gap) * 0.5);
  padding-left: calc(var(--grid-gap) * 0.5);
}

/* Columns for different breakpoints */
@media (min-width: 480px) {
  .col-sm-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
  .col-sm-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
  .col-sm-3 { flex: 0 0 25%; max-width: 25%; }
  .col-sm-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
  .col-sm-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
  .col-sm-6 { flex: 0 0 50%; max-width: 50%; }
  .col-sm-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
  .col-sm-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
  .col-sm-9 { flex: 0 0 75%; max-width: 75%; }
  .col-sm-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
  .col-sm-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
  .col-sm-12 { flex: 0 0 100%; max-width: 100%; }
}

@media (min-width: 768px) {
  .col-md-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
  .col-md-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
  .col-md-3 { flex: 0 0 25%; max-width: 25%; }
  .col-md-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
  .col-md-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
  .col-md-6 { flex: 0 0 50%; max-width: 50%; }
  .col-md-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
  .col-md-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
  .col-md-9 { flex: 0 0 75%; max-width: 75%; }
  .col-md-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
  .col-md-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
  .col-md-12 { flex: 0 0 100%; max-width: 100%; }
}

@media (min-width: 1024px) {
  .col-lg-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
  .col-lg-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
  .col-lg-3 { flex: 0 0 25%; max-width: 25%; }
  .col-lg-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
  .col-lg-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
  .col-lg-6 { flex: 0 0 50%; max-width: 50%; }
  .col-lg-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
  .col-lg-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
  .col-lg-9 { flex: 0 0 75%; max-width: 75%; }
  .col-lg-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
  .col-lg-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
  .col-lg-12 { flex: 0 0 100%; max-width: 100%; }
}

@media (min-width: 1200px) {
  .col-xl-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
  .col-xl-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
  .col-xl-3 { flex: 0 0 25%; max-width: 25%; }
  .col-xl-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
  .col-xl-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
  .col-xl-6 { flex: 0 0 50%; max-width: 50%; }
  .col-xl-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
  .col-xl-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
  .col-xl-9 { flex: 0 0 75%; max-width: 75%; }
  .col-xl-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
  .col-xl-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
  .col-xl-12 { flex: 0 0 100%; max-width: 100%; }
}

/* Print Styles */
@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    font-size: 12pt;
    color: #000;
    background: #fff;
  }
  
  a {
    text-decoration: underline;
  }
  
  .container {
    width: 100%;
    max-width: none;
  }
}