/* SEO and Core Web Vitals Optimizations */

/* Critical styles for above-the-fold content */
.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    contain: layout style paint;
    transform: translateZ(0);
}

/* Navigation alignment fixes */
.navbar {
    min-height: auto;
}

.navbar .container {
    align-items: center;
}

.navbar-nav {
    margin-bottom: 0;
}

.navbar-nav .nav-item {
    display: flex;
    align-items: center;
}

.navbar-toggler {
    border: none;
    padding: 0.25rem 0.5rem;
    line-height: 1;
}

.navbar-toggler:focus {
    box-shadow: none;
}

/* Ensure navbar button is properly aligned */
.navbar-nav .btn {
    white-space: nowrap;
    vertical-align: middle;
}

@media (max-width: 991.98px) {
    .navbar-collapse {
        text-align: center;
        margin-top: 1rem;
    }
    
    .navbar-nav .nav-item {
        width: 100%;
        justify-content: center;
    }
}

/* Breadcrumb styling */
.breadcrumb-nav {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.breadcrumb {
    font-size: 0.875rem;
    margin-bottom: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: ">";
    color: #6c757d;
}

/* Image aspect ratio preservation */
.qr-code-image {
    aspect-ratio: 1 / 1;
    object-fit: contain;
    max-width: 300px;
    height: auto;
}

/* QR Cubes Section Improvements */
.qr-cube-image img {
    width: 100%;
    max-width: 500px;
    height: auto;
    object-fit: cover;
    display: block;
    margin-left: auto;
    margin-right: auto;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.10);
}

.qr-cube-details {
    padding-right: 2.5rem;
    padding-left: 2.5rem;
}

@media (max-width: 991.98px) {
    .qr-cube-details {
        padding-right: 1rem;
        padding-left: 1rem;
        margin-top: 2rem;
    }
    .qr-cube-image img {
        max-width: 100%;
    }
}

@media (max-width: 575.98px) {
    .hero-section {
        padding-top: 100px;
        padding-bottom: 100px;
    }
    .d-flex.flex-column.flex-sm-row.gap-3 {
        flex-direction: column;
    }
    
    .d-flex.flex-column.flex-sm-row.gap-3 > * {
        margin-right: 0;
        margin-bottom: 1rem;
    }
    
    .d-flex.flex-column.flex-sm-row.gap-3 > *:last-child {
        margin-bottom: 0;
    }
}

/* WebP background image optimization with loading states */
.hero-background {
    background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)), 
                url('../images/restaurant-bg.webp') center center/cover no-repeat;
    will-change: transform;
    transform: translateZ(0);
    /* Add loading placeholder */
    background-color: #1a1a1a;
    /* Force background to load immediately */
    contain: layout style paint;
}

.hero-background.loaded {
    animation: fadeInBg 0.3s ease-in-out;
}

@keyframes fadeInBg {
    from {
        opacity: 0.7;
    }
    to {
        opacity: 1;
    }
}

/* Optimize hero section for LCP */
.hero-section {
    contain: layout style paint;
    transform: translateZ(0);
}

/* Performance optimizations */
.feature-card,
.pricing-card {
    will-change: transform;
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* Reduce layout shift */
.icon-emoji {
    display: inline-block;
    width: 1.2em;
    height: 1.2em;
    text-align: center;
}

/* Focus improvements for accessibility/SEO */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
}

.skip-link:focus {
    top: 6px;
}

/* Preload critical fonts */
@font-face {
    font-family: 'System Font';
    src: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-display: swap;
}

/* Critical CSS for Core Web Vitals */
.container {
    max-width: 1320px;
}

/* Reduce CLS (Cumulative Layout Shift) */
.row {
    --bs-gutter-x: 1.5rem;
    --bs-gutter-y: 0;
    display: flex;
    flex-wrap: wrap;
    margin-top: calc(-1 * var(--bs-gutter-y));
    margin-right: calc(-.5 * var(--bs-gutter-x));
    margin-left: calc(-.5 * var(--bs-gutter-x));
}

/* Smooth scrolling for anchor links */
html {
    scroll-behavior: smooth;
}

/* Loading states */
.loading-placeholder {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Contact form optimizations */
.contact-form {
    contain: layout style;
}

.product-option {
    cursor: pointer;
    transition: all 0.2s ease;
    transform: translateZ(0);
}

.product-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Error page optimizations */
.error-page {
    contain: layout style paint;
}

/* Schema.org microdata styling */
[itemscope] {
    position: relative;
}

/* Print styles for SEO */
@media print {
    .breadcrumb-nav,
    .hero-background,
    .btn,
    .contact-form {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    h1, h2, h3 {
        page-break-after: avoid;
    }
}

.breadcrumb-home {
    font-size: 0.85rem;
    color: #fff;
    margin-bottom: 1rem;
    opacity: 0.85;
}

/* Contact form row spacing improvements - more compact */
.contact-form .row > .col-12 {
    margin-bottom: 1rem;
}

.contact-form .row > .col-md-6 {
    margin-bottom: 1rem;
}

/* Special spacing for step sections */
.contact-form .col-12:has(.form-label:contains("Korak")) {
    margin-bottom: 0.75rem;
}

/* Reduced spacing for form step sections */
.contact-form #appTierConfig {
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

/* Specific styling for step labels to reduce top spacing */
.contact-form .form-label {
    margin-bottom: 0.75rem;
    margin-top: 0;
}

/* First step label - reduce top margin */
.contact-form .col-12:first-child .form-label {
    margin-top: 0;
}

/* Add spacing before contact information section */
.contact-form .col-md-6:first-of-type {
    margin-top: 1rem;
}

/* Additional spacing for product options */
.product-option {
    margin-bottom: 1rem;
}

/* Spacing for terms and submit button */
.contact-form .form-check {
    margin-top: 0;
    margin-bottom: 1rem;
}

/* Button spacing fixes */
.d-flex.gap-3 > * {
    margin-right: 1rem;
}

.d-flex.gap-3 > *:last-child {
    margin-right: 0;
}

/* Cubes Configuration Fixes */
.cubes-configuration {
    margin-bottom: 1rem;
}

.cubes-configuration .row {
    align-items: end;
}

.cubes-configuration .col-md-6 {
    display: flex;
    flex-direction: column;
}

.cubes-configuration .form-select,
.cubes-configuration .form-control {
    height: calc(2.25rem + 2px);
}

/* Ensure proper spacing in cube config */
#cubesConfig {
    margin-top: 1rem;
    margin-bottom: 1rem;
}

#cubesConfig h6 {
    margin-bottom: 0.75rem;
}

/* Form validation state improvements */
.form-text.text-muted {
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.invalid-feedback,
.valid-feedback {
    font-size: 0.875rem;
    margin-top: 0.25rem;
}