/* How It Works Modern Section - Professional Design */

/* CSS Variables */
:root {
    --hiw-primary: var(--secondary-color, #667eea);
    --hiw-secondary: #764ba2;
    --hiw-accent: var(--primary-color, #764ba2);
    --hiw-dark: #1a202c;
    --hiw-light: #f7fafc;
    --hiw-white: #ffffff;
    --hiw-gray-100: #f7fafc;
    --hiw-gray-200: #edf2f7;
    --hiw-gray-300: #e2e8f0;
    --hiw-gray-600: #718096;
    --hiw-gray-700: #4a5568;
    --hiw-gray-800: #2d3748;
    --hiw-gray-900: #1a202c;
    --hiw-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12);
    --hiw-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --hiw-shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --hiw-shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);
    --hiw-shadow-2xl: 0 25px 50px rgba(0, 0, 0, 0.25);
    --hiw-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --hiw-transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}


/* تنسيقات الموجة (wave) */
.wave-container {
    width: 100%;
    height: 100px;
    line-height: 0;
    position: relative;
    z-index: 10;
    margin-top: -100px; /* لرفع الموجة للأعلى */
}

/* عكس الموجة عمودياً وتحديد موضعها */
.wave-divider {
    width: 100%;
    height: 100%;
    transform: scaleY(-1);
    transform-origin: bottom center;
}

/* تنسيقات القسم العلوي لإخفاء الجزء الزائد من الموجة */
.how-it-works-section {
    position: relative;
    overflow: hidden;
    padding-bottom: 0;
    /* استخدام المتغيرات في الخلفية */
    background: linear-gradient(to right, var(--hiw-accent), var(--hiw-secondary));
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --hiw-white: #1a202c;
        --hiw-light: #2d3748;
        --hiw-gray-100: #2d3748;
        --hiw-gray-200: #4a5568;
        --hiw-gray-300: #718096;
        --hiw-dark: #f7fafc;
        --hiw-gray-900: #f7fafc;
        --hiw-gray-800: #e2e8f0;
        --hiw-gray-700: #cbd5e0;
    }
}

/* Main Section */
.how-it-works-section {
    position: relative;
    padding: 120px 0;
    background: linear-gradient(135deg, var(--hiw-primary) 0%, var(--hiw-secondary) 100%);
    overflow: hidden;
}

/* Animated Background Grid */
.how-it-works-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
    opacity: 0.3;
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

/* Floating Background Elements */
.hiw-floating-elements {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.hiw-floating-shape {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    backdrop-filter: blur(10px);
    animation: float 6s ease-in-out infinite;
}

.hiw-floating-shape:nth-child(1) {
    width: 80px;
    height: 80px;
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.hiw-floating-shape:nth-child(2) {
    width: 120px;
    height: 120px;
    top: 60%;
    right: 15%;
    animation-delay: 2s;
}

.hiw-floating-shape:nth-child(3) {
    width: 60px;
    height: 60px;
    bottom: 30%;
    left: 20%;
    animation-delay: 4s;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

/* Section Header */
.hiw-header {
    text-align: center;
    margin-bottom: 80px;
    position: relative;
    z-index: 2;
}

.hiw-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 12px 24px;
    border-radius: 50px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 24px;
    transition: var(--hiw-transition);
}

.hiw-badge:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.hiw-badge svg {
    width: 16px;
    height: 16px;
    opacity: 0.9;
}

.hiw-title {
    font-size: 3.5rem;
    font-weight: 800;
    color: white;
    margin-bottom: 24px;
    line-height: 1.2;
    background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    0% { text-shadow: 0 0 20px rgba(255, 255, 255, 0.5); }
    100% { text-shadow: 0 0 30px rgba(255, 255, 255, 0.8); }
}

.hiw-subtitle {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Steps Container */
.hiw-steps-container {
    position: relative;
    z-index: 2;
}

.hiw-steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Individual Step Card */
.hiw-step {
    position: relative;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 40px 32px;
    transition: var(--hiw-transition);
    overflow: hidden;
    cursor: pointer;
}

.hiw-step::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--hiw-primary), var(--hiw-secondary));
    transform: scaleX(0);
    transition: var(--hiw-transition);
    transform-origin: left;
}

.hiw-step:hover::before {
    transform: scaleX(1);
}

.hiw-step:hover {
    transform: translateY(-8px);
    box-shadow: var(--hiw-shadow-2xl);
    background: rgba(255, 255, 255, 1);
}

/* Step Number */
.hiw-step-number {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--hiw-primary), var(--hiw-secondary));
    color: white;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 24px;
    box-shadow: var(--hiw-shadow-lg);
    transition: var(--hiw-transition);
}

.hiw-step-number::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    background: linear-gradient(135deg, var(--hiw-primary), var(--hiw-secondary));
    border-radius: 50%;
    z-index: -1;
    opacity: 0;
    transition: var(--hiw-transition);
}

.hiw-step:hover .hiw-step-number {
    transform: scale(1.1);
    box-shadow: var(--hiw-shadow-xl);
}

.hiw-step:hover .hiw-step-number::after {
    opacity: 0.3;
    transform: scale(1.2);
}

/* Step Icon */
.hiw-step-icon {
    position: absolute;
    top: 32px;
    right: 32px;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--hiw-accent), var(--hiw-secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    opacity: 0.8;
    transition: var(--hiw-transition);
}

.hiw-step:hover .hiw-step-icon {
    opacity: 1;
    transform: rotate(10deg) scale(1.1);
}

/* Step Content */
.hiw-step-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--hiw-gray-900);
    margin-bottom: 16px;
    line-height: 1.3;
    transition: var(--hiw-transition);
}

.hiw-step:hover .hiw-step-title {
    color: var(--hiw-primary);
}

.hiw-step-description {
    color: var(--hiw-gray-600);
    line-height: 1.6;
    font-size: 1rem;
    margin-bottom: 24px;
}

/* Step Features List */
.hiw-step-features {
    list-style: none;
    padding: 0;
    margin: 0;
}

.hiw-step-features li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    color: var(--hiw-gray-700);
    font-size: 0.9rem;
    transition: var(--hiw-transition);
}

.hiw-step-features li::before {
    content: '✓';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, var(--hiw-primary), var(--hiw-secondary));
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: bold;
    flex-shrink: 0;
}

.hiw-step:hover .hiw-step-features li {
    color: var(--hiw-gray-800);
}

/* Connection Lines (for larger screens) */
@media (min-width: 1024px) {
    .hiw-steps-grid {
        position: relative;
    }
    
    .hiw-steps-grid::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 0;
        right: 0;
        height: 2px;
        background: linear-gradient(90deg, 
            transparent 0%, 
            rgba(255, 255, 255, 0.3) 20%, 
            rgba(255, 255, 255, 0.3) 80%, 
            transparent 100%
        );
        z-index: 1;
        animation: connectionPulse 3s ease-in-out infinite;
    }
}

@keyframes connectionPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* Shimmer Effect */
@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.hiw-step::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    transition: var(--hiw-transition);
    opacity: 0;
}

.hiw-step:hover::after {
    animation: shimmer 1.5s ease-in-out;
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .hiw-steps-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 30px;
    }
}

@media (max-width: 768px) {
    .how-it-works-section {
        padding: 80px 0;
    }
    
    .hiw-title {
        font-size: 2.5rem;
    }
    
    .hiw-subtitle {
        font-size: 1.1rem;
    }
    
    .hiw-steps-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .hiw-step {
        padding: 32px 24px;
    }
    
    .hiw-step-icon {
        position: static;
        margin-bottom: 16px;
        align-self: flex-start;
    }
    
    .hiw-floating-shape {
        display: none;
    }
}

@media (max-width: 480px) {
    .hiw-title {
        font-size: 2rem;
    }
    
    .hiw-step {
        padding: 24px 20px;
    }
    
    .hiw-step-number {
        width: 60px;
        height: 60px;
        font-size: 1.25rem;
    }
    
    .hiw-badge {
        padding: 10px 20px;
        font-size: 12px;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .hiw-step {
        border: 2px solid var(--hiw-gray-300);
    }
    
    .hiw-step-title,
    .hiw-step-description {
        color: var(--hiw-gray-900);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .hiw-floating-shape,
    .hiw-title,
    .hiw-steps-grid::before {
        animation: none;
    }
    
    .hiw-step,
    .hiw-step-number,
    .hiw-step-icon {
        transition: none;
    }
}

/* Print Styles */
@media print {
    .how-it-works-section {
        background: white !important;
        padding: 40px 0;
    }
    
    .how-it-works-section::before,
    .hiw-floating-elements {
        display: none !important;
    }
    
    .hiw-step {
        background: white !important;
        border: 1px solid #ccc;
        box-shadow: none;
        break-inside: avoid;
        margin-bottom: 20px;
    }
    
    .hiw-title,
    .hiw-subtitle,
    .hiw-step-title,
    .hiw-step-description {
        color: black !important;
        text-shadow: none !important;
    }
    
    .hiw-badge {
        background: #f0f0f0 !important;
        color: black !important;
    }
}