/* Layout Fixes for Better Spacing and No Overlapping */

/* Ensure proper section spacing */
section {
    position: relative;
    clear: both;
}

/* Prevent overlapping sections */
#builder {
    overflow: visible;
}

/* Sticky preview on desktop */
@media (min-width: 1024px) {
    .lg\:sticky {
        position: sticky;
        top: 6rem;
        max-height: calc(100vh - 8rem);
        overflow-y: auto;
    }
}

/* Smooth scrolling for sticky elements */
.lg\:sticky {
    scroll-behavior: smooth;
}

/* Better spacing for mobile */
@media (max-width: 767px) {
    section {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }
}

/* Prevent content overflow */
.rounded-2xl,
.rounded-xl {
    overflow: hidden;
}

/* Better textarea sizing */
textarea {
    min-height: 80px;
    max-height: 200px;
}

/* Ensure proper z-index stacking */
header {
    z-index: 50;
}

.fixed {
    z-index: 40;
}

/* Better card shadows */
.shadow-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.shadow-xl {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.shadow-2xl {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Smooth transitions */
* {
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Better button spacing */
button {
    white-space: nowrap;
}

/* Grid gap consistency */
.grid {
    gap: inherit;
}

/* Prevent layout shift */
img,
svg {
    display: block;
}

/* Better form spacing */
form > div {
    margin-bottom: 1.5rem;
}

/* Ensure proper container width */
.max-w-7xl {
    max-width: 80rem;
}

.max-w-4xl {
    max-width: 56rem;
}

/* Better responsive padding */
@media (min-width: 640px) {
    .sm\:px-6 {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .lg\:px-8 {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* Fix for overlapping modals */
.fixed.inset-0 {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

/* Better card hover effects */
.hover\:-translate-y-1:hover {
    transform: translateY(-0.25rem);
}

/* Ensure proper spacing between sections */
section + section {
    margin-top: 0;
}

/* Better grid alignment */
.grid-cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 768px) {
    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    .lg\:grid-cols-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 1280px) {
    .xl\:grid-cols-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* Better flex alignment */
.flex-col {
    display: flex;
    flex-direction: column;
}

.flex-grow {
    flex-grow: 1;
}

.justify-end {
    justify-content: flex-end;
}

/* Ensure proper card heights */
.h-full {
    height: 100%;
}

/* Better border styling */
.border-2 {
    border-width: 2px;
}

/* Smooth color transitions */
.transition-all {
    transition-property: all;
    transition-duration: 300ms;
}

/* Better focus states */
button:focus,
a:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

/* Prevent text overflow */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Better responsive text */
@media (max-width: 767px) {
    h1 {
        font-size: 2rem;
        line-height: 2.5rem;
    }
    
    h2 {
        font-size: 1.5rem;
        line-height: 2rem;
    }
    
    h3 {
        font-size: 1.25rem;
        line-height: 1.75rem;
    }
}

/* Ensure proper card spacing */
.bg-white {
    min-height: auto;
}

/* Better gradient backgrounds */
.bg-gradient-to-br {
    background-image: linear-gradient(to bottom right, var(--tw-gradient-stops));
}

/* Ensure proper icon sizing */
svg {
    flex-shrink: 0;
}

/* Better disabled state */
button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Better print styles */
@media print {
    section:not(#builder) {
        display: none !important;
    }
}
