/* Order History Page Styles */

.orders-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.order-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.order-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

/* Order Header */
.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
}

.order-header-left {
    flex: 1;
}

.order-id {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.order-date {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.order-date i {
    margin-right: 0.5rem;
}

/* Status Badge */
.order-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-waiting-payment {
    /* Waiting for Payment - 橙色亮色 */
    background: rgba(251, 146, 60, 0.3);
    color: #fb923c;
    animation: pulse 2s infinite;
}

.status-pending {
    /* Packaging - 黄色亮色 */
    background: rgba(251, 191, 36, 0.3);
    color: #fbbf24;
}

.status-processing {
    background: rgba(255, 255, 255, 0.2);
    color: #4ecdc4;
    animation: pulse 2s infinite;
}

.status-shipped {
    /* Delivering - 浅亮蓝色 */
    background: rgba(96, 165, 250, 0.3);
    color: #60a5fa;
}

.status-delivered {
    /* Completed - 绿色亮色 */
    background: rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.status-cancelled {
    /* Cancelled - 红色亮色 */
    background: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

/* Order status pulse animation - only affects opacity, not box-shadow */
@keyframes order-status-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Keep backward compatibility with pulse name for order status */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Order Items Preview */
.order-items-preview {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.5rem 2rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.order-item-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    background: white;
    padding: 1.25rem 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin: 0 auto;

    width: 100%;
    min-height: 80px;
}

.preview-image {
    width: 70px !important;
    height: 70px !important;
    max-width: 70px !important;
    max-height: 70px !important;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.preview-image-placeholder {
    width: 70px;
    height: 70px;
    background: #e9ecef;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
    font-size: 1.5rem;
}

.preview-details {
    flex: 1;
    min-width: 0;
}

.preview-price {
    margin-left: 1rem;
    color: #111827;
    font-weight: 700;
    font-size: 1.1rem;
    white-space: nowrap;
}

.preview-name {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-qty {
    margin: 0;
    font-size: 1rem;
    color: #666;
    font-weight: 500;
}

.preview-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
    margin: 0 auto;
    width: auto;
    min-width: 220px;
    max-width: 360px;
    min-height: 56px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.preview-more:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.preview-more i {
    font-size: 1.3rem;
}

/* Hidden items before expand */
.is-hidden {
    display: none;
}

/* Smooth collapsing animation when hiding items one-by-one */
.order-item-preview.collapsing {
    overflow: hidden;
    transition: max-height 180ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 180ms cubic-bezier(0.2, 0.8, 0.2, 1), padding 180ms cubic-bezier(0.2, 0.8, 0.2, 1), margin 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: max-height, opacity, padding, margin;
    max-height: 0 !important;
    opacity: 0;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    min-height: 0 !important;
}

/* Smooth expanding animation support */
.order-item-preview.expanding {
    overflow: hidden;
    transition: max-height 180ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 180ms cubic-bezier(0.2, 0.8, 0.2, 1), padding 180ms cubic-bezier(0.2, 0.8, 0.2, 1), margin 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: max-height, opacity, padding, margin;
}

/* Order Summary */
.order-summary {
    padding: 1.5rem 4rem;
    background: white;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.order-summary-left {
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 0;
}

.order-summary-right {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding-top: 0;
    margin-top: 0;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0;
    font-size: 0.95rem;
    width: 100%;
}

.summary-row span:first-child {
    color: #666;
    text-align: left;
    flex: 1;
}

.summary-row span:last-child {
    color: #333;
    font-weight: 600;
    text-align: right;
    min-width: 120px; /* Fixed width to ensure alignment */
}

/* Status info cards (Packaging, etc.) */
.status-info-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-radius: 14px;
    background: #f9fafb;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
    width: 100%;
}

.status-info-icon {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: white;
}

.packaging-info-card .status-info-icon {
    background: linear-gradient(135deg, #fbbf24 0%, #f97316 100%); /* Same family as packaging status badge */
}

.delivering-info-card .status-info-icon {
    background: linear-gradient(135deg, #3b82f6 0%, #0ea5e9 100%); /* Blue gradient for delivering */
}

.status-info-text h4 {
    margin: 0 0 0.4rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: #111827;
}

.status-info-text p {
    margin: 0;
    font-size: 0.9rem;
    color: #4b5563;
}

.summary-row.total {
    justify-content: space-between;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 2px solid #e9ecef;
    margin-top: 0.5rem;
    font-size: 1.1rem;
}

.summary-row.total span:first-child {
    color: #333;
    font-weight: 600;
    text-align: left;
    flex: 1;
}

.summary-row.total span:last-child {
    color: #3b82f6;
    font-size: 1.3rem;
    font-weight: 700;
    text-align: right;
    min-width: 120px; /* Same width as other prices for alignment */
}

/* Order Actions */
.order-actions {
    display: flex;
    gap: 1rem;
    padding: 2.0rem 3.0rem;
    background: white;
}

.btn-order-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-view {
    background: #6c757d;
    color: white;
}

.btn-view:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.btn-payment {
    /* Circular, centered Payment button - more prominent but not too strong */
    flex: 0 0 100px;             /* do not shrink, base width 80px */
    width: 100px;
    height: 100px;
    min-width: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fb923c 0%, #f97316 100%);
    color: white;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0;
    box-sizing: border-box;     /* 边框算在 80×80 里面 */
    margin: 0 auto 10px;
    text-align: center;
    border: 3px solid #fff7ed; /* soft light border */
    box-shadow: 0 6px 16px rgba(251, 146, 60, 0.45);
    animation: payment-pulse 2.4s infinite;
}

.btn-payment:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(251, 146, 60, 0.75);
}

.btn-payment i {
    font-size: 24px;
}

.btn-payment-text {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}

.payment-button-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.payment-note {
    margin: 0;
    font-size: 0.85rem;
    color: #1d4ed8; /* STAT blue */
    text-align: center;
}

/* Payment on Shop Styles */
.payment-on-shop-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1.5rem 2rem;
    background: #f9fafb;
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
    width: 100%;
}

.payment-on-shop-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.payment-on-shop-content {
    text-align: center;
    width: 100%;
}

.payment-on-shop-content h4 {
    margin: 0 0 0.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    color: #111827;
}

.payment-on-shop-content > p {
    margin: 0 0 1rem;
    font-size: 0.95rem;
    color: #4b5563;
    line-height: 1.5;
}

.store-info {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    border: 1px solid #e5e7eb;
}

.store-info p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
    color: #374151;
}

.store-info p:first-child {
    margin-top: 0;
    font-weight: 600;
    color: #111827;
}

.btn-map-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    margin-top: 0.75rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-map-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-map-link i {
    font-size: 1rem;
}

.payment-on-shop-note {
    margin: 1rem 0 0;
    font-size: 0.85rem;
    color: #6b7280;
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.payment-on-shop-note i {
    color: #3b82f6;
}

@keyframes payment-pulse {
    0%, 100% {
        box-shadow: 0 6px 16px rgba(251, 146, 60, 0.45);
    }
    50% {
        box-shadow: 0 10px 24px rgba(251, 146, 60, 0.75);
    }
}

.btn-review {
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    color: white;
}

.btn-review:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(253, 160, 133, 0.3);
}

.btn-tracking {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.btn-tracking:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3);
}

.btn-invoice {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-invoice:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-receipt {
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    color: white;
}

.btn-receipt:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

/* Responsive Design */
@media (max-width: 768px) {
    .order-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .order-status {
        width: 100%;
        justify-content: center;
    }

    .order-items-preview {
        flex-direction: column;
        padding: 1rem;
    }

    .order-item-preview {
        max-width: 100%;
        padding: 0.75rem;
    }

    .preview-details {
        flex: 1;
        min-width: 0;
    }

    .preview-name {
        font-size: 0.85rem;
    }

    .preview-qty {
        font-size: 0.75rem;
    }

    .order-summary {
        flex-direction: column;
        padding: 1.5rem 2rem;
    }

    .order-summary-left {
        width: 100%;
        margin-bottom: 1.5rem;
    }

    .order-summary-right {
        width: 100%;
    }

    .order-actions {
        flex-direction: column;
    }

    .btn-order-action {
        width: 100%;
    }

    .preview-more {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .order-id {
        font-size: 1.2rem;
    }

    .order-date {
        font-size: 0.8rem;
    }

    .preview-name {
        font-size: 0.85rem;
    }

    .preview-qty {
        font-size: 0.75rem;
    }
}

/* Guest Login Modal - Full Screen Overlay */
.guest-login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

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

.guest-login-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 20px;
    padding: 3rem 2.5rem;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s ease;
}

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

.guest-login-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.3);
}

.guest-login-icon i {
    font-size: 2.5rem;
    color: white;
}

.guest-login-content h2 {
    font-size: 2rem;
    color: #1e293b;
    margin: 0 0 1rem;
    font-weight: 700;
}

.guest-login-content p {
    font-size: 1.1rem;
    color: #64748b;
    margin: 0 0 2rem;
    line-height: 1.6;
}

.guest-login-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-login,
.btn-signup {
    flex: 1;
    min-width: 150px;
    padding: 1rem 2rem;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-login {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-signup {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-signup:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-back-home {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #64748b;
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

.btn-back-home:hover {
    color: #3b82f6;
}

/* Responsive Design for Guest Login Modal */
@media (max-width: 768px) {
    .guest-login-content {
        padding: 2rem 1.5rem;
    }

    .guest-login-icon {
        width: 60px;
        height: 60px;
    }

    .guest-login-icon i {
        font-size: 2rem;
    }

    .guest-login-content h2 {
        font-size: 1.5rem;
    }

    .guest-login-content p {
        font-size: 1rem;
    }

    .guest-login-buttons {
        flex-direction: column;
    }

    .btn-login,
    .btn-signup {
        width: 100%;
    }
}
