/**
 * Food Store Order Tracker - Styles
 * Modern, responsive styling with animations
 */

/* ============================================
   Container & Base Styles
   ============================================ */

/* Z-Index Hierarchy:
   - Language dropdowns, menus: 1000-5000
   - Order tracker button: 999 (below dropdowns)
   - Order tracker modal: 9999 (above everything)
   - Food-store modals: 10000+ (above tracker modal)
*/

#fsot-container {
    position: fixed;
    right: 26px;
    top: 200px;
    z-index: 999; /* Below dropdowns and menus */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#fsot-container.fsot-visible {
    opacity: 1;
    visibility: visible;
}

#fsot-container.fsot-hidden {
    display: none;
}

/* Prevent body scroll when modal is open */
body.fsot-modal-active {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Keep order tracker visible but behind product modal */
body.modal-open #fsot-container,
body.wfs-modal-open #fsot-container,
.modal-backdrop ~ #fsot-container,
.wfsmodal.is-open ~ #fsot-container,
.micromodal-slide.is-open ~ #fsot-container {
    z-index: 999 !important; /* Lower than modal but still visible */
    pointer-events: none; /* Disable clicks when modal is open */
}

body.modal-open #fsot-container *,
body.wfs-modal-open #fsot-container *,
.modal-backdrop ~ #fsot-container *,
.wfsmodal.is-open ~ #fsot-container *,
.micromodal-slide.is-open ~ #fsot-container * {
    pointer-events: none; /* Disable clicks on all child elements */
}

/* Hide order tracker when shopping cart is open */
body.cart-open #fsot-container,
body.wfs-cart-open #fsot-container,
body.woocommerce-cart-open #fsot-container,
body.cfc-drawer-open #fsot-container,
.cart-sidebar-open ~ #fsot-container,
.mini-cart-open ~ #fsot-container {
    display: none !important;
}

/* ============================================
   Floating Button
   ============================================ */

.fsot-button {
    min-width: 70px;
    height: 70px;
    border-radius: 12px;
    background: var(--wfs-primary-color, #267dc9);
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 10px 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fsot-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.fsot-button:active {
    transform: scale(0.95);
}

.fsot-button .fsot-icon {
    color: #ffffff;
    width: 54px;
    height: 54px;
}

/* Pulse animation */
.fsot-button.fsot-pulse {
    animation: fsot-pulse-animation 0.6s ease-out;
}

@keyframes fsot-pulse-animation {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(38, 125, 201, 0.3);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
}

/* ============================================
   Badge
   ============================================ */

.fsot-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff4444;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.fsot-badge.fsot-badge-visible {
    opacity: 1;
    transform: scale(1);
}

.fsot-badge.fsot-badge-pop {
    animation: fsot-badge-pop-animation 0.4s ease-out;
}

@keyframes fsot-badge-pop-animation {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(1);
    }
}

/* Alert Badge (when toast is missed) */
.fsot-badge.fsot-alert-badge {
    background: transparent;
    border: none;
    box-shadow: none;
    width: 26px;
    height: 26px;
    top: -8px;
    right: -8px;
    will-change: auto;
}

.fsot-badge.fsot-alert-badge::before {
    content: none;
}

/* Alert pulse animation */
@keyframes fsot-alert-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: none;
    }
    50% {
        transform: scale(1.08);
        box-shadow: none;
    }
}

/* Reminder pulse (every 10-15 seconds) */
.fsot-badge.fsot-alert-badge.fsot-reminder-pulse {
    /* No size pulse animation for the alert badge */
}

@keyframes fsot-reminder-pulse {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.12);
    }
    50% {
        transform: scale(1.06);
    }
    75% {
        transform: scale(1.15);
    }
}

/* ============================================
   Toast Message
   ============================================ */

.fsot-toast {
    position: absolute;
    right: 90px;
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    background: #ffffff;
    color: #1f2937;
    padding: 16px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    max-width: 320px;
}

.fsot-toast.fsot-toast-visible {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

.fsot-toast.fsot-toast-success {
    border-left: 5px solid #10b981;
}

.fsot-toast.fsot-toast-error {
    border-left: 5px solid #ef4444;
}

.fsot-toast.fsot-toast-info {
    border-left: 5px solid var(--wfs-primary-color, #267dc9);
}

/* ============================================
   Modal
   ============================================ */

.fsot-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.fsot-modal.fsot-modal-open {
    opacity: 1;
    visibility: visible;
}

.fsot-modal-content {
    background: #ffffff;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.fsot-modal.fsot-modal-open .fsot-modal-content {
    transform: scale(1);
}

/* ============================================
   Modal Header
   ============================================ */

.fsot-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.fsot-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
}

.fsot-close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.fsot-close:hover {
    background: #f3f4f6;
}

.fsot-close svg {
    color: #6b7280;
}

/* ============================================
   Modal Body
   ============================================ */

.fsot-modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

.fsot-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.fsot-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: var(--wfs-primary-color, #267dc9);
    border-radius: 50%;
    animation: fsot-spin 0.8s linear infinite;
}

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

.fsot-loading p {
    margin-top: 16px;
    color: #6b7280;
    font-size: 14px;
}

.fsot-empty {
    text-align: center;
    padding: 40px 20px;
}

.fsot-empty p {
    color: #6b7280;
    font-size: 16px;
    margin: 0;
}

/* ============================================
   Orders List
   ============================================ */

.fsot-orders-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ============================================
   Order Card
   ============================================ */

.fsot-order-card {
    background: #f9fafb;
    border-radius: 12px;
    padding: 16px;
    border-left: 4px solid #e5e7eb;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fsot-order-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.fsot-order-card.fsot-status-pending {
    border-left-color: #f59e0b;
}

.fsot-order-card.fsot-status-preparing {
    border-left-color: var(--wfs-primary-color, #267dc9);
}

.fsot-order-card.fsot-status-completed {
    border-left-color: #10b981;
}

.fsot-order-card.fsot-status-cancelled {
    border-left-color: #ef4444;
}

/* ============================================
   Order Header
   ============================================ */

.fsot-order-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.fsot-order-number {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fsot-order-number strong {
    font-size: 16px;
    color: #1f2937;
}

.fsot-order-link {
    text-decoration: underline;
    color: inherit;
    display: inline-block;
    transition: all 0.2s ease;
}

.fsot-order-link:hover {
    color: var(--wfs-primary-color, #267dc9);
    transform: translateX(2px);
}

.fsot-order-link:hover strong {
    color: var(--wfs-primary-color, #267dc9);
}

.fsot-order-link:active {
    transform: translateX(0);
}

.fsot-order-timestamps {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fsot-order-date {
    font-size: 12px;
    color: #6b7280;
}

.fsot-order-updated {
    font-size: 12px;
    color: var(--wfs-primary-color, #267dc9);
    font-weight: 500;
}

.fsot-order-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.fsot-status-pending .fsot-order-status {
    background: #fef3c7;
    color: #d97706;
}

.fsot-status-preparing .fsot-order-status {
    background: rgba(38, 125, 201, 0.1);
    color: var(--wfs-primary-color, #267dc9);
}

.fsot-status-completed .fsot-order-status {
    background: #d1fae5;
    color: #059669;
}

.fsot-status-cancelled .fsot-order-status {
    background: #fee2e2;
    color: #dc2626;
}

.fsot-status-icon {
    width: 16px;
    height: 16px;
}

/* ============================================
   Timeline
   ============================================ */

.fsot-timeline {
    margin-top: 20px;
    padding-left: 8px;
}

.fsot-timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    position: relative;
    padding-bottom: 24px;
}

.fsot-timeline-item:last-child {
    padding-bottom: 0;
}

/* Vertical line connecting timeline items */
.fsot-timeline-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 12px; /* Center of 26px marker (20px + 3px border on each side = 26px total, center = 13px, minus 1px for 2px line width = 12px) */
    top: 24px;
    bottom: 0;
    width: 2px;
    background: #e5e7eb;
}

/* Timeline marker (circle) */
.fsot-timeline-marker {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 3px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

/* Timeline content */
.fsot-timeline-content {
    flex: 1;
    padding-top: 1px;
}

.fsot-timeline-title {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.fsot-timeline-time {
    font-size: 13px;
    color: #6b7280;
}

/* Completed state - green */
.fsot-timeline-completed .fsot-timeline-marker {
    background: #10b981;
    border-color: #10b981;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fsot-timeline-completed .fsot-timeline-marker::after {
    content: '✓';
    color: #ffffff;
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
}

.fsot-timeline-completed .fsot-timeline-title {
    color: #059669;
}

.fsot-timeline-completed .fsot-timeline-time {
    color: #059669;
    font-weight: 500;
}

/* Active state - blue with pulse */
.fsot-timeline-active .fsot-timeline-marker {
    background: #10b981;
    border-color: #10b981;
    box-shadow: 0 0 0 4px rgba(38, 125, 201, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fsot-timeline-active .fsot-timeline-marker::after {
    content: '✓';
    color: #ffffff;
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
}

.fsot-timeline-active .fsot-timeline-title {
    color: var(--wfs-primary-color, #267dc9);
}

.fsot-timeline-active .fsot-timeline-time {
    color: var(--wfs-primary-color, #267dc9);
    font-weight: 500;
}

/* Pending state - gray */
.fsot-timeline-pending .fsot-timeline-marker {
    background: #fff;
    border-color: #d1d5db;
}

.fsot-timeline-pending .fsot-timeline-title {
    color: #9ca3af;
}

/* Cancelled state - red */
.fsot-timeline-cancelled .fsot-timeline-marker {
    background: #ef4444;
    border-color: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.fsot-timeline-cancelled .fsot-timeline-title {
    color: #dc2626;
}

.fsot-timeline-cancelled .fsot-timeline-time {
    color: #dc2626;
    font-weight: 500;
}

/* Active line color */
.fsot-timeline-completed:not(:last-child)::before {
    background: #10b981;
}

.fsot-timeline-active:not(:last-child)::before {
    background: #10b981;
}

/* Pulse animation for active marker */
@keyframes fsot-timeline-pulse {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(38, 125, 201, 0.15);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(38, 125, 201, 0.05);
    }
}

/* ============================================
   Order Removal Animation
   ============================================ */

.fsot-removal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 10;
}

.fsot-removal-overlay-visible {
    opacity: 1;
    transform: scale(1);
}

.fsot-removal-overlay svg {
    animation: fsot-icon-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fsot-removal-overlay-success {
    background: rgba(16, 185, 129, 0.95);
}

.fsot-removal-overlay-success svg {
    color: #fff;
    filter: drop-shadow(0 4px 12px rgba(16, 185, 129, 0.4));
}

.fsot-removal-overlay-error {
    background: rgba(239, 68, 68, 0.95);
}

.fsot-removal-overlay-error svg {
    color: #fff;
    filter: drop-shadow(0 4px 12px rgba(239, 68, 68, 0.4));
}

/* Card fade out animation */
.fsot-card-removing {
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.4s ease;
}

/* Icon pop animation */
@keyframes fsot-icon-pop {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* ============================================
   Responsive Design
   ============================================ */

/* Tablet */
@media (max-width: 768px) {
    #fsot-container {
        right: 20px;
    }
    
    .fsot-button {
        width: 56px;
        height: 56px;
    }
    
    .fsot-button .fsot-icon {
        width: 50px;
        height: 50px;
    }
    
    .fsot-modal-content {
        width: 95%;
        max-height: 85vh;
    }
    
    .fsot-toast {
        right: 80px;
        max-width: 280px;
        font-size: 15px;
        padding: 14px 18px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    #fsot-container {
        right: 18px;
        top: 200px;
    }
    
    .fsot-button {
        min-width: 60px;
        height: 60px;
        padding: 8px 12px;
    }
    
    .fsot-button .fsot-icon {
        width: 48px;
        height: 48px;
    }
    
    .fsot-badge {
        font-size: 12px;
        width: 24px;
        height: 24px;
    }
    
    .fsot-toast {
        right: 80px;
        top: 50%;
        transform: translateY(-50%);
        bottom: auto;
        max-width: 260px;
        font-size: 15px;
        padding: 14px 18px;
    }
    
    .fsot-modal-content {
        width: 100%;
        max-height: 90vh;
        border-radius: 16px 16px 0 0;
        margin-top: auto;
    }
    
    .fsot-modal-header {
        padding: 16px 20px;
    }
    
    .fsot-modal-header h3 {
        font-size: 18px;
    }
    
    .fsot-modal-body {
        padding: 16px 20px;
    }
    
    .fsot-order-card {
        padding: 14px;
    }
    
    .fsot-order-number strong {
        font-size: 15px;
    }
    
    .fsot-order-status {
        font-size: 12px;
        padding: 5px 10px;
    }
    
    .fsot-item-image {
        width: 45px;
        height: 45px;
    }
    
    .fsot-item-name {
        font-size: 13px;
    }
    
    .fsot-order-total {
        font-size: 15px;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    #fsot-container {
        right: 18px;
        top: 200px;
    }
    
    .fsot-button {
        min-width: 56px;
        height: 56px;
        padding: 8px 10px;
    }
    
    .fsot-button .fsot-icon {
        width: 46px;
        height: 46px;
    }
    
    .fsot-toast {
        right: 70px;
        top: 50%;
        transform: translateY(-50%);
        bottom: auto;
        max-width: 240px;
        font-size: 14px;
        padding: 12px 16px;
    }
}

/* Connection indicator */
.fsot-conn-indicator {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
    line-height: 1;
    font-weight: 600;
    border: 1px solid transparent;
}

.fsot-conn-indicator .fsot-conn-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    background: currentColor;
    display: inline-block;
}

.fsot-conn-live {
    color: #059669;
    background: #ecfdf5;
    border-color: #10b981;
}

.fsot-conn-poll {
    color: #b45309;
    background: #fff7ed;
    border-color: #f59e0b;
}

.fsot-conn-off {
    color: #b91c1c;
    background: #fee2e2;
    border-color: #ef4444;
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    #fsot-container,
    .fsot-modal {
        display: none !important;
    }
}
