﻿* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    -webkit-font-smoothing: antialiased;
}

.order-page {
    min-height: 100vh;
    background: #f5f5f5;
    padding-bottom: 100px;
}

/* HEADER */
.app-header {
    background: #007AFF;
    background: linear-gradient(135deg, #007AFF 0%, #0051D5 100%);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}

.back-button, .info-button {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s;
    min-width: 40px;
}

    .back-button:hover, .info-button:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    .back-button:active, .info-button:active {
        background: rgba(255, 255, 255, 0.2);
    }

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.header-logo {
    height: 32px;
    width: auto;
}

.header-content h1 {
    font-size: 17px;
    font-weight: 600;
    margin: 0;
}

.header-content h2 {
    font-size: 14px;
    font-weight: 500;
    margin: 0;
    opacity: 0.9;
}

/* BANNER DE ESTADO */
.status-banner {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.status-content {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 800px;
    width: 100%;
}

.status-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    background: white;
    flex-shrink: 0;
}

.status-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.status-text {
    font-size: 15px;
    font-weight: 600;
    color: white;
}

.status-date {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
}

.status-confirmed {
    background: linear-gradient(135deg, #34C759 0%, #28A745 100%);
}

    .status-confirmed .status-icon {
        color: #34C759;
    }

.status-rejected {
    background: linear-gradient(135deg, #FF3B30 0%, #DC3545 100%);
}

    .status-rejected .status-icon {
        color: #FF3B30;
    }

.status-pending {
    background: linear-gradient(135deg, #FF9500 0%, #FF8000 100%);
}

    .status-pending .status-icon {
        color: #FF9500;
    }

/* ORDER SUMMARY CARD */
.order-summary-card {
    background: white;
    margin: 12px 16px;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.order-header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 12px;
    flex-wrap: wrap;
}

.order-number {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.order-date {
    font-size: 14px;
    color: #007AFF;
    font-weight: 500;
}

.vendor-name {
    font-size: 18px;
    font-weight: 700;
    color: #000;
    font-style: italic;
    margin: 8px 0 12px 0;
}

.vendor-shipment {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-top: 1px solid #eee;
    margin-top: 8px;
}

    .vendor-shipment .label {
        color: #999;
        font-size: 14px;
    }

    .vendor-shipment .value {
        color: #666;
        font-size: 14px;
        font-style: italic;
    }

.order-total-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0 0 0;
    border-top: 1px solid #eee;
    margin-top: 12px;
}

    .order-total-summary .label {
        font-size: 14px;
        color: #666;
        font-style: italic;
    }

    .order-total-summary .amount {
        font-size: 35px;
        font-weight: 700;
        color: #000;
    }

/* PRODUCTS LIST */
.products-list {
    padding: 0 16px;
}

.product-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.product-name {
    font-size: 16px;
    font-weight: 700;
    font-style: italic;
    color: #000;
    margin-bottom: 16px;
    text-align: center;
}

.product-info-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.info-label {
    font-size: 11px;
    color: #666;
}

.info-value {
    font-size: 14px;
    font-weight: 600;
    color: #000;
}

    .info-value.primary {
        color: #007AFF;
        font-size: 16px;
    }

    .info-value.unit {
        font-size: 12px;
        color: #000;
    }

.info-item.total .info-value {
    font-size: 16px;
    font-weight: 700;
}

/* BOTÓN CENTRADO */
.action-buttons-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 12px 16px;
    display: flex;
    justify-content: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.btn-confirm-single {
    width: 100%;
    max-width: 400px;
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #34C759;
    color: white;
}

    .btn-confirm-single:hover:not(:disabled) {
        background: #2DB04B;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(52, 199, 89, 0.3);
    }

    .btn-confirm-single:active:not(:disabled) {
        transform: scale(0.98);
    }

    .btn-confirm-single:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

/* LOADING */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 16px;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007AFF;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

.spinner-small {
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ERROR & SUCCESS SCREENS */
.error-screen, .success-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px;
    text-align: center;
}

.error-icon, .success-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.error-screen h2, .success-screen h2 {
    font-size: 24px;
    margin-bottom: 12px;
    color: #000;
}

.error-screen p, .success-screen p {
    color: #666;
    font-size: 16px;
    margin-bottom: 8px;
}

.message-sid {
    font-size: 12px;
    color: #999;
    font-family: monospace;
}

/* ============================================
   RESPONSIVE - TABLET (768px en adelante)
   ============================================ */
@media (min-width: 768px) {
    .order-page {
        padding-bottom: 0;
    }

    .app-header {
        padding: 16px 24px;
    }

    .header-logo {
        height: 40px;
    }

    .header-content h1 {
        font-size: 20px;
    }

    .header-content h2 {
        font-size: 16px;
    }

    /* Centrar contenido con ancho máximo */
    .order-summary-card,
    .products-list {
        max-width: 800px;
        margin-left: auto;
        margin-right: auto;
    }

    .order-summary-card {
        padding: 24px;
        margin-top: 20px;
        margin-bottom: 20px;
    }

    .products-list {
        padding: 0 24px;
    }

    .product-card {
        padding: 20px;
        margin-bottom: 16px;
    }

    .product-name {
        font-size: 18px;
        margin-bottom: 20px;
    }

    .product-info-grid {
        gap: 16px;
    }

    .info-label {
        font-size: 12px;
    }

    .info-value {
        font-size: 16px;
    }

        .info-value.primary {
            font-size: 18px;
        }

    .info-item.total .info-value {
        font-size: 18px;
    }

    /* Botón no fijo en tablet/desktop */
    .action-buttons-fixed {
        position: static;
        max-width: 800px;
        margin: 24px auto;
        padding: 20px 24px;
        box-shadow: none;
    }

    .btn-confirm-single {
        max-width: 500px;
        padding: 18px;
        font-size: 18px;
    }

    .vendor-name {
        font-size: 22px;
    }

    .order-total-summary .amount {
        font-size: 42px;
    }
}

/* ============================================
   RESPONSIVE - DESKTOP (1024px en adelante)
   ============================================ */
@media (min-width: 1024px) {
    .order-page {
        max-width: 1200px;
        margin: 0 auto;
        background: white;
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
    }

    .app-header {
        border-radius: 0;
    }

    .order-summary-card,
    .products-list {
        max-width: 900px;
    }

    .order-summary-card {
        padding: 28px;
    }

    .product-card {
        padding: 24px;
        transition: transform 0.2s, box-shadow 0.2s;
    }

        .product-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
        }

    /* Grid de productos más espacioso */
    .product-info-grid {
        gap: 20px;
        padding: 0 20px;
    }

    .action-buttons-fixed {
        max-width: 900px;
    }

    .btn-confirm-single {
        max-width: 600px;
        padding: 20px;
    }
}

/* ============================================
   RESPONSIVE - DESKTOP GRANDE (1440px+)
   ============================================ */
@media (min-width: 1440px) {
    .order-page {
        max-width: 1400px;
    }

    .order-summary-card,
    .products-list,
    .action-buttons-fixed {
        max-width: 1000px;
    }

    .order-summary-card {
        padding: 32px;
    }

    .product-card {
        padding: 28px;
    }

    .product-name {
        font-size: 20px;
    }

    .vendor-name {
        font-size: 24px;
    }

    .order-total-summary .amount {
        font-size: 48px;
    }
}

/* ============================================
   RESPONSIVE - MÓVIL PEQUEÑO (max 375px)
   ============================================ */
@media (max-width: 375px) {
    .product-info-grid {
        gap: 4px;
    }

    .info-label {
        font-size: 10px;
    }

    .info-value {
        font-size: 12px;
    }

        .info-value.primary {
            font-size: 14px;
        }

    .order-total-summary .amount {
        font-size: 28px;
    }

    .vendor-name {
        font-size: 16px;
    }
}
