/* Layout Fixes for All Pages - Margin, Padding & Responsive Issues */

/* Global Reset and Base Improvements */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Container Improvements */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* Header Spacing Fix */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: all 0.3s ease;
    height: 80px;
    display: flex;
    align-items: center;
}

/* Main Content Spacing */
.main-content {
    margin-top: 80px;
    min-height: calc(100vh - 80px);
    padding-bottom: 2rem;
}

/* Section Spacing Standardization */
section {
    padding: 80px 0;
    position: relative;
    overflow: hidden;
}

section:first-of-type {
    padding-top: 100px;
}

section:last-of-type {
    padding-bottom: 100px;
}

/* Hero Section Fixes */
.hero,
.contact-hero,
.about-hero,
.services-hero,
.privacy-hero,
.terms-hero {
    padding: 120px 0 80px;
    margin-top: 0;
    position: relative;
    overflow: hidden;
}

/* Card and Content Spacing */
.card {
    margin-bottom: 2rem;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    background: white;
    transition: all 0.3s ease;
    overflow: hidden;
}

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

/* Grid Spacing Improvements */
.services-grid,
.contact-grid,
.about-grid,
.locations-grid {
    display: grid;
    gap: 2rem;
    margin: 2rem 0;
}

.services-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.contact-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
}

.locations-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* Form Spacing */
.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.contact-form {
    padding: 2rem;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

/* Button Spacing */
.btn {
    margin: 0.5rem;
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-decoration: none;
    text-align: center;
    font-weight: 600;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 2rem;
}

/* Footer Spacing */
.footer {
    margin-top: 3rem;
    padding: 3rem 0 1rem;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section {
    padding: 1rem 0;
}

/* Text and Content Spacing */
.section-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 0 1rem;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.section-subtitle {
    font-size: 1.1rem;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Prevent Content Overlap */
.content-section {
    position: relative;
    z-index: 1;
    background: white;
    margin: 2rem 0;
    padding: 2rem;
    border-radius: 15px;
}

/* Map Container Fix */
.map-container {
    margin: 2rem 0;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.map-container iframe {
    width: 100%;
    height: 400px;
    border: 0;
    display: block;
}

/* Mobile Responsive Fixes */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    section {
        padding: 60px 0;
    }
    
    .hero,
    .contact-hero,
    .about-hero,
    .services-hero,
    .privacy-hero,
    .terms-hero {
        padding: 100px 0 60px;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .card {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 280px;
        margin: 0.5rem 0;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .nav {
        display: none;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    section {
        padding: 40px 0;
    }
    
    .hero,
    .contact-hero,
    .about-hero,
    .services-hero,
    .privacy-hero,
    .terms-hero {
        padding: 80px 0 40px;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .section-subtitle {
        font-size: 1rem;
    }
    
    .card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .contact-form {
        padding: 1.5rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .map-container iframe {
        height: 300px;
    }
    
    .header {
        height: 70px;
    }
    
    .main-content {
        margin-top: 70px;
    }
    
    .logo {
        font-size: 1.2rem;
    }
    
    .logo svg {
        width: 30px;
        height: 30px;
    }
}

/* Extra Small Devices */
@media (max-width: 320px) {
    .container {
        padding: 0 8px;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .card {
        padding: 0.8rem;
    }
    
    .contact-form {
        padding: 1rem;
    }
}

/* Prevent Horizontal Scroll */
body, html {
    max-width: 100%;
    overflow-x: hidden;
}

/* Fix for overlapping elements */
.section-overlap-fix {
    position: relative;
    z-index: 2;
    background: white;
    margin: -1px 0;
}

/* Smooth transitions for all elements */
* {
    transition: margin 0.3s ease, padding 0.3s ease;
}

/* Ensure proper stacking context */
.header {
    z-index: 1000;
}

.main-content {
    z-index: 1;
    position: relative;
}

.footer {
    z-index: 2;
    position: relative;
}

/* Fix for content touching edges */
.content-wrapper {
    padding: 1rem;
    margin: 1rem 0;
}

/* Improved spacing for lists */
ul, ol {
    padding-left: 1.5rem;
    margin: 1rem 0;
}

li {
    margin-bottom: 0.5rem;
}

/* Better paragraph spacing */
p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

p:last-child {
    margin-bottom: 0;
}

/* Heading spacing improvements */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 1rem;
    line-height: 1.3;
}

h1 { margin-bottom: 1.5rem; }
h2 { margin-bottom: 1.25rem; }
h3 { margin-bottom: 1rem; }

/* Image responsive and spacing */
img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem 0;
}

/* Table spacing */
table {
    width: 100%;
    margin: 1rem 0;
    border-collapse: collapse;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

/* Form element spacing */
input, textarea, select {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: inherit;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}