:root {
    --primary: #7c3aed;
    --primary-dark: #6d28d9;
    --primary-light: #8b5cf6;
    --secondary: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #111827;
    --gray-50: #f9fafb;
    --gray-100: #f9fafb;
    --gray-200: #f3f4f6;
    --gray-300: #e5e7eb;
    --gray-400: #d1d5db;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    --radius: 0.75rem;
    --radius-lg: 1rem;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* CRITICAL: Prevent scroll bouncing at page boundaries */
html {
    overscroll-behavior: none;
    overscroll-behavior-y: none;
    scroll-behavior: auto;
    scroll-snap-type: none;
}

body {
    font-family: 'Inter', 'Noto Sans Arabic', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--gray-900);
    background-color: var(--gray-50);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    /* CRITICAL: Scroll boundary fixes */
    overscroll-behavior: none;
    overscroll-behavior-y: none;
    padding-bottom: 1px;
    -webkit-overflow-scrolling: auto;
    /* Add top margin for fixed header */
    margin-top: 80px;
    position: relative;
}

    /* Add invisible buffer at bottom to prevent exact boundary detection */
    body::after {
        content: '';
        display: block;
        height: 1px;
        width: 100%;
        visibility: hidden;
    }

/* CRITICAL: Disable all animations when at scroll boundary */
.at-scroll-boundary * {
    transition: none !important;
    animation: none !important;
    transform: none !important;
}

.at-scroll-boundary .navbar {
    transform: none !important;
    will-change: auto !important;
}

.at-scroll-boundary .main-footer {
    transform: none !important;
    will-change: auto !important;
}

* {
    box-sizing: border-box;
    overscroll-behavior: none;
}

.container {
    max-width: 100%;
    padding-left: 15px;
    padding-right: 15px;
    box-sizing: border-box;
}

/* RTL Support */
[dir="rtl"] body {
    font-family: 'Noto Sans Arabic', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}





.hero-section h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    position: relative;
}

.hero-section p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

/* Modern Search Input */
.search-group {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.search-input-wrapper {
    background: white;
    border-radius: 100px;
    padding: 0.5rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

    .search-input-wrapper:focus-within {
        transform: translateY(-2px);
        box-shadow: var(--shadow-xl);
    }

.search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    color: var(--dark);
    background: transparent;
}

.search-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 100px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

    .search-btn:hover:not(:disabled) {
        background: var(--primary-dark);
    }

    .search-btn:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

/* Website Logos Section */
.websites-section {
    padding: 3rem 0;
    text-align: center;
}

.websites-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2rem;
    margin-top: 2rem;
}

.website-item {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
}

    .website-item:hover {
        transform: translateY(-5px) scale(1.05);
        box-shadow: var(--shadow-lg);
    }

    .website-item img {
        max-width: 80px;
        max-height: 80px;
        object-fit: contain;
    }

/* How It Works Section */
.how-it-works {
    background: var(--gray-100);
    padding: 3rem 0;
    text-align: center;
    position: relative;
    overflow: hidden;
    contain: layout style;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
    contain: layout;
    grid-auto-rows: minmax(auto, 1fr);
}

.step-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    /* FIXED: Stable transform to prevent jitter */
    transform: translateZ(0);
    backface-visibility: hidden;
    /* FIXED: Only animate shadow, no transforms */
    transition: box-shadow 0.3s ease;
}

    .step-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 4px;
        background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    }

    /* FIXED: Remove translateY transform that causes scroll jitter */
    .step-card:hover {
        box-shadow: var(--shadow-lg);
        /* transform: translateY(-5px); REMOVED */
    }

.step-number {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 auto 1rem;
}

/* Search Results */
.results-header {
    padding: 2rem 0 1rem;
    text-align: center;
}

    .results-header h2 {
        font-size: 1.2rem;
        font-weight: 700;
        margin-bottom: 0.5rem;
    }

/* Website Status Cards */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.status-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

    .status-card:hover {
        box-shadow: var(--shadow);
    }

.status-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

    .status-header img {
        width: 24px;
        height: 24px;
        object-fit: contain;
    }

.status-badge {
    margin-left: auto;
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.875rem;
    font-weight: 500;
}

    .status-badge.complete {
        background: var(--success);
        color: white;
    }

    .status-badge.searching {
        background: var(--warning);
        color: white;
    }

    .status-badge.pending {
        background: var(--gray-400);
        color: white;
    }

/* Filters Section */
.filters-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.filters-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: center;
}

.filter-select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: white;
    color: var(--dark);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

    .filter-select:focus {
        outline: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
    }

/* Product Cards */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.product-card {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    height: 100%;
}

    .product-card:hover {
        transform: translateY(-5px);
        box-shadow: var(--shadow-lg);
    }

.product-image-wrapper {
    position: relative;
    background: var(--gray-100);
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.product-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.discount-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--danger);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.875rem;
}

.product-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 3rem;
    text-align: center;
}

.product-price {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    justify-content: center;
}

.price-current {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.price-original {
    font-size: 1rem;
    color: var(--gray-500);
    text-decoration: line-through;
}

.product-website {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-bottom: 1rem;
    justify-content: center;
}

    .product-website img {
        width: 20px;
        height: 20px;
        object-fit: contain;
    }

.product-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

.btn-view {
    flex: 1;
    background: var(--primary);
    color: white;
    text-decoration: none;
    padding: 0.75rem;
    border-radius: var(--radius);
    font-weight: 600;
    text-align: center;
    transition: var(--transition);
}

    .btn-view:hover {
        background: var(--primary-dark);
        color: white;
    }

.btn-copy {
    background: var(--gray-200);
    color: var(--gray-700);
    border: none;
    padding: 0.75rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

    .btn-copy:hover {
        background: var(--gray-300);
    }

/* Toast Message */
.toast-notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--dark);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transform: translateY(100px);
    opacity: 0;
    transition: var(--transition);
    z-index: 1050;
}

    .toast-notification.show {
        transform: translateY(0);
        opacity: 1;
    }

/* MAIN CONTENT */
main {
    position: relative;
    z-index: 1;
    overscroll-behavior: none;
    padding-bottom: 2px;
    margin-bottom: -2px;
    min-height: calc(100vh - 160px);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    body {
        margin-top: 60px;
        overscroll-behavior: none !important;
        -webkit-overflow-scrolling: auto !important;
    }

    .hero-section {
        padding: 2rem 0;
    }



    .search-input-wrapper {
        flex-direction: column;
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .search-input,
    .search-btn {
        width: 100%;
        justify-content: center;
    }

    .search-input {
        padding: 0.6rem 1rem;
        font-size: 16px;
    }

    .search-btn {
        padding: 0.6rem 1rem;
        font-size: 16px;
    }

    /* Compact results header on mobile */
    .results-header {
        padding: 1rem 0 0.5rem;
    }

        .results-header h2 {
            font-size: 1.5rem;
            margin-bottom: 0.25rem;
        }

        .results-header p {
            font-size: 0.875rem;
            margin-bottom: 1rem;
        }

    /* Compact status grid on mobile */
    .status-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .status-card {
        padding: 0.5rem;
    }

    .status-header {
        flex-wrap: wrap;
        gap: 0.1rem;
    }

        .status-header h6 {
            font-size: 0.875rem;
        }

    .status-badge {
        font-size: 0.50rem;
        padding: 0.2rem 0.5rem;
    }

    /* Sections spacing */
    .websites-section {
        padding: 2rem 0;
    }

    .how-it-works {
        padding: 2rem 0;
    }

        .websites-section h2,
        .how-it-works h2 {
            font-size: 1.5rem;
            margin-bottom: 1.5rem;
        }

    .websites-grid {
        gap: 0.75rem;
    }

    .website-item {
        width: 80px;
        height: 80px;
        padding: 0.75rem;
    }

        .website-item img {
            max-width: 60px;
            max-height: 60px;
        }

    /* 2-column product grid on mobile */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .product-card {
        font-size: 0.875rem;
    }

    .product-image-wrapper {
        height: 150px;
    }

    .product-content {
        padding: 1rem;
    }

    .product-title {
        font-size: 0.875rem;
        min-height: 2.5rem;
        -webkit-line-clamp: 2;
    }

    .price-current {
        font-size: 1rem;
    }

    .price-original {
        font-size: 0.875rem;
    }

    .product-website {
        font-size: 0.75rem;
    }

        .product-website img {
            width: 16px;
            height: 16px;
        }

    .btn-view {
        padding: 0.5rem;
        font-size: 0.875rem;
    }

    .btn-copy {
        padding: 0.5rem;
    }

    .filters-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .filters-wrapper {
        flex-direction: row;
        gap: 0.5rem;
    }

    .filter-select {
        width: auto;
        flex: 1;
        padding: 0.4rem 0.75rem;
        font-size: 16px;
    }

    .toast-notification {
        right: 1rem;
        left: 1rem;
        bottom: 1rem;
        font-size: 0.875rem;
        padding: 0.75rem 1rem;
    }

    /* Steps cards */
    .steps-grid {
        gap: 1rem;
        grid-template-columns: 1fr;
    }

    .step-card {
        padding: 1.5rem;
    }

    .step-number {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }

    .step-card h5 {
        font-size: 1rem;
    }

    .step-card p {
        font-size: 0.875rem;
    }

    .text-success {
        font-size: 0.7rem;
    }
}

/* WEBKIT SPECIFIC: Prevent elastic scrolling issues */
@supports (-webkit-overflow-scrolling: touch) {
    html, body {
        -webkit-overflow-scrolling: auto !important;
    }
}

/* FIREFOX SPECIFIC: Prevent scroll boundary issues */
@-moz-document url-prefix() {
    html {
        scroll-behavior: auto !important;
    }
}

/* Additional mobile overscroll prevention */
@media (max-width: 768px) {
    html, body {
        overscroll-behavior: none !important;
        overscroll-behavior-y: none !important;
        -webkit-overflow-scrolling: auto !important;
    }

    /* Prevent mobile bounce at bottom */
    body {
        padding-bottom: env(safe-area-inset-bottom, 10px);
        margin-bottom: calc(-1 * env(safe-area-inset-bottom, 10px));
    }
}

/* RTL Specific */
[dir="rtl"] {
    text-align: right;
}

    [dir="rtl"] .product-actions {
        flex-direction: row-reverse;
    }

/* Loading Animation */
.spinner-modern {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

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

/* Modern Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 5px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: var(--gray-500);
    }

/* CRITICAL: Optimize for scroll performance */
@media (prefers-reduced-motion: reduce) {
    .step-card,
    .website-item,
    .product-card {
        transition: none !important;
        transform: none !important;
    }

        .step-card:hover,
        .website-item:hover,
        .product-card:hover {
            transform: none !important;
        }
}


.search-container-overlap {
    margin-top: -4rem; /* Pull up into the hero section */
    position: relative;
    z-index: 10; /* Ensure it sits above other content */
    margin-bottom: 2rem;
}

/* Ensure proper spacing on mobile */
@media (max-width: 768px) {
    .search-container-overlap {
        margin-top: -3rem;
    }
    /* Ensure hero has enough padding at bottom for the overlap */
    .hero-section {
        padding-bottom: 4rem !important;
    }
}