/* Container */
.sf-timeline-wrapper {
    position: relative;
    padding: 60px 0;
    max-width: 1200px;
    margin: 0 auto;
    overflow: hidden;
}

/* --- The Center Line --- */
.sf-center-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    transform: translateX(-50%);
    width: 10px; /* Elementor control will override */
    height: 100%;
    z-index: 1;
    /* 3D pipe effect defaults - can be controlled via Elementor */
    border-radius: 10px;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
}

.sf-line-bg {
    width: 100%;
    height: 100%;
    background-color: #E5E7EB;
    position: absolute;
    top: 0;
    left: 0;
    border-radius: inherit;
}

.sf-line-fill {
    width: 100%;
    height: 0%;
    background-color: #D4AF37;
    position: absolute;
    top: 0;
    left: 0;
    transition: height 0.1s linear;
    border-radius: inherit;
}

/* --- Item Structure & Animation --- */
.sf-timeline-item {
    position: relative;
    width: 50%;
    padding: 20px 50px; /* Space for connector */
    box-sizing: border-box;
    z-index: 2;
    
    /* NEW: Zoom/Pop Animation State 1 (Hidden) */
    opacity: 0;
    transform: scale(0.8) translateY(50px);
    transition: opacity 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* State 2 (Visible/Active) */
.sf-timeline-item.in-view {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Layout */
.left-item { 
    left: 0; 
    text-align: left; /* Set left alignment by default */
}

.right-item { 
    left: 50%; 
    text-align: left; /* Set left alignment by default */
}

/* --- The Center Icons (Dots) --- */
.sf-timeline-dot {
    position: absolute;
    top: 30px;
    /* Size controlled by Elementor */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Default colors - will be overridden by Elementor controls with !important */
    background: #F3F4F6;
    border: 3px solid #E5E7EB;
    z-index: 5;
    transition: all 0.4s ease;
    box-shadow: 0 0 0 4px rgba(255,255,255,0.7); /* White halo */
}

/* Icon inside the dot */
.sf-dot-icon {
    /* Default color - will be overridden by Elementor controls with !important */
    color: #999999;
    transition: all 0.4s ease;
    font-size: 16px; /* Default icon size */
}

/* ACTIVE STATE (When line hits it) */
.sf-timeline-dot.active {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.4); /* Glow effect */
}

/* --- Card Styling --- */
.sf-card-inner {
    position: relative;
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08); /* Modern Shadow */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(0,0,0,0.03);
}

.sf-card-inner:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
}

/* Connector Line (The little stick) */
.sf-card-inner::before {
    content: '';
    position: absolute;
    top: 30px;
    width: 20px;
    height: 2px;
    background: #D4AF37;
    opacity: 0.5;
}

.left-item .sf-card-inner::before {
    right: -20px;
}
.right-item .sf-card-inner::before {
    left: -20px;
}

/* FIXED: Date Badge - Wrapper for proper alignment */
.sf-date-badge-wrapper {
    width: 100%;
    text-align: left; /* Default - can be controlled by Elementor */
    margin-bottom: 15px;
}

.sf-date-badge {
    display: inline-block;
    padding: 5px 15px;
    background: #D4AF37;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    border-radius: 50px;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 10px rgba(212, 175, 55, 0.3);
}

/* Date Badge Active State */
.sf-date-badge {
    transition: background-color 0.4s ease, color 0.4s ease, box-shadow 0.4s ease;
}

.sf-date-badge.active {
    /* Active styles will be controlled by Elementor - defaults below */
    background: #D4AF37;
    color: #fff;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.5);
}

/* Typography - Default Left Alignment for All Elements */
.sf-main-head {
    margin: 0 0 8px 0;
    font-size: 22px;
    color: #1e293b;
    font-weight: 700;
    text-align: left; /* Default left alignment */
}

.sf-sub-head {
    margin: 0 0 15px 0;
    font-size: 15px;
    color: #D4AF37; /* Highlight Color */
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: left; /* Default left alignment */
}

.sf-desc {
    font-size: 15px;
    color: #475569;
    line-height: 1.7;
    margin-bottom: 20px;
    text-align: left; /* Default left alignment */
}

/* Remove conflicting flex alignments that force right alignment on left items */
.left-item .sf-card-inner,
.right-item .sf-card-inner {
    display: block; /* Changed from flex to block to allow text-align to work */
}

/* --- Card Notch (Triangle) --- */
.sf-card-inner::after {
    content: '';
    position: absolute;
    top: 30px;
    width: 0;
    height: 0;
    border-style: solid;
    transition: all 0.3s ease;
}

/* Left Card Notch */
.left-item .sf-card-inner::after {
    right: -10px;
    border-width: 10px 0 10px 10px;
    border-color: transparent transparent transparent #ffffff; /* Match your card bg */
}

/* Right Card Notch */
.right-item .sf-card-inner::after {
    left: -10px;
    border-width: 10px 10px 10px 0;
    border-color: transparent #ffffff transparent transparent; /* Match your card bg */
}

/* ============================================
   MOBILE RESPONSIVE - ALL ISSUES FIXED!
   ============================================ */
@media (max-width: 767px) {
    .sf-timeline-wrapper {
        padding-left: 5px;
    }

    .sf-center-line {
        left: 25px !important; 
        transform: none !important;
        right: auto !important;
    }

    .sf-timeline-item {
        width: 100%;
        padding-left: 65px;
        padding-right: 10px;
        margin-bottom: 40px;
    }

    /* Reset positions */
    .left-item, .right-item {
        left: 0;
        text-align: left;
    }

    /* ✅ MOBILE FIX: All icons centered on the line */
    /* With !important removed from PHP, these rules will now properly override desktop positioning */
    .sf-timeline-dot,
    .left-item .sf-timeline-dot,
    .right-item .sf-timeline-dot {
        position: absolute !important;
        left: 25px !important; 
        right: auto !important;
        top: 30px !important;
        transform: translateX(-50%) !important;
        margin: 0 !important;
    }
    
    /* Active state with scale - maintaining center alignment */
    .sf-timeline-dot.active,
    .left-item .sf-timeline-dot.active,
    .right-item .sf-timeline-dot.active {
        transform: translateX(-50%) scale(1.1) !important;
    }

   /* Connector Mobile */
    .left-item .sf-card-inner::before,
    .right-item .sf-card-inner::before {
        left: -25px;
        right: auto;
    }

    /* ✅ FIXED: ALL card notches point LEFT on mobile */
    .left-item .sf-card-inner::after,
    .right-item .sf-card-inner::after {
        left: -12px !important;
        right: auto !important;
        border-width: 12px 12px 12px 0 !important;
    }
    
    /* Reset left border to transparent for left items on mobile */
    .left-item .sf-card-inner::after {
        border-left-color: transparent !important;
    }

    /* Ensure left alignment on mobile */
    .sf-date-badge-wrapper {
        text-align: left;
    }
    
    .sf-main-head,
    .sf-sub-head,
    .sf-desc {
        text-align: left;
    }
}
