/* Sourcing MOQ UX Styles */
/* Uses platform's Fluent Design colors */

:root {
    --sourcing-orange: #ff8c00;
    --sourcing-orange-light: #fff3e0;
    --sourcing-green: #107c10;
    --sourcing-green-light: #e6f9e6;
}

/* Cart Button Pulsing Effect */
@keyframes sourcing-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 140, 0, 0.7);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(255, 140, 0, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 140, 0, 0);
    }
}

.nav-cart-btn.sourcing-pulse {
    animation: sourcing-pulse 2s infinite;
}

/* Orange counter for sourcing items */
.nav-cart-btn .cart-counter.sourcing-counter {
    background: var(--sourcing-orange);
}

/* Sticky Sourcing Progress Bar */
.sourcing-progress-sticky {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: var(--fluent-white);
    border-top: 1px solid var(--fluent-gray-40);
    box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.sourcing-progress-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sourcing-progress-icon {
    font-size: 24px;
}

.sourcing-progress-text {
    flex: 1;
}

.sourcing-progress-text h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--fluent-gray-100);
}

.sourcing-progress-text p {
    margin: 0;
    font-size: 12px;
    color: var(--fluent-gray-80);
}

.sourcing-progress-bar {
    flex: 1;
    max-width: 300px;
}

.sourcing-progress-track {
    width: 100%;
    height: 8px;
    background: var(--fluent-gray-30);
    border-radius: 4px;
    overflow: hidden;
}

.sourcing-progress-fill {
    height: 100%;
    background: var(--sourcing-orange);
    width: 0%;
    transition: width 0.3s ease, background 0.3s ease;
}

.sourcing-progress-fill.met {
    background: var(--sourcing-green);
}

.sourcing-progress-fill.milestone-50 {
    background: linear-gradient(90deg, var(--sourcing-orange) 0%, #f59e0b 100%);
}

.sourcing-progress-fill.milestone-75 {
    background: linear-gradient(90deg, var(--sourcing-orange) 0%, #f59e0b 55%, #eab308 100%);
}

/* Sourcing milestone markers */
.sourcing-progress-track {
    position: relative;
}

.sourcing-milestone {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--fluent-gray-30);
    border: 2px solid var(--fluent-white);
    cursor: pointer;
    z-index: 2;
    transition: all 0.3s ease;
}

.sourcing-milestone:hover {
    transform: translate(-50%, -50%) scale(1.2);
}

/* Milestone tooltip */
.sourcing-milestone-tooltip {
    position: absolute;
    bottom: 140%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--fluent-gray-100);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.sourcing-milestone:hover .sourcing-milestone-tooltip {
    opacity: 1;
}

/* Milestone state when progress has passed it */
.sourcing-progress-fill.met + .sourcing-milestone-50,
.sourcing-progress-fill:has(+ .sourcing-milestone-50 + .sourcing-milestone-75) .sourcing-milestone-50,
.sourcing-milestone-50.achieved,
.sourcing-milestone-75.achieved {
    background: var(--sourcing-orange);
}

.sourcing-progress-fill.met + .sourcing-milestone-50 + .sourcing-milestone-75,
.sourcing-progress-fill.met ~ .sourcing-milestone-75,
.sourcing-milestone-75.achieved {
    background: var(--sourcing-orange);
}

/* When MOQ is fully met, all milestones are green */
.sourcing-progress-fill.met ~ .sourcing-milestone,
.sourcing-progress-fill.met + .sourcing-milestone,
.sourcing-progress-fill.met + .sourcing-milestone + .sourcing-milestone {
    background: var(--sourcing-green);
}

.sourcing-sticky-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--fluent-gray-70);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sourcing-sticky-close:hover {
    color: var(--fluent-gray-100);
}

/* Responsive Styles - Mobile First */
@media (max-width: 768px) {
    .sourcing-progress-sticky {
        padding: 8px 12px;
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }

    .sourcing-progress-content {
        flex-direction: row;
        width: 100%;
        gap: 10px;
    }

    .sourcing-progress-icon {
        font-size: 20px;
    }

    .sourcing-progress-text h4 {
        font-size: 13px;
        margin-bottom: 2px;
    }

    .sourcing-progress-text p {
        font-size: 11px;
        line-height: 1.3;
    }

    .sourcing-progress-bar {
        max-width: 100%;
        width: 100%;
        margin-top: 6px;
    }

    .sourcing-sticky-close {
        position: absolute;
        top: 4px;
        right: 8px;
        font-size: 16px;
        padding: 2px;
    }
}

@media (max-width: 480px) {
    .sourcing-progress-sticky {
        padding: 6px 10px;
    }
    
    .sourcing-progress-text h4 {
        font-size: 12px;
    }
    
    .sourcing-progress-text p {
        font-size: 10px;
    }
}

/* Homepage Hero MOQ Banner */
.hero-sourcing-moq-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding: 16px 20px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.hero-moq-icon {
    font-size: 28px;
    color: var(--sourcing-orange);
    flex-shrink: 0;
}

.hero-moq-content {
    flex: 1;
}

.hero-moq-text {
    margin: 0;
    color: var(--fluent-white);
    font-size: 14px;
    line-height: 1.5;
}

.hero-moq-info-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.hero-moq-info-btn:hover {
    color: var(--sourcing-orange);
}

/* Sourcing Progress Peek on cart button hover */
.sourcing-progress-peek {
    position: absolute;
    bottom: 50%;
    right: 100%;
    margin-right: 10px;
    transform: translateY(50%) translateX(10px);
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    min-width: 240px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 99999;
}

.sourcing-progress-peek.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(50%) translateX(0);
}

/* Position the peek relative to the nav cart button */
.nav-cart-btn {
    position: relative;
}

.sourcing-peek-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--fluent-gray-100);
    margin-bottom: 12px;
}

.sourcing-peek-header i {
    color: var(--sourcing-orange);
    font-size: 16px;
}

.sourcing-peek-progress {
    margin-bottom: 10px;
}

.sourcing-peek-progress-track {
    width: 100%;
    height: 8px;
    background: var(--fluent-gray-20);
    border-radius: 4px;
    overflow: hidden;
}

.sourcing-peek-progress-fill {
    height: 100%;
    background: var(--sourcing-orange);
    width: 0%;
    transition: width 0.3s ease, background 0.3s ease;
}

.sourcing-peek-progress-fill.met {
    background: var(--sourcing-green);
}

.sourcing-peek-text {
    font-size: 13px;
}

.sourcing-peek-total {
    color: var(--fluent-gray-90);
    font-weight: 600;
    margin-bottom: 4px;
}

.sourcing-peek-shortfall {
    color: var(--fluent-gray-60);
    font-size: 12px;
}

.sourcing-peek-success {
    color: var(--sourcing-green);
    font-size: 13px;
    display: block;
    text-align: center;
}

/* Cart Drawer Sourcing Highlight */
.cart-drawer.sourcing-drawer {
    border-left: 4px solid var(--sourcing-orange);
}

.cart-drawer-header.sourcing-header {
    background: linear-gradient(135deg, #fff3e0 0%, white 100%);
    border-bottom: 2px solid var(--sourcing-orange);
}

.sourcing-header-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--sourcing-orange);
    color: white !important;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    margin-left: 8px;
    text-transform: uppercase;
}

.sourcing-header-badge i {
    color: white !important;
}

/* Sourcing Cart Button Pulse - Instant Application */
.nav-cart-btn.sourcing-pulse {
    animation: sourcing-pulse 2s infinite;
}

@keyframes sourcing-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 140, 0, 0.7);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(255, 140, 0, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 140, 0, 0);
    }
}

/* Orange counter for sourcing items */
.nav-cart-btn .cart-counter.sourcing-counter {
    background: var(--sourcing-orange);
}

/* Per-Item MOQ Reminder */
.item-moq-reminder {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 12px;
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 8px;
    background: rgba(255, 140, 0, 0.08);
    border-left: 4px solid var(--sourcing-orange);
}

.item-moq-reminder i {
    color: var(--sourcing-orange);
    font-size: 18px;
    margin-top: 2px;
}

.item-moq-reminder span {
    font-size: 14px;
    line-height: 1.5;
    color: var(--fluent-gray-100);
}

.item-moq-reminder strong {
    color: var(--fluent-gray-100);
    font-weight: 700;
}

/* Responsive Item MOQ Reminder */
@media (max-width: 768px) {
    .item-moq-reminder {
        padding: 10px 12px;
    }
    
    .item-moq-reminder span {
        font-size: 13px;
    }
}

/* Hero MOQ Banner Responsive */
@media (max-width: 768px) {
    .hero-sourcing-moq-banner {
        padding: 10px 14px;
        margin-top: 20px;
        gap: 8px;
        flex-direction: row;
        text-align: left;
        align-items: center;
        flex-wrap: nowrap;
    }
    
    .hero-moq-icon {
        font-size: 20px;
        flex-shrink: 0;
    }
    
    .hero-moq-text {
        font-size: 12px;
        line-height: 1.4;
        flex: 1;
    }
    
    .hero-moq-info-btn {
        font-size: 18px;
        flex-shrink: 0;
    }
}

@media (max-width: 480px) {
    .hero-sourcing-moq-banner {
        padding: 8px 12px;
        gap: 6px;
    }
    
    .hero-moq-text {
        font-size: 11px;
    }
}

/* Sourcing modal overlay (legacy inline modals — do not style top-level .fluent-modal; ModalManager uses that class as the overlay) */
.fluent-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100000 !important;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.fluent-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.fluent-modal-overlay .fluent-modal {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    z-index: 100001 !important;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.fluent-modal-overlay.active .fluent-modal {
    transform: translateY(0);
}

.fluent-modal-overlay .fluent-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
}

.fluent-modal-overlay .fluent-modal-close:hover {
    color: #000;
}

.fluent-modal-overlay .fluent-modal-header {
    padding: 25px 25px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    color: #ff8c00;
}

.fluent-modal-overlay .fluent-modal-header h3 {
    margin: 0;
    color: #111;
    font-size: 22px;
}

.fluent-modal-overlay .fluent-modal-body {
    padding: 0 25px 20px;
}

.fluent-modal-overlay .fluent-modal-body p {
    margin: 0 0 15px;
    line-height: 1.6;
    color: #333;
}

.fluent-modal-overlay .fluent-modal-body p strong {
    color: #111;
}

.fluent-modal-overlay .fluent-modal-footer {
    padding: 15px 25px 25px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
