/* AutoPartsX Comprehensive Rendering Fixes */

/* ===================================
   CSS Reset & Base Fixes
   =================================== */

/* Box Sizing Fix */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* HTML & Body Base Fixes */
html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    min-height: 100vh;
    line-height: 1.6;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #1f2937;
    background-color: #f9fafb;
}

/* ===================================
   Layout Fixes
   =================================== */

/* Main Content Spacing */
main {
    padding-top: 4rem;
    min-height: calc(100vh - 4rem);
}

@media (min-width: 768px) {
    main {
        margin-left: 0;
    }
}

/* Container Fixes */
.container,
.max-w-7xl,
.max-w-6xl,
.max-w-5xl {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* ===================================
   Navigation Rendering Fixes
   =================================== */

/* Fixed Navigation */
nav.fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Sidebar Rendering */
#sidebar {
    position: fixed;
    left: 0;
    top: 4rem;
    height: calc(100vh - 4rem);
    width: 18rem;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    z-index: 900;
}

@media (min-width: 768px) {
    #sidebar {
        transform: translateX(0);
    }
}

#sidebar.open {
    transform: translateX(0);
}

/* ===================================
   Typography Rendering Fixes
   =================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.2;
    color: #111827;
    margin-bottom: 0.5rem;
}

h1 {
    font-size: 2.25rem;
}

h2 {
    font-size: 1.875rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

h5 {
    font-size: 1.125rem;
}

h6 {
    font-size: 1rem;
}

p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

/* ===================================
   Card & Container Rendering Fixes
   =================================== */

/* Glass Effect Enhancement */
.glass-effect {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.1) !important;
}

/* Card Rendering */
.card,
.step-card,
.content-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(229, 231, 235, 0.5);
}

/* ===================================
   Button Rendering Fixes
   =================================== */

button,
.btn,
.action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    white-space: nowrap;
}

button:focus,
.btn:focus,
.action-button:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
}

/* ===================================
   Form Element Rendering Fixes
   =================================== */

input,
textarea,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #1f2937;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ===================================
   Grid & Flexbox Rendering Fixes
   =================================== */

.grid {
    display: grid;
    gap: 1rem;
}

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

.grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

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

.grid-cols-6 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.flex {
    display: flex;
}

.flex-row {
    flex-direction: row;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.items-start {
    align-items: flex-start;
}

.items-end {
    align-items: flex-end;
}

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

.justify-between {
    justify-content: space-between;
}

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

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

/* ===================================
   Image Rendering Fixes
   =================================== */

img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 0.5rem;
}

svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* ===================================
   Icon Rendering Fixes
   =================================== */

i.fas,
i.far,
i.fab {
    display: inline-block;
    vertical-align: middle;
    line-height: 1;
}

/* ===================================
   Progress & Step Indicator Fixes
   =================================== */

.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 2;
}

.step-indicator.active {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
    transform: scale(1.1);
}

.step-indicator.completed {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.step-indicator.pending {
    background: #f3f4f6;
    color: #6b7280;
    border: 2px solid #e5e7eb;
}

/* Progress Connector */
.step-connector {
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.step-connector.completed {
    background: linear-gradient(90deg, #10b981, #059669);
}

.step-connector.active {
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
}

/* ===================================
   Scrollbar Rendering Fixes
   =================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
}

/* Firefox Scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: #3b82f6 #f1f5f9;
}

/* ===================================
   Animation & Transition Fixes
   =================================== */

.animate-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-up {
    animation: slideUp 0.6s ease-out forwards;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Smooth Transitions */
.transition {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.transition-colors {
    transition: color 0.3s, background-color 0.3s, border-color 0.3s;
}

.transition-transform {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===================================
   Shadow Rendering Fixes
   =================================== */

.shadow-sm {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.shadow {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.shadow-md {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.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);
}

/* ===================================
   Responsive Design Fixes
   =================================== */

@media (max-width: 640px) {
    h1 {
        font-size: 1.875rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    .grid-cols-2 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }

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

    .grid-cols-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid-cols-6 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .step-indicator {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 0.875rem;
    }
}

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

    .grid-cols-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid-cols-6 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* ===================================
   Z-Index Management
   =================================== */

.z-0 {
    z-index: 0;
}

.z-10 {
    z-index: 10;
}

.z-20 {
    z-index: 20;
}

.z-30 {
    z-index: 30;
}

.z-40 {
    z-index: 40;
}

.z-50 {
    z-index: 50;
}

.-z-10 {
    z-index: -10;
}

/* ===================================
   Print Styles
   =================================== */

@media print {

    nav,
    #sidebar,
    .no-print {
        display: none !important;
    }

    main {
        padding-top: 0 !important;
        margin-left: 0 !important;
    }

    .glass-effect {
        background: white !important;
        box-shadow: none !important;
    }
}

/* ===================================
   Accessibility Enhancements
   =================================== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus Visible */
*:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===================================
   Browser-Specific Fixes
   =================================== */

/* Safari Fixes */
@supports (-webkit-appearance: none) {
    .glass-effect {
        -webkit-backdrop-filter: blur(20px);
    }
}

/* Firefox Fixes */
@-moz-document url-prefix() {
    .glass-effect {
        background: rgba(255, 255, 255, 0.98);
    }
}

/* Edge Fixes */
@supports (-ms-ime-align: auto) {
    .glass-effect {
        background: rgba(255, 255, 255, 0.98);
    }
}

/* ===================================
   Performance Optimizations
   =================================== */

.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* ===================================
   Dark Mode Support (Future)
   =================================== */

@media (prefers-color-scheme: dark) {
    body {
        background-color: #111827;
        color: #f9fafb;
    }

    .glass-effect {
        background: rgba(17, 24, 39, 0.95);
        border-color: rgba(75, 85, 99, 0.3);
    }
}