/* ========================================================================
   PREMIUM DESIGN FIXES - GLOBAL STYLESHEET
   Corrects display issues across all pages with fixed navbar
   ======================================================================== */

/* ========== NAVBAR COMPENSATION ========== */

/* Ensure all main content has proper spacing below fixed navbar */
main.content-wrapper {
    padding-top: 2rem !important;
    min-height: calc(100vh - 90px);
}

/* Exception: Homepage has full-screen hero, no padding needed */
main.premium-wrapper {
    padding-top: 0 !important;
}


/* ========== CONTAINER FIXES ========== */

/* Ensure containers have proper max-width and centering */
.container {
    max-width: 1320px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
}

/* ========== PAGE TITLES & HEADERS ========== */

/* Proper spacing for page titles */
h1, .h1 {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

h2, .h2 {
    margin-top: 1.25rem;
    margin-bottom: 1.25rem;
}

/* ========== CARDS & GRIDS ========== */

/* Ensure cards have consistent styling */
.card {
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

    .card:hover {
        transform: translateY(-4px);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    }

/* Grid gaps consistency */
.row-cols-1 > *,
.row-cols-2 > *,
.row-cols-3 > *,
.row-cols-4 > * {
    margin-bottom: 1.5rem;
}

/* ========== RESPONSIVE IMAGES ========== */

/* Product images maintain aspect ratio */
.card-img-top,
.ratio img {
    object-fit: cover;
    width: 100%;
    height: 100%;
}

/* ========== BUTTONS ========== */

/* Consistent button styling */
.btn {
    border-radius: 8px;
    font-weight: 600;
    padding: 0.625rem 1.5rem;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #4F8D40 0%, #5fa850 100%);
    border: none;
}

    .btn-primary:hover {
        background: linear-gradient(135deg, #5fa850 0%, #4F8D40 100%);
        transform: translateY(-2px);
        box-shadow: 0 4px 15px rgba(79, 141, 64, 0.3);
    }

.btn-secondary {
    background: white;
    border: #ffb61a 2px solid;
}

    .btn-secondary:hover {
        background: #ffb61a;
        transform: translateY(-2px);
        border: #ffb61a 2px solid;
    }

/* ========== FORMS ========== */

/* Form controls consistent styling */
.form-control,
.form-select {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 0.625rem 1rem;
    transition: all 0.3s ease;
}

    .form-control:focus,
    .form-select:focus {
        border-color: #4F8D40;
        box-shadow: 0 0 0 0.25rem rgba(79, 141, 64, 0.15);
    }

/* ========== PAGINATION ========== */

/* Pagination styling */
.pagination {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.page-link {
    border-radius: 8px;
    margin: 0 0.25rem;
    color: #4F8D40;
}

    .page-link:hover {
        background-color: #4F8D40;
        color: white;
    }

.page-item.active .page-link {
    background-color: #4F8D40;
    border-color: #4F8D40;
}

/* ========== SIDEBAR & FILTERS ========== */

/* Sidebar sticky on scroll */
aside {
    position: sticky;
    top: 110px;
    max-height: calc(100vh - 130px);
    overflow-y: auto;
}

    /* Filter cards */
    aside .card {
        margin-bottom: 1.5rem;
    }

    aside .list-group-item {
        border: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        padding: 0.75rem 1rem;
    }

        aside .list-group-item:last-child {
            border-bottom: none;
        }

/* ========== BREADCRUMBS ========== */

.breadcrumb {
    background: transparent;
    padding: 1rem 0;
    margin-bottom: 1rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    color: #6c757d;
}

/* ========== TABS ========== */

.nav-tabs {
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 2rem;
}

    .nav-tabs .nav-link {
        border: none;
        border-bottom: 3px solid transparent;
        color: #6c757d;
        font-weight: 600;
        padding: 1rem 1.5rem;
    }

        .nav-tabs .nav-link:hover {
            border-bottom-color: #4F8D40;
            color: #4F8D40;
        }

        .nav-tabs .nav-link.active {
            border-bottom-color: #4F8D40;
            color: #4F8D40;
            background: transparent;
        }

/* ========== MODAL & OFFCANVAS ========== */

/* Ensure modals are above navbar */
.modal {
    z-index: 1050;
}

.modal-backdrop {
    z-index: 1040;
}

.offcanvas {
    z-index: 1060;
}

/* ========== ALERTS & NOTIFICATIONS ========== */

.alert {
    border-radius: 12px;
    border-left: 4px solid;
    margin-bottom: 1.5rem;
}

.alert-success {
    border-left-color: #4F8D40;
    background-color: rgba(79, 141, 64, 0.1);
}

.alert-danger {
    border-left-color: #dc3545;
    background-color: rgba(220, 53, 69, 0.1);
}

.alert-warning {
    border-left-color: #EB8F25;
    background-color: rgba(235, 143, 37, 0.1);
}

.alert-info {
    border-left-color: #0dcaf0;
    background-color: rgba(13, 202, 240, 0.1);
}

/* ========== BADGES ========== */

.badge {
    font-weight: 600;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
}

.badge-success {
    background-color: #4F8D40;
}

.badge-warning {
    background-color: #EB8F25;
}

/* ========== TABLES ========== */

.table {
    border-radius: 12px;
    overflow: hidden;
}

    .table thead th {
        background-color: #f8f9fa;
        font-weight: 700;
        border-bottom: 2px solid #dee2e6;
        padding: 1rem;
    }

    .table tbody tr {
        transition: background-color 0.2s ease;
    }

        .table tbody tr:hover {
            background-color: rgba(79, 141, 64, 0.05);
        }

/* ========== PRODUCT CARDS ========== */

/* Product card hover effects */
.product-card,
.card.product {
    transition: all 0.3s ease;
    border-radius: 12px;
    overflow: hidden;
}

    .product-card:hover,
    .card.product:hover {
        transform: translateY(-4px);
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    }

    .product-card img,
    .card.product img {
        transition: transform 0.5s ease;
    }

    .product-card:hover img,
    .card.product:hover img {
        transform: scale(1.08);
    }

/* ========== BUSINESS CARDS ========== */

.business-card {
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    transition: all 0.4s ease;
}

    .business-card:hover {
        transform: translateY(-6px);
        box-shadow: 0 12px 35px rgba(0, 0, 0, 0.12);
    }

/* ========== SEARCH RESULTS ========== */

.search-result-item {
    padding: 1.5rem;
    border-bottom: 1px solid #dee2e6;
    transition: background-color 0.2s ease;
}

    .search-result-item:hover {
        background-color: #f8f9fa;
    }

/* ========== AUTH PAGES ========== */

/* Center auth forms */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 90px - 200px);
    padding: 3rem 0;
}

.auth-card {
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    padding: 2.5rem;
}

/* ========== ACCOUNT MANAGEMENT PAGES ========== */

.account-wrapper {
    padding-top: 2rem;
    padding-bottom: 3rem;
}

.account-sidebar {
    position: sticky;
    top: 110px;
}

/* ========== RESPONSIVE FIXES ========== */

/* Mobile adjustments */
@media (max-width: 991px) {
    /* Reduce top spacing on mobile */
    body {
        padding-top: 75px !important;
    }

    main.content-wrapper {
        padding-top: 1rem !important;
    }

    /* Sidebar not sticky on mobile */
    aside,
    .account-sidebar {
        position: relative;
        top: auto;
        max-height: none;
    }

    /* Cards stack better */
    .card {
        margin-bottom: 1rem;
    }
}

/* Tablet adjustments */
@media (min-width: 768px) and (max-width: 991px) {
    .container {
        max-width: 720px;
    }
}

/* Small mobile */
@media (max-width: 575px) {
    body {
        padding-top: 70px !important;
    }

    main.content-wrapper {
        padding-top: 0.75rem !important;
    }

    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    h1, .h1 {
        font-size: 1.75rem;
        margin-top: 1rem;
        margin-bottom: 1rem;
    }

    h2, .h2 {
        font-size: 1.5rem;
        margin-top: 0.875rem;
        margin-bottom: 0.875rem;
    }
}

/* ========== BLAZOR SSR PRERENDERING FIX FOR AOS ========== */

/*
 * Fix for Blazor SSR: Elements with data-aos are visible by default
 * Only hide them for animation AFTER aos-initialized class is added
 * This prevents content from being invisible during prerendering
 */
[data-aos] {
    opacity: 1 !important;
    transform: none !important;
    visibility: visible !important;
}

.aos-initialized [data-aos] {
    opacity: 0;
    transform: translateY(30px);
    visibility: hidden;
}

[data-aos].aos-animate {
    opacity: 1 !important;
    transform: translateY(0) !important;
    visibility: visible !important;
}

/* Ensure sections and category cards are always visible */
.section-fade-in,
.category-card-premium,
.col[data-aos] {
    opacity: 1 !important;
    visibility: visible !important;
}

/* ========== HOMEPAGE HERO RESPONSIVE FIXES ========== */

/* Desktop: Full-height hero */
@media (min-width: 992px) {
    .hero-row {
        min-height: calc(100vh - 90px) !important;
        padding-top: 120px !important;
    }
}

/* Tablet: Reduced height */
@media (min-width: 768px) and (max-width: 991px) {
    .hero-row {
        min-height: 600px !important;
        padding-top: 80px !important;
        padding-bottom: 60px !important;
    }

    .premium-carousel-wrapper {
        margin-top: 2rem;
    }
}

/* Mobile: Compact stacked layout */
@media (max-width: 767px) {
    .hero-row {
        min-height: auto !important;
        padding-top: 40px !important;
        padding-bottom: 40px !important;
    }

    .hero-text-content {
        margin-bottom: 2rem;
    }

    .luxury-badge {
        font-size: 0.8rem;
        padding: 0.4rem 1rem;
    }

    .hero-title {
        font-size: 2.5rem !important;
        margin-bottom: 1.5rem !important;
    }

    .hero-stats {
        margin-bottom: 1.5rem !important;
    }

    .stat-row {
        margin-bottom: 0.75rem !important;
    }

    .stat-number-full {
        font-size: 1.5rem !important;
    }

    .stat-label {
        font-size: 0.9rem !important;
    }

    .lead {
        font-size: 1rem !important;
        margin-bottom: 1.5rem !important;
    }

    .premium-carousel-wrapper {
        margin-top: 1rem;
        max-width: 100%;
    }

    .scroll-indicator-premium {
        display: none;
    }
}

/* ========== SCROLL BEHAVIOR ========== */

/* Smooth scroll with offset for fixed header */
html {
    scroll-padding-top: 100px;
}

/* Anchor links compensation */
:target {
    scroll-margin-top: 110px;
}

/* ========== Z-INDEX HIERARCHY ========== */

/* Proper z-index stacking */
.navbar-premium {
    z-index: 1000;
}

.offcanvas {
    z-index: 1060;
}

.modal {
    z-index: 1070;
}

.modal-backdrop {
    z-index: 1065;
}

.back-to-top-premium {
    z-index: 999;
}

/* ========== LOADING STATES ========== */

/* Loading skeletons */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 8px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ========== UTILITY CLASSES ========== */

/* Add premium utility classes */
.text-premium-green {
    color: #4F8D40 !important;
}

.text-premium-orange {
    color: #EB8F25 !important;
}

.bg-premium-green {
    background-color: #4F8D40 !important;
}

.bg-premium-orange {
    background-color: #EB8F25 !important;
}

.border-premium-green {
    border-color: #4F8D40 !important;
}

/* Shadows */
.shadow-premium {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1) !important;
}

.shadow-premium-lg {
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.15) !important;
}

/* ========== CONTENT WRAPPER SPECIFIC FIXES ========== */

/* Products page specific */
.content-wrapper section.container:first-child {
    padding-top: 1.5rem;
}

/* Business details pages */
.business-wrapper {
    padding-top: 1.5rem;
}

/* Category pages */
.category-wrapper {
    padding-top: 1.5rem;
}

/* Static pages (about, contact, etc.) */
.static-page-wrapper {
    padding-top: 2rem;
    padding-bottom: 3rem;
}

/* ========== ACCOUNT PAGES SPECIFIC ========== */

/* Login, Register, etc. */
.account-page-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 90px - 300px);
    padding: 3rem 1rem;
}

.account-form-card {
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

/* Manage account pages */
.manage-wrapper {
    padding-top: 2rem;
    padding-bottom: 3rem;
}

/* ========== FOOTER SPACING ========== */

/* Ensure content doesn't get cut by footer */
main {
    margin-bottom: 0;
}

footer {
    margin-top: auto;
}

/* ========== FIX SPECIFIC CARTZILLA ELEMENTS ========== */

/* Animate underline effects */
.animate-underline {
    position: relative;
    text-decoration: none;
}

    .animate-underline::after {
        content: '';
        position: absolute;
        bottom: -2px;
        left: 0;
        width: 0;
        height: 2px;
        background: currentColor;
        transition: width 0.3s ease;
    }

    .animate-underline:hover::after {
        width: 100%;
    }

/* Hover effects */
.hover-effect-scale {
    transition: transform 0.3s ease;
}

    .hover-effect-scale:hover {
        transform: scale(1.03);
    }

.hover-effect-opacity {
    transition: opacity 0.3s ease;
}

    .hover-effect-opacity:hover {
        opacity: 0.9;
    }

/* ========== ACCESSIBILITY ========== */

/* Focus states */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible {
    outline: 3px solid rgba(79, 141, 64, 0.5);
    outline-offset: 2px;
}

/* Skip to main content for keyboard navigation */
.skip-to-main {
    position: absolute;
    top: -100px;
    left: 0;
    background: #4F8D40;
    color: white;
    padding: 0.75rem 1.5rem;
    z-index: 2000;
    transition: top 0.3s ease;
}

    .skip-to-main:focus {
        top: 0;
    }

/* ========== PRINT STYLES ========== */

@media print {
    .navbar-premium,
    footer,
    .back-to-top-premium,
    aside {
        display: none !important;
    }

    body {
        padding-top: 0 !important;
    }

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

/* ========== DARK MODE SUPPORT (Future) ========== */

@media (prefers-color-scheme: dark) {
    /* Placeholder for future dark mode support */
}

/* ========== ANIMATIONS ========== */

/* Fade in animation for page content */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

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

/* Slide in from right */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

.slide-in-right {
    animation: slideInRight 0.4s ease-out;
}

/* ========== PERFORMANCE OPTIMIZATIONS ========== */

/* GPU acceleration for transforms */
.card,
.btn,
.product-card,
.business-card {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
