/* Font Face Definitions */
@font-face {
    font-family: 'YekanBakh';
    src: url('../../fonts/Yekan Bakh Family/webfonts/woff2/YekanBakh-SemiBold.woff2') format('woff2'),
         url('../../fonts/Yekan Bakh Family/webfonts/woff/YekanBakh-SemiBold.woff') format('woff');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

/* Global Font Settings */
* {
    font-family: 'YekanBakh', Tahoma, sans-serif !important;
    font-weight: 600;
    letter-spacing: -0.5px;
}

/* Section Title Styles */
.section-title {
    color: #1E3E81;
    position: relative;
    display: inline-block;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 0;
    width: 100%;
    height: 6px;
    background-color: #1e3e811c;
    border-radius: 5px;
    /* Remove any animation */
    animation: none !important;
}

/* Section Separators */
.bajet-plus-section {
    background: #1f3f811c;
    padding: 40px 20px;
    border-right: 3px solid #1f3f81;
}

.bajet-proposal-section {
    background: #c5d82f24;
    padding: 40px 20px;
    border-right: 3px solid #ff7600;
}

.discount-stores-section {
    background: #1f3f811c;
    padding: 40px 0px;
    border-right: 3px solid #ea1c26;
}

.social-networks-section {
    background: #c5d82f24;
    padding: 40px 20px;
    border-right: 3px solid #7f025c;
}

/* Banner Link Styles */
.banner-link {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
}

.banner-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Apple-style Infinite Marquee for fam-gallery */
.fam-gallery {
    overflow: hidden;
    width: 100%;
    direction: rtl;
    box-shadow: none !important;
    max-width: none !important;
    position: relative;
    contain: content;
    will-change: transform;
    backface-visibility: hidden;
    transform: translateZ(0);
}
.fam-gallery-marquee {
    display: flex;
    width: max-content;
    min-width: 100%;
    animation: fam-marquee linear infinite;
    align-items: center;
    animation-duration: var(--marquee-duration, 32s) !important;
    will-change: transform;
    position: relative;
    backface-visibility: hidden;
    transform: translateZ(0);
}
.fam-gallery-marquee.manual-control {
    /* disable CSS marquee when user takes control */
    animation: none !important;
}
.fam-gallery.is-paused .fam-gallery-marquee {
    animation-play-state: paused !important;
}
.fam-gallery-item {
    flex: 0 0 auto;
    width: 320px;
    margin: 0 12px;
    position: relative;
    will-change: transform;
    backface-visibility: hidden;
    transform: translateZ(0);
    contain: layout style;
    pointer-events: none;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: none !important;
    background: none !important;
    transition: transform 0.2s;
    position: relative;
}

.fam-gallery-item .banner-link {
    display: block;
    width: 100%;
    pointer-events: auto;
    position: relative;
    z-index: 1;
}

.fam-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.fam-gallery-item:hover {
    transform: scale(1.04);
}
.fam-gallery-bg {
    width: 100%;
    height: 180px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
@media (max-width: 900px) {
    .fam-gallery-item { width: 240px; }
    .fam-gallery-bg { height: 120px; }
}
@media (max-width: 600px) {
    .fam-gallery-item { width: 180px; }
    .fam-gallery-bg { height: 80px; }
    .fam-gallery-marquee {
        animation-duration: 32s !important;
    }
    .section-title::after {
        bottom: 16px !important;
        height: 4px !important;
    }
}
@keyframes fam-marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(50%); }
}

/* Smooth transitions for manual control */
.fam-gallery-marquee.manual-control {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

/* Disable hover effects during drag */
.fam-gallery.is-dragging .fam-gallery-item {
    pointer-events: none;
}

/* Better touch handling */
.fam-gallery {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
}

/* Ensure smooth transitions for manual control */
.fam-gallery-marquee.manual-control {
    transition: transform 0.3s ease-out;
}
/* Only pause on hover for desktop devices */
@media (min-width: 769px) {
    .fam-gallery.is-paused:hover .fam-gallery-marquee {
        animation-play-state: paused !important;
    }
}

/* Controls and Progress Bar for fam-gallery */
.fam-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 4px;
    direction: ltr;
    justify-content: center;
    position: relative;
    z-index: 3;
    border-radius: 999px;
    backdrop-filter: saturate(120%) blur(6px);
    border: 1px solid rgba(0, 0, 0, 0.06);
    margin: auto;
    left: 0;
    right: 0;
    width: fit-content;
    bottom: 0px;
}

.fam-gallery-marquee, .fam-gallery.is-paused .fam-gallery-marquee {
    margin-bottom: 10px !important;
}

.fam-btn {
    appearance: none;
    border: 1px solid #e5e7eb;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #374151;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .12s ease;
    position: relative;
}

.fam-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.fam-btn:active {
    transform: scale(0.97);
}

.fam-btn:focus {
    outline: none;
}

.fam-btn svg {
    width: 16px;
    height: 16px;
    position: relative;
}

/* Special styling for play/pause button */
.fam-playpause {
    background: #ffffff;
    color: white;
    border-color:#e5e7eb;
}

.fam-playpause:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

/* Progress bar removed — intentionally disabled */
/* باجت پلاس - استایل‌های صفحه لندینگ */
/* بهینه‌شده برای زمان بارگذاری زیر ۱۰ میلی‌ثانیه و طراحی موبایل‌اول */

/* CSS Variables for theming */
:root {
    --primary-color: #1e40af;
    --primary-gradient: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    --secondary-color: #06b6d4;
    --accent-color: #10b981;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --bg-color: #ffffff;
    --bg-light: #f8fafc;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --border-radius: 8px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Background gradient animation */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Wave text animation */
@keyframes waveText {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
    
    0%, 100% { opacity: 0.9; }
    50% { opacity: 1; }
}

/* Reset and base styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'YekanBakh';
}

/* Font loading optimization */
@font-face {
    font-family: 'YekanBakh';
    font-display: swap;
    src: url('../../fonts/Yekan Bakh Family/webfonts/woff2/YekanBakh-Regular.woff2') format('woff2'),
         url('../../fonts/Yekan Bakh Family/ttf/YekanBakh-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'YekanBakh';
    font-display: swap;
    src: url('../../fonts/Yekan Bakh Family/webfonts/woff2/YekanBakh-SemiBold.woff2') format('woff2'),
         url('../../fonts/Yekan Bakh Family/ttf/YekanBakh-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
}

@font-face {
    font-family: 'YekanBakh';
    font-display: swap;
    src: url('../../fonts/Yekan Bakh Family/webfonts/woff2/YekanBakh-Bold.woff2') format('woff2'),
         url('../../fonts/Yekan Bakh Family/ttf/YekanBakh-Bold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
}

/* Main container */
.bajet-landing-page {
    font-family: 'YekanBakh', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    direction: rtl;
    color: var(--text-color);
    background: #ffffff;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
}

/* Section layouts */
.landing-section {
    padding-block: 10px;
    position: relative;
}

.section-container {
    max-width: 100% !important;
    margin: 0 auto;
    padding: 0 !important;
}

.section-title {
    min-height: 33px;
    font-size: 20px !important;
    font-weight: 700;
    text-align: center;
    margin: 10px;
    padding: 0 !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    line-height: 1.5;
    letter-spacing: 0.5px;
    display: block;
    position: relative;
    font-family: 'YekanBakh', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: all 0.3s ease;
    width: fit-content;
    display: block;
    margin: auto;
}

.section-title:hover {
    transform: translateY(-2px);
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Typing caret for section titles */
@keyframes caretBlink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}
.section-title.typing-active::before {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: var(--caret-width, 2px);
    height: 1.2em;
    animation: caretBlink 1s steps(1, end) infinite;
}
/* Place caret at the end of the text depending on direction */
html[dir="rtl"] .section-title.typing-active::before,
body.rtl .section-title.typing-active::before {
    left: -4px;
}
html[dir="ltr"] .section-title.typing-active::before,
body.ltr .section-title.typing-active::before {
    right: -4px;
}

@media (max-width: 600px) {
    .section-title {
        font-size: 13px !important;
    }
}


/* Banner styles */
.banner-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    border-radius: 22px 22px 0 0;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.banner-wrapper:hover {
    transform: translateY(-2px);
}

.banner-wrapper a {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
}

.banner-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
    object-fit: cover;
    border-radius: 22px 22px 0 0;
}

.wave-clipped {
    clip-path: url(#wave-clip-1);
}

.wave-clip-svg {
    position: absolute;
    width: 0;
    height: 0;
}

.banner-wrapper .banner-image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 22px 22px 0 0; /* only top corners rounded */
    position: relative;
    z-index: 1;
}

.wave-clipped {
    clip-path: url(#wave-clip);
}

.wave-clip-svg {
    position: absolute;
    width: 0;
    height: 0;
}

/* Banner Button Styles */
.banner-button {
    line-height: 1;
    text-decoration: none;
    display: block;
    border: none;
    cursor: pointer;
    background: none;
    padding: 0;
    width: 100%;
    text-align: inherit;
    font-family: inherit;
    transition: transform 0.2s ease;
}

.banner-button:hover {
    transform: scale(1.02);
}

.banner-button:focus {
    outline: 2px solid #1e40af;
    outline-offset: 2px;
}

.banner-button:active {
    transform: scale(0.98);
}


.banner-item:hover .banner-image {
    transform: scale(1.05);
}

.banner-content {
    padding: clamp(16px, 3vw, 20px);
}

.banner-title {
    font-size: clamp(16px, 3vw, 18px);
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 8px;
    line-height: 1.4;
}

.banner-description {
    font-size: clamp(14px, 2.5vw, 16px);
    color: var(--text-light);
    line-height: 1.5;
}

/* Lazy loading styles */
.banner-image.lazy {
    opacity: 0;
    transition: opacity 0.3s;
}

.banner-image.lazy-loaded {
    opacity: 1;
}

/* بخش باجت پلاس */
.bajet-plus-section .banner-grid {
    display: grid;
    place-items: center;
    margin: 0 auto;
    padding-top: 15px;
}

/* bajet Proposal Section */
.bajet-proposal-section .banner-grid {
    display: grid;
    gap: clamp(16px, 3vw, 24px);
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    padding-top: 15px;
}

/* Discount Stores Carousel Section */
.discount-stores-section {
    overflow: hidden;
}

.discount-stores-carousel {
    position: relative;
    max-width: 100%;
    margin: 0 auto;
}

.carousel-container {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius);
}

.carousel-track {
    display: flex;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.carousel-slide {
    flex: 0 0 100%;
    padding: 0 clamp(8px, 2vw, 12px);
}

/* Carousel Navigation */
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(8px);
}

.carousel-nav:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-50%) scale(1.1);
}

.carousel-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.carousel-prev {
    right: 12px;
}

.carousel-next {
    left: 12px;
}

.carousel-nav svg {
    width: 20px;
    height: 20px;
    fill: var(--primary-color);
}

/* Social Networks Section */
.social-networks-section .banner-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px 0 0;
    background: none !important;
}

/* Remove extra white div in social networks banner */
.social-networks-section .banner-image {
    background: none !important;
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin: 0 auto;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-on-scroll {
    opacity: 1;
    transition: var(--transition);
}

.animate-on-scroll.animated {
    animation: fadeInUp 0.6s ease-out forwards;
}

.animate-on-scroll.slide-in {
    animation: slideInRight 0.6s ease-out forwards;
}

/* Performance optimizations */
.banner-image,
.carousel-slide {
    contain: layout style paint;
}

.carousel-track {
    contain: layout style;
    transform: translateZ(0); /* Force GPU acceleration */
}

/* Responsive design - Mobile First */

/* Small screens (up to 480px) */
@media (max-width: 480px) {
    .section-container {
        padding: 0 12px;
    }

    .social-networks-section .banner-grid, .bajet-plus-section .banner-grid, .fam-gallery, .bajet-proposal-section .banner-grid {
        padding-top: 0;
    }
    
    .banner-image {
        height: 160px;
    }
    
    .bajet-proposal-section .banner-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .carousel-nav {
        width: 36px;
        height: 36px;
    }
    
    .carousel-nav svg {
        width: 16px;
        height: 16px;
    }
    
    .carousel-prev {
        right: 8px;
    }
    
    .carousel-next {
        left: 8px;
    }
}

/* Medium screens (481px to 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .bajet-proposal-section .banner-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }
    
    .banner-image {
        max-width: 700px !important;
        width: 100% !important;
        height: auto !important;
    }
}

/* Large screens (769px to 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .bajet-proposal-section .banner-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .banner-image {
        max-width: 700px !important;
        width: 100% !important;
        height: auto !important;
    }
}

/* Extra large screens (1025px and up) */
@media (min-width: 1025px) {
    .bajet-proposal-section .banner-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 900px;
        margin: 0 auto;
    }
    
    .carousel-slide {
        flex: 0 0 50%;
    }
    
    .banner-image {
        max-width: 700px !important;
        width: 100% !important;
        height: auto !important;
    }
}

/* Ultra-wide screens (1400px and up) */
@media (min-width: 1400px) {
    .carousel-slide {
        flex: 0 0 33.333%;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .banner-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .carousel-track {
        scroll-behavior: auto;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --text-color: #f9fafb;
        --text-light: #d1d5db;
        --bg-color: #1f2937;
        --bg-light: #111827;
        --border-color: #374151;
    }
    
    .carousel-nav {
        background: rgba(31, 41, 55, 0.9);
        color: #f9fafb;
    }
    
    .carousel-nav:hover {
        background: rgba(31, 41, 55, 1);
    }
}

/* Print styles */
@media print {
    .bajet-landing-page {
        background: white;
        color: black;
    }
    
    .carousel-nav,
    .animate-on-scroll {
        display: none;
    }
    
    .banner-item {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* Accessibility improvements */
.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 styles for keyboard navigation */
.banner-item:focus,
.carousel-nav:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Hover effects for touch devices */
@media (hover: none) and (pointer: coarse) {
    .banner-item:hover {
        transform: none;
    }
    
    .carousel-nav:hover {
        transform: translateY(-50%);
        background: rgba(255, 255, 255, 0.9);
    }
}

/* Loading states */
.banner-loading {
    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;
    }
}

/* Critical CSS inlined for performance */
.bajet-landing-page {
    visibility: visible;
    opacity: 1;
}

/* Error states */
.banner-error {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
    text-align: center;
    padding: 20px;
    border-radius: var(--border-radius);
}

.banner-error::before {
    content: '⚠️';
    display: block;
    font-size: 24px;
    margin-bottom: 8px;
}

.fam-gallery-marquee.manual-control {
    width: auto !important;
    place-content: center !important;
    margin: auto !important;
}

.fam-gallery-marquee.manual-control {
    animation: none !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translate3d(0, 0, 0); /* مقدار اولیه برای جلوگیری از پرش */
}
