/* ============================================
   ACTIVE ORDER VIEW - ESTIL GLOVO
   Vista de comanda activa amb tracking d'estat
   ============================================ */

.active-order-view {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    max-width: 600px;
    margin: 0 auto;
    animation: fadeInUp 0.4s var(--ease-out-expo);
}

/* Header amb estat */
.active-order-header {
    text-align: center;
    margin-bottom: 2rem;
}

.active-order-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.active-order-status-badge.pending {
    background: #FEF3C7;
    color: #92400E;
}

.active-order-status-badge.received,
.active-order-status-badge.rebuda {
    background: #DBEAFE;
    color: #1E40AF;
}

.active-order-status-badge.preparing,
.active-order-status-badge.preparant {
    background: #FED7AA;
    color: #9A3412;
}

.active-order-status-badge.ready,
.active-order-status-badge.llesta {
    background: #D1FAE5;
    color: #065F46;
}

.active-order-status-badge.completed {
    background: #E0E7FF;
    color: #3730A3;
}

.active-order-title {
    font-family: 'Sentient', serif;
    font-size: 1.5rem;
    color: var(--stone-900);
    margin: 0 0 0.5rem 0;
}

.active-order-subtitle {
    font-size: 0.9375rem;
    color: var(--stone-600);
    margin: 0;
}

/* Timeline d'estat - Estil Glovo */
.order-status-timeline {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.timeline-step {
    display: flex;
    gap: 1rem;
    position: relative;
    padding-bottom: 1.25rem;
}

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

/* Línia vertical entre passos */
.timeline-step:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 21px; /* Centrat amb l'icona de 44px */
    top: 44px; /* Just després de l'icona */
    bottom: 0;
    width: 2px;
    background: var(--stone-300);
    border-radius: 1px;
}

.timeline-step.completed:not(:last-child)::after {
    background: var(--terracotta-500);
}

.timeline-step.active:not(:last-child)::after {
    background: linear-gradient(to bottom, var(--terracotta-500) 0%, var(--stone-300) 100%);
}

.timeline-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--stone-100);
    color: var(--stone-400);
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.timeline-step.completed .timeline-icon {
    background: var(--terracotta-500);
    color: white;
}

.timeline-step.active .timeline-icon {
    background: var(--terracotta-500);
    color: white;
    box-shadow: 0 0 0 4px rgba(230, 74, 25, 0.1);
    animation: pulse 2s ease-in-out infinite;
}

.timeline-icon svg {
    width: 22px;
    height: 22px;
}

.timeline-content {
    flex: 1;
    padding-top: 0.5rem;
}

.timeline-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--stone-900);
    margin: 0 0 0.25rem 0;
}

.timeline-step.active .timeline-title {
    color: var(--terracotta-600);
}

.timeline-desc {
    font-size: 0.8125rem;
    color: var(--stone-500);
    margin: 0;
    line-height: 1.4;
}

.timeline-time {
    font-size: 0.75rem;
    color: var(--stone-400);
    margin-top: 0.25rem;
}

/* Animació pulse */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(230, 74, 25, 0.1);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(230, 74, 25, 0.05);
    }
}

/* Detalls de la comanda */
.active-order-details {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.active-order-details h4 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--stone-600);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 1rem 0;
}

.order-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--stone-100);
}

.order-detail-row:last-child {
    border-bottom: none;
}

.order-detail-label {
    font-size: 0.875rem;
    color: var(--stone-600);
}

.order-detail-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--stone-900);
}

.order-detail-value.highlight {
    color: var(--terracotta-600);
    font-size: 1rem;
}

/* Productes */
.active-order-products {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.active-order-products h4 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--stone-600);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 1rem 0;
}

.order-product-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.75rem 0;
    border-bottom: 1px dashed var(--stone-200);
}

.order-product-item:last-child {
    border-bottom: none;
}

.order-product-info {
    flex: 1;
}

.order-product-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--stone-900);
    margin-bottom: 0.125rem;
}

.order-product-details {
    font-size: 0.75rem;
    color: var(--stone-500);
}

.order-product-price {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--stone-900);
    white-space: nowrap;
    margin-left: 1rem;
}

/* Total */
.order-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    margin-top: 0.5rem;
    border-top: 2px solid var(--stone-200);
}

.order-total-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--stone-900);
}

.order-total-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--terracotta-600);
}

/* Accions */
.active-order-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.btn-order-action {
    flex: 1;
    padding: 0.875rem 1rem;
    border-radius: 12px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-order-action.primary {
    background: var(--terracotta-500);
    color: white;
}

.btn-order-action.primary:hover {
    background: var(--terracotta-600);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(230, 74, 25, 0.3);
}

.btn-order-action.secondary {
    background: var(--stone-100);
    color: var(--stone-700);
}

.btn-order-action.secondary:hover {
    background: var(--stone-200);
}

.btn-order-action svg {
    width: 20px;
    height: 20px;
}

/* Info de contacte */
.order-contact-info {
    background: rgba(230, 74, 25, 0.05);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1rem;
    text-align: center;
}

.order-contact-info p {
    font-size: 0.8125rem;
    color: var(--stone-600);
    margin: 0;
    line-height: 1.5;
}

.order-contact-info strong {
    color: var(--terracotta-600);
    font-weight: 600;
}

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

/* Responsive */
@media (max-width: 640px) {
    .active-order-view {
        padding: 1rem;
    }
    
    .active-order-title {
        font-size: 1.25rem;
    }
    
    .order-status-timeline,
    .active-order-details,
    .active-order-products {
        padding: 1.25rem;
    }
    
    .active-order-actions {
        flex-direction: column;
    }
    
    .btn-order-action {
        width: 100%;
    }
}

/* Bloquejar scroll del body quan modal obert */
body.modal-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    touch-action: none;
    -webkit-overflow-scrolling: none;
}

/* Overlay del modal */
.order-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    overscroll-behavior: contain;
    overflow: hidden;
}

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

.order-modal {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 400px; /* Mateixa mida que el cart sidebar */
    max-height: fit-content;
    overflow: visible;
    animation: slideUp 0.4s var(--ease-out-expo);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Desktop - limitar mida */
@media (min-width: 640px) {
    .order-modal {
        max-width: 400px;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Close button del modal */
.order-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--stone-100);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.order-modal-close:hover {
    background: var(--stone-200);
    transform: rotate(90deg);
}

.order-modal-close svg {
    width: 20px;
    height: 20px;
    color: var(--stone-600);
}

/* ============================================
   TIMELINE MODAL SIMPLIFICAT
   ============================================ */

.timeline-only {
    max-width: 500px;
    padding: 2rem;
}

.status-timeline-modal {
    display: flex;
    flex-direction: column;
}

.timeline-modal-header {
    text-align: center;
    margin-bottom: 2rem;
}

.timeline-modal-title {
    font-family: 'Sentient', serif;
    font-size: 1.5rem;
    color: var(--stone-900);
    margin: 1rem 0 0.5rem 0;
}

.timeline-modal-subtitle {
    font-size: 0.9375rem;
    color: var(--stone-600);
    margin: 0;
}

/* ============================================
   VISTA COMPLETA AL CARRET
   ============================================ */

.active-order-full-view {
    padding: 1.5rem;
}

.order-full-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--stone-200);
}

.order-full-title {
    font-family: 'Sentient', serif;
    font-size: 1.25rem;
    color: var(--stone-900);
    margin: 1rem 0 0.5rem 0;
}

.order-full-subtitle {
    font-size: 0.875rem;
    color: var(--stone-600);
    margin: 0;
}

.btn-view-timeline {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--stone-100);
    border: 2px solid var(--stone-200);
    border-radius: 12px;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--stone-700);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.btn-view-timeline:hover {
    background: var(--stone-200);
    border-color: var(--stone-300);
}

.btn-view-timeline svg {
    width: 20px;
    height: 20px;
}

@media (max-width: 640px) {
    .timeline-only {
        padding: 1.5rem;
    }
    
    .active-order-full-view {
        padding: 1rem;
    }
}

/* ============================================
   POPUP COMPACTE - NOMÉS TIMELINE
   ============================================ */

.active-order-view.compact {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-height: auto;
    max-height: 80vh;
}

.order-status-header {
    margin-bottom: 1.5rem;
}

.order-status-header .order-number {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--stone-100);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--stone-600);
    margin-bottom: 0.5rem;
}

.order-status-header h2 {
    font-family: 'Sentient', serif;
    font-size: 1.375rem;
    color: var(--stone-900);
    margin: 0 0 0.25rem 0;
    font-weight: 400;
}

.order-status-header .pickup-time {
    font-size: 0.875rem;
    color: var(--stone-600);
    margin: 0;
}

.order-status-header .pickup-time strong {
    color: var(--terracotta-600);
}

.order-status-header.cancelled h2 {
    color: #DC2626;
}

.order-status-header .status-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

/* Timeline compacte */
.compact .order-status-timeline {
    width: 100%;
    max-width: 320px;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--stone-50);
    border-radius: 16px;
}

/* Botó tancar */
.btn-close-order {
    width: 100%;
    max-width: 320px;
    padding: 0.875rem 1.5rem;
    background: var(--stone-200);
    border: none;
    border-radius: 12px;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--stone-700);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-close-order:hover {
    background: var(--stone-300);
}

/* ============================================
   CELEBRACIÓ AMB CONFETI
   ============================================ */

.active-order-view.celebration {
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 400px;
}

.celebration-content {
    animation: celebrationBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.celebration-icon {
    font-size: 4rem;
    line-height: 1;
    margin-bottom: 1rem;
    animation: pizzaSpin 1s ease-out;
}

.celebration-title {
    font-family: 'Sentient', serif;
    font-size: 1.75rem;
    color: var(--stone-900);
    margin: 0 0 0.5rem 0;
    font-weight: 400;
}

.celebration-text {
    font-size: 1.125rem;
    color: var(--stone-600);
    margin: 0 0 0.25rem 0;
}

.celebration-subtext {
    font-size: 1rem;
    color: var(--terracotta-500);
    margin: 0;
    font-weight: 500;
}

.btn-close-celebration {
    margin-top: 2rem;
    padding: 1rem 2.5rem;
    background: var(--terracotta-500);
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-close-celebration:hover {
    background: var(--terracotta-600);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(230, 74, 25, 0.3);
}

@keyframes celebrationBounce {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    60% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pizzaSpin {
    0% {
        transform: rotate(-20deg) scale(0.8);
    }
    50% {
        transform: rotate(10deg) scale(1.1);
    }
    100% {
        transform: rotate(0deg) scale(1);
    }
}

/* Modal sense scroll */
.order-modal {
    overflow: visible;
    max-height: none;
}