/*
 * ThreeStar Ltd - Responsive Stylesheet
 * Design Credits: Datacare (https://datacare.co.ke)
 * Mobile-First Responsive Design
 */

/* ============================================
   EXTRA LARGE DEVICES (>= 1200px)
   ============================================ */
@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }

  .hero-section h1 {
    font-size: 4rem;
  }

  .service-card {
    padding: 2.5rem;
  }
}

/* ============================================
   LARGE DEVICES (>= 992px and < 1200px)
   ============================================ */
@media (min-width: 992px) and (max-width: 1199px) {
  .hero-section h1 {
    font-size: 3rem;
  }

  .service-card {
    padding: 2rem;
  }
}

/* ============================================
   MEDIUM DEVICES - TABLETS (>= 768px and < 992px)
   ============================================ */
@media (min-width: 768px) and (max-width: 991px) {
  /* Typography */
  .hero-section h1 {
    font-size: 2.75rem;
  }

  .hero-section .lead {
    font-size: 1.35rem;
  }

  /* Navigation */
  .navbar-collapse {
    background-color: var(--white);
    padding: 1rem;
    margin-top: 1rem;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-md);
  }

  /* Hero Buttons */
  .hero-buttons {
    justify-content: center;
  }

  /* Stats */
  .stats-card {
    margin-bottom: 2rem;
  }

  /* Service Cards */
  .service-card {
    margin-bottom: 2rem;
  }

  /* Footer */
  .footer-column {
    margin-bottom: 2rem;
  }
}

/* ============================================
   SMALL DEVICES - MOBILE LANDSCAPE (>= 576px and < 768px)
   ============================================ */
@media (min-width: 576px) and (max-width: 767px) {
  /* Typography */
  .hero-section h1 {
    font-size: 2.25rem;
  }

  .hero-section .lead {
    font-size: 1.15rem;
  }

  .page-hero h1 {
    font-size: 2.25rem;
  }

  /* Buttons */
  .btn-primary-custom,
  .btn-secondary-custom,
  .btn-outline-custom {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
  }

  .hero-buttons {
    flex-direction: column;
    align-items: center;
  }

  /* Stats */
  .stats-number {
    font-size: 2.75rem;
  }

  .stats-label {
    font-size: 1rem;
  }

  /* Service Cards */
  .service-card {
    padding: 2rem;
    margin-bottom: 1.5rem;
  }

  .service-icon {
    width: 70px;
    height: 70px;
    font-size: 1.75rem;
  }

  /* Product Cards */
  .product-card {
    margin-bottom: 1.5rem;
  }

  /* Footer */
  .footer-column {
    text-align: center;
    margin-bottom: 2.5rem;
  }

  .social-links {
    justify-content: center;
  }

  .footer-links {
    text-align: center;
  }

  .footer-contact-info li {
    justify-content: center;
  }
}

/* ============================================
   EXTRA SMALL DEVICES - MOBILE PORTRAIT (< 576px)
   ============================================ */
@media (max-width: 575px) {
  /* Base Spacing */
  .section-padding {
    padding: 3rem 0;
  }

  .container {
    padding-left: 20px;
    padding-right: 20px;
  }

  /* Typography */
  .hero-section h1 {
    font-size: 1.85rem;
    line-height: 1.3;
  }

  .hero-section .lead {
    font-size: 1rem;
  }

  .page-hero {
    padding: 120px 0 80px;
  }

  .page-hero h1 {
    font-size: 1.85rem;
  }

  h2 {
    font-size: 1.85rem;
  }

  h3 {
    font-size: 1.5rem;
  }

  h4 {
    font-size: 1.25rem;
  }

  .lead-text {
    font-size: 1.1rem;
  }

  /* Navigation */
  .navbar-brand {
    font-size: 1.25rem;
  }

  .navbar-toggler {
    padding: 0.5rem;
  }

  .navbar-collapse {
    background-color: var(--white);
    padding: 1.5rem 1rem;
    margin-top: 1rem;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
  }

  .navbar-nav .nav-link {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-200);
  }

  .navbar-nav .nav-item:last-child .nav-link {
    border-bottom: none;
  }

  /* Hero Section */
  .hero-section {
    min-height: 100vh;
    padding-top: 70px;
    text-align: center;
  }

  .hero-content {
    padding: 0 1rem;
  }

  .hero-buttons {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .hero-buttons .btn-primary-custom,
  .hero-buttons .btn-secondary-custom,
  .hero-buttons .btn-outline-custom {
    width: 100%;
  }

  .scroll-indicator {
    bottom: 20px;
  }

  /* Stats Section */
  .stats-section {
    padding: 3rem 0;
  }

  .stats-card {
    padding: 1.5rem 1rem;
    margin-bottom: 1.5rem;
  }

  .stats-card:last-child {
    margin-bottom: 0;
  }

  .stats-number {
    font-size: 2.5rem;
  }

  .stats-label {
    font-size: 0.95rem;
  }

  .stats-card i {
    font-size: 2.5rem;
  }

  /* Service Cards */
  .service-card {
    padding: 1.75rem;
    margin-bottom: 1.5rem;
  }

  .service-icon {
    width: 65px;
    height: 65px;
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
  }

  .service-card h3 {
    font-size: 1.35rem;
  }

  /* Product Cards */
  .product-card {
    margin-bottom: 1.5rem;
  }

  .product-image {
    height: 180px;
  }

  .product-content {
    padding: 1.5rem;
  }

  /* Team Cards */
  .team-card {
    margin-bottom: 1.5rem;
  }

  .team-image {
    height: 250px;
  }

  .team-info {
    padding: 1.5rem;
  }

  /* Testimonial Cards */
  .testimonial-card {
    padding: 1.5rem;
    margin: 1rem 0;
  }

  .testimonial-quote {
    font-size: 3rem;
    top: 10px;
    left: 10px;
  }

  .testimonial-text {
    font-size: 1rem;
    padding-left: 0;
  }

  .testimonial-author {
    flex-direction: column;
    text-align: center;
  }

  /* Buttons */
  .btn-primary-custom,
  .btn-secondary-custom,
  .btn-outline-custom {
    padding: 12px 24px;
    font-size: 0.95rem;
  }

  .btn-lg-custom {
    padding: 14px 28px;
    font-size: 1rem;
  }

  /* Forms */
  .form-control {
    padding: 10px 12px;
    font-size: 1rem;
  }

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

  /* Icon Box */
  .icon-box {
    width: 50px;
    height: 50px;
    font-size: 1.25rem;
  }

  /* Footer */
  .site-footer {
    padding: 3rem 0 2rem;
    text-align: center;
  }

  .footer-column {
    margin-bottom: 2.5rem;
  }

  .footer-column:last-child {
    margin-bottom: 0;
  }

  .footer-column h5 {
    font-size: 1.15rem;
    margin-bottom: 1.25rem;
  }

  .footer-links {
    text-align: center;
  }

  .footer-links a {
    justify-content: center;
  }

  .footer-contact-info li {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
  }

  .social-links {
    justify-content: center;
    margin-top: 1.25rem;
  }

  .social-links a {
    width: 42px;
    height: 42px;
    font-size: 1rem;
  }

  .footer-bottom {
    margin-top: 2rem;
    padding-top: 1.5rem;
  }

  .footer-bottom-links {
    flex-direction: column;
    gap: 1rem;
  }

  /* Back to Top & Floating Contact */
  .back-to-top {
    width: 45px;
    height: 45px;
    bottom: 20px;
    right: 15px;
    font-size: 1.25rem;
  }

  .floating-contact {
    width: 55px;
    height: 55px;
    bottom: 75px;
    right: 15px;
    font-size: 1.5rem;
  }

  /* Timeline */
  .timeline {
    padding: 1.5rem 0;
  }

  .timeline::before {
    left: 15px;
  }

  .timeline-item,
  .timeline-item:nth-child(even) {
    width: 100%;
    margin-left: 0;
    padding-left: 50px;
    padding-right: 0;
    margin-bottom: 2rem;
  }

  .timeline-dot,
  .timeline-item:nth-child(even) .timeline-dot {
    left: 8px;
    right: auto;
    width: 14px;
    height: 14px;
  }

  .timeline-content {
    padding: 1.25rem;
  }

  .timeline-content h4 {
    font-size: 1.15rem;
  }

  /* Accordion */
  .accordion-button {
    padding: 1rem 1.25rem;
    font-size: 0.95rem;
  }

  .accordion-body {
    padding: 1.25rem;
  }

  /* Breadcrumb */
  .breadcrumb {
    font-size: 0.875rem;
    flex-wrap: wrap;
  }

  /* Mega Menu */
  .mega-menu .dropdown-menu {
    position: relative;
    transform: none;
    left: 0;
    padding: 1rem;
    max-width: 100%;
  }

  .mega-menu-column {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-200);
  }

  .mega-menu-column:last-child {
    border-bottom: none;
  }

  .mega-menu-column h6 {
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
  }

  .mega-menu-column .dropdown-item {
    padding: 0.5rem 0;
    font-size: 0.875rem;
  }

  /* Dropdown Menu */
  .dropdown-menu {
    margin-top: 0.25rem;
  }

  .dropdown-item {
    padding: 0.65rem 1.25rem;
    font-size: 0.9rem;
  }

  /* Modals */
  .modal-dialog {
    margin: 0.5rem;
  }

  .modal-content {
    border-radius: var(--border-radius-md);
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 1.25rem;
  }
}

/* ============================================
   VERY SMALL DEVICES (< 400px)
   ============================================ */
@media (max-width: 399px) {
  /* Further reduce font sizes */
  .hero-section h1 {
    font-size: 1.65rem;
  }

  .page-hero h1 {
    font-size: 1.65rem;
  }

  h2 {
    font-size: 1.65rem;
  }

  h3 {
    font-size: 1.35rem;
  }

  .stats-number {
    font-size: 2.25rem;
  }

  /* Reduce padding */
  .container {
    padding-left: 15px;
    padding-right: 15px;
  }

  .service-card,
  .product-content,
  .team-info {
    padding: 1.5rem;
  }

  .testimonial-card {
    padding: 1.25rem;
  }

  /* Adjust buttons */
  .btn-primary-custom,
  .btn-secondary-custom,
  .btn-outline-custom {
    padding: 10px 20px;
    font-size: 0.9rem;
  }

  /* Footer */
  .social-links a {
    width: 38px;
    height: 38px;
    font-size: 0.95rem;
  }

  /* Floating elements */
  .back-to-top {
    width: 42px;
    height: 42px;
    font-size: 1.15rem;
    right: 10px;
    bottom: 15px;
  }

  .floating-contact {
    width: 50px;
    height: 50px;
    font-size: 1.35rem;
    right: 10px;
    bottom: 65px;
  }
}

/* ============================================
   LANDSCAPE ORIENTATION (Mobile)
   ============================================ */
@media (max-width: 768px) and (orientation: landscape) {
  .hero-section {
    min-height: auto;
    padding: 100px 0 60px;
  }

  .stats-section {
    padding: 2rem 0;
  }

  .stats-card {
    padding: 1rem;
    margin-bottom: 1rem;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  /* Hide non-essential elements */
  .site-header,
  .back-to-top,
  .floating-contact,
  .scroll-indicator,
  .navbar,
  .btn,
  .social-links {
    display: none !important;
  }

  /* Optimize for printing */
  body {
    font-size: 12pt;
    line-height: 1.5;
    color: #000;
  }

  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
    color: #000;
  }

  p, li {
    orphans: 3;
    widows: 3;
  }

  /* Remove backgrounds */
  * {
    background: transparent !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  /* Show links */
  a[href]::after {
    content: " (" attr(href) ")";
  }

  /* Expand sections */
  .section-padding {
    padding: 1rem 0;
  }

  /* Adjust images */
  img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }

  /* Page breaks */
  .page-hero,
  .site-footer {
    page-break-before: always;
  }
}

/* ============================================
   HIGH DPI DISPLAYS (Retina)
   ============================================ */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
  /* Use higher quality images for retina displays */
  .hero-section,
  .page-hero {
    background-size: cover;
  }
}

/* ============================================
   REDUCED MOTION PREFERENCE
   ============================================ */
@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;
  }

  .scroll-indicator {
    animation: none;
  }

  .floating-contact {
    animation: none;
  }

  .preloader-spinner {
    animation: none;
  }
}

/* ============================================
   DARK MODE SUPPORT (Optional)
   ============================================ */
@media (prefers-color-scheme: dark) {
  /* Uncomment if you want to add dark mode support */
  /*
  :root {
    --dark-color: #f8f9fa;
    --light-color: #212529;
    --white: #1a1a1a;
    --gray-100: #2d2d2d;
    --gray-200: #3a3a3a;
  }

  body {
    background-color: #1a1a1a;
    color: #e0e0e0;
  }

  .service-card,
  .product-card,
  .team-card,
  .testimonial-card {
    background-color: #2d2d2d;
    border-color: #3a3a3a;
  }
  */
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */
@media (hover: none) and (pointer: coarse) {
  /* Increase touch targets */
  .btn-primary-custom,
  .btn-secondary-custom,
  .btn-outline-custom,
  .nav-link,
  .dropdown-item {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Remove hover effects on touch devices */
  .service-card:hover,
  .product-card:hover,
  .team-card:hover {
    transform: none;
  }

  /* Disable hover-only interactions */
  .service-icon:hover {
    transform: none;
  }
}
