/* Responsive Utilities and Breakpoints */

/* Breakpoint Variables */
:root {
    --breakpoint-xs: 480px;
    --breakpoint-sm: 768px;
    --breakpoint-md: 1024px;
    --breakpoint-lg: 1200px;
    --breakpoint-xl: 1400px;
}

/* Global responsive utilities */

/* Container responsive padding */
@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .container {
        padding: 0 20px;
    }
}

@media (min-width: 769px) {
    .container {
        padding: 0 30px;
    }
}

/* Typography responsive scaling */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
    
    h1, .h1 { font-size: 1.8rem; }
    h2, .h2 { font-size: 1.6rem; }
    h3, .h3 { font-size: 1.4rem; }
    h4, .h4 { font-size: 1.2rem; }
    h5, .h5 { font-size: 1.1rem; }
    h6, .h6 { font-size: 1rem; }
}

@media (min-width: 481px) and (max-width: 768px) {
    html {
        font-size: 15px;
    }
    
    h1, .h1 { font-size: 2.2rem; }
    h2, .h2 { font-size: 2rem; }
    h3, .h3 { font-size: 1.6rem; }
    h4, .h4 { font-size: 1.4rem; }
    h5, .h5 { font-size: 1.2rem; }
    h6, .h6 { font-size: 1rem; }
}

@media (min-width: 769px) {
    html {
        font-size: 16px;
    }
    
    h1, .h1 { font-size: 2.8rem; }
    h2, .h2 { font-size: 2.4rem; }
    h3, .h3 { font-size: 1.8rem; }
    h4, .h4 { font-size: 1.5rem; }
    h5, .h5 { font-size: 1.3rem; }
    h6, .h6 { font-size: 1.1rem; }
}

/* Responsive display utilities */
.hidden-xs { display: block; }
.hidden-sm { display: block; }
.hidden-md { display: block; }
.hidden-lg { display: block; }

@media (max-width: 480px) {
    .hidden-xs { display: none !important; }
    .show-xs { display: block !important; }
}

@media (max-width: 768px) {
    .hidden-sm { display: none !important; }
    .show-sm { display: block !important; }
}

@media (max-width: 1024px) {
    .hidden-md { display: none !important; }
    .show-md { display: block !important; }
}

@media (min-width: 1025px) {
    .hidden-lg { display: none !important; }
    .show-lg { display: block !important; }
}

/* Responsive text alignment */
@media (max-width: 768px) {
    .text-center-sm { text-align: center !important; }
    .text-left-sm { text-align: left !important; }
    .text-right-sm { text-align: right !important; }
}

@media (max-width: 480px) {
    .text-center-xs { text-align: center !important; }
    .text-left-xs { text-align: left !important; }
    .text-right-xs { text-align: right !important; }
}

/* Responsive spacing */
@media (max-width: 768px) {
    .mt-sm-0 { margin-top: 0 !important; }
    .mt-sm-1 { margin-top: 0.5rem !important; }
    .mt-sm-2 { margin-top: 1rem !important; }
    .mt-sm-3 { margin-top: 1.5rem !important; }
    .mt-sm-4 { margin-top: 2rem !important; }
    
    .mb-sm-0 { margin-bottom: 0 !important; }
    .mb-sm-1 { margin-bottom: 0.5rem !important; }
    .mb-sm-2 { margin-bottom: 1rem !important; }
    .mb-sm-3 { margin-bottom: 1.5rem !important; }
    .mb-sm-4 { margin-bottom: 2rem !important; }
    
    .pt-sm-0 { padding-top: 0 !important; }
    .pt-sm-1 { padding-top: 0.5rem !important; }
    .pt-sm-2 { padding-top: 1rem !important; }
    .pt-sm-3 { padding-top: 1.5rem !important; }
    .pt-sm-4 { padding-top: 2rem !important; }
    
    .pb-sm-0 { padding-bottom: 0 !important; }
    .pb-sm-1 { padding-bottom: 0.5rem !important; }
    .pb-sm-2 { padding-bottom: 1rem !important; }
    .pb-sm-3 { padding-bottom: 1.5rem !important; }
    .pb-sm-4 { padding-bottom: 2rem !important; }
}

@media (max-width: 480px) {
    .mt-xs-0 { margin-top: 0 !important; }
    .mt-xs-1 { margin-top: 0.5rem !important; }
    .mt-xs-2 { margin-top: 1rem !important; }
    .mt-xs-3 { margin-top: 1.5rem !important; }
    .mt-xs-4 { margin-top: 2rem !important; }
    
    .mb-xs-0 { margin-bottom: 0 !important; }
    .mb-xs-1 { margin-bottom: 0.5rem !important; }
    .mb-xs-2 { margin-bottom: 1rem !important; }
    .mb-xs-3 { margin-bottom: 1.5rem !important; }
    .mb-xs-4 { margin-bottom: 2rem !important; }
}

/* Responsive grid utilities */
.grid-responsive {
    display: grid;
    gap: 20px;
}

@media (min-width: 481px) {
    .grid-responsive {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 769px) {
    .grid-responsive {
        grid-template-columns: repeat(3, 1fr);
        gap: 25px;
    }
}

@media (min-width: 1025px) {
    .grid-responsive {
        grid-template-columns: repeat(4, 1fr);
        gap: 30px;
    }
}

/* Responsive flex utilities */
.flex-responsive {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

@media (min-width: 769px) {
    .flex-responsive {
        flex-direction: row;
        gap: 20px;
    }
}

/* Section padding responsive */
.section-padding-responsive {
    padding: 40px 0;
}

@media (min-width: 481px) {
    .section-padding-responsive {
        padding: 60px 0;
    }
}

@media (min-width: 769px) {
    .section-padding-responsive {
        padding: 80px 0;
    }
}

@media (min-width: 1025px) {
    .section-padding-responsive {
        padding: 100px 0;
    }
}

/* Image responsive utilities */
.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 card layouts */
.card-responsive {
    width: 100%;
    margin-bottom: 20px;
}

@media (min-width: 481px) {
    .card-responsive {
        width: calc(50% - 10px);
        display: inline-block;
        vertical-align: top;
        margin-right: 20px;
    }
    
    .card-responsive:nth-child(2n) {
        margin-right: 0;
    }
}

@media (min-width: 769px) {
    .card-responsive {
        width: calc(33.333% - 14px);
        margin-right: 20px;
    }
    
    .card-responsive:nth-child(2n) {
        margin-right: 20px;
    }
    
    .card-responsive:nth-child(3n) {
        margin-right: 0;
    }
}

/* Responsive button groups */
.btn-group-responsive {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.btn-group-responsive .btn {
    width: 100%;
    justify-content: center;
}

@media (min-width: 481px) {
    .btn-group-responsive {
        flex-direction: row;
        width: auto;
    }
    
    .btn-group-responsive .btn {
        width: auto;
        flex: 1;
        min-width: 150px;
    }
}

@media (min-width: 769px) {
    .btn-group-responsive {
        gap: 15px;
    }
    
    .btn-group-responsive .btn {
        flex: none;
        width: auto;
    }
}

/* Table responsive */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive table {
    min-width: 600px;
    width: 100%;
}

/* Form responsive */
.form-responsive .form-group {
    margin-bottom: 15px;
}

@media (min-width: 769px) {
    .form-responsive .form-group {
        margin-bottom: 20px;
    }
    
    .form-responsive .form-row {
        display: flex;
        gap: 20px;
    }
    
    .form-responsive .form-row .form-group {
        flex: 1;
    }
}

/* Navigation responsive improvements */
@media (max-width: 768px) {
    .nav-links {
        font-size: 0.9rem;
    }
    
    .nav-links a {
        padding: 10px 12px;
    }
}

@media (max-width: 480px) {
    .nav-links a {
        padding: 12px 8px;
        font-size: 0.85rem;
    }
}

/* Footer responsive improvements */
@media (max-width: 768px) {
    .footer-content {
        text-align: center;
    }
    
    .footer-section {
        margin-bottom: 30px;
    }
    
    .footer-section:last-child {
        margin-bottom: 0;
    }
}

/* Hero responsive improvements */
@media (max-width: 768px) {
    .hero {
        min-height: 70vh;
    }
}

@media (max-width: 480px) {
    .hero {
        min-height: 60vh;
    }
}

/* Service cards responsive stacking */
@media (max-width: 768px) {
    .services-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1025px) {
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Contact form responsive */
@media (max-width: 768px) {
    .contact-content {
        grid-template-columns: 1fr;
    }
    
    .contact-info {
        order: 2;
    }
    
    .contact-form {
        order: 1;
    }
}

/* Performance optimizations for mobile */
@media (max-width: 768px) {
    /* Reduce animation complexity on mobile */
    .service-card:hover {
        transform: translateY(-5px) !important;
    }
    
    /* Simplify shadows on mobile */
    .shadow-soft {
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }
    
    .shadow-medium {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    }
    
    /* Reduce border radius on very small screens */
    .rounded-lg {
        border-radius: var(--border-radius-medium);
    }
}

@media (max-width: 480px) {
    .rounded {
        border-radius: var(--border-radius-small);
    }
    
    .rounded-lg {
        border-radius: var(--border-radius-medium);
    }
}

/* Landscape phone specific */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: 90vh;
        padding: 60px 0 40px;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .section-padding-responsive {
        padding: 40px 0;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Optimize for retina displays */
    .logo-icon,
    .service-icon,
    .contact-icon {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}