/**
 * Estilos para el sistema de rastreo moderno de pedidos
 * Shortcode: [rt_order_tracking_modern]
 * Version: 1.0
 */

/* Variables CSS */
:root {
    --rt-primary: #00B3A6;
    --rt-primary-hover: #009688;
    --rt-primary-active: #00897B;
    --rt-surface: #ffffff;
    --rt-background: #f8fafc;
    --rt-border: #e2e8f0;
    --rt-text-primary: #1e293b;
    --rt-text-secondary: #64748b;
    --rt-text-tertiary: #94a3b8;
    --rt-success: #10b981;
    --rt-warning: #f59e0b;
    --rt-error: #ef4444;
    --rt-radius: 16px;
    --rt-radius-lg: 20px;
    --rt-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --rt-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --rt-shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* Contenedor principal */
.rt-modern-tracking-page {
    /* min-height: 100vh; */
    /* background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%); */
    /* padding: 40px 20px; */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Header */
.rt-modern-header {
    max-width: 1000px;
    margin: 0 auto 30px;
    background: var(--rt-surface);
    border-radius: var(--rt-radius);
    padding: 24px 32px;
    box-shadow: var(--rt-shadow-md);
    border: 1px solid var(--rt-border);
}

.rt-modern-page-title {
    margin: 0 0 8px 0;
    color: var(--rt-text-primary);
    font-size: 28px;
    font-weight: 700;
}

.rt-modern-order-number {
    margin: 0;
    color: var(--rt-text-secondary);
    font-size: 16px;
}

/* Sección de búsqueda */
.rt-modern-search-section {
    max-width: 600px;
    margin: 0 auto;
}

.rt-modern-search-card {
    background: var(--rt-surface);
    border-radius: var(--rt-radius-lg);
    padding: 40px;
    box-shadow: var(--rt-shadow-lg);
    border: 1px solid var(--rt-border);
}

.rt-modern-title {
    margin: 0 0 12px 0;
    color: var(--rt-text-primary);
    font-size: 26px;
    font-weight: 700;
    text-align: center;
}

.rt-modern-subtitle {
    margin: 0 0 32px 0;
    color: var(--rt-text-secondary);
    font-size: 15px;
    text-align: center;
    line-height: 1.6;
}

.rt-modern-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.rt-modern-form-field label {
    display: block;
    margin-bottom: 8px;
    color: var(--rt-text-primary);
    font-size: 14px;
    font-weight: 600;
}

.rt-modern-form-field input {
    width: 100%;
    padding: 12px 16px !important;
    border: 2px solid var(--rt-border) !important;
    border-radius: 10px;
    font-size: 15px;
    color: var(--rt-text-primary) !important;
    transition: all 0.2s;
    box-sizing: border-box;
}

.rt-modern-form-field input:focus {
    outline: none;
    border-color: var(--rt-primary);
    box-shadow: 0 0 0 3px rgba(0, 179, 166, 0.1);
}

.rt-modern-btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: var(--rt-primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 14px rgba(0, 179, 166, 0.3);
}

.rt-modern-btn-primary:hover {
    background: var(--rt-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 179, 166, 0.4);
}

.rt-modern-btn-primary:active {
    background: var(--rt-primary-active);
    transform: translateY(0);
}

/* Contenido */
.rt-modern-content {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Cards */
.rt-modern-card {
    background: var(--rt-surface);
    border-radius: var(--rt-radius-lg);
    padding: 32px;
    box-shadow: var(--rt-shadow-md);
    border: 1px solid var(--rt-border);
    transition: box-shadow 0.3s;
}

.rt-modern-card:hover {
    box-shadow: var(--rt-shadow-lg);
}

/* Card de rastreo en paquetería */
.rt-tracking-carrier-card {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.rt-card-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: rgba(0, 179, 166, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rt-primary);
}

.rt-card-content {
    flex: 1;
}

.rt-card-title {
    margin: 0 0 8px 0;
    color: var(--rt-text-primary);
    font-size: 20px;
    font-weight: 600;
}

.rt-card-description {
    margin: 0 0 20px 0;
    color: var(--rt-text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.rt-tracking-input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.rt-tracking-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--rt-border);
    border-radius: 10px;
    font-size: 15px;
    color: var(--rt-text-primary);
    transition: all 0.2s;
}

.rt-tracking-input:focus {
    outline: none;
    border-color: var(--rt-primary);
    box-shadow: 0 0 0 3px rgba(0, 179, 166, 0.1);
}

.rt-tracking-btn {
    padding: 12px 24px;
    background: var(--rt-primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 179, 166, 0.25);
}

.rt-tracking-btn:hover {
    background: var(--rt-primary-hover);
    box-shadow: 0 4px 12px rgba(0, 179, 166, 0.35);
}

.rt-tracking-hint {
    margin: 0;
    color: var(--rt-text-tertiary);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Sección de productos */
.rt-products-section {
    margin-bottom: 32px;
}

.rt-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.rt-section-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rt-section-title-group h2 {
    margin: 0;
    color: var(--rt-text-primary);
    font-size: 20px;
    font-weight: 600;
}

.rt-section-title-group svg {
    color: var(--rt-text-tertiary);
}

.rt-quick-actions {
    display: flex;
    gap: 8px;
}

.rt-action-btn {
    padding: 10px 16px;
    background: rgba(0, 179, 166, 0.05);
    color: var(--rt-primary);
    border: 1px solid rgba(0, 179, 166, 0.2);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.rt-action-btn:hover {
    background: rgba(0, 179, 166, 0.1);
}

.rt-action-secondary {
    background: var(--rt-background);
    color: var(--rt-text-secondary);
    border-color: var(--rt-border);
}

.rt-action-secondary:hover {
    background: #f1f5f9;
}

.rt-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.rt-product-item {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: var(--rt-background);
    border-radius: 12px;
    border: 1px solid var(--rt-border);
    transition: all 0.2s;
}

.rt-product-item:hover {
    border-color: rgba(0, 179, 166, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.rt-product-image {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--rt-border);
}

.rt-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rt-product-details {
    flex: 1;
    min-width: 0;
}

.rt-product-name {
    margin: 0 0 4px 0;
    color: var(--rt-text-primary);
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.rt-product-qty {
    margin: 0 0 4px 0;
    color: var(--rt-text-tertiary);
    font-size: 12px;
}

.rt-product-price {
    margin: 0;
    color: var(--rt-primary);
    font-size: 14px;
    font-weight: 700;
}

/* Divisor */
.rt-section-divider {
    height: 1px;
    background: var(--rt-border);
    margin: 32px 0;
}

/* Estado del envío */
.rt-shipment-status-section {
    margin-bottom: 32px;
}

.rt-section-title-simple {
    margin: 0 0 24px 0;
    color: var(--rt-text-primary);
    font-size: 20px;
    font-weight: 600;
}

/* Timeline moderna */
.rt-modern-timeline {
    position: relative;
}

.rt-timeline-item {
    position: relative;
    padding-bottom: 40px;
}

.rt-timeline-item:last-child {
    padding-bottom: 0;
}

.rt-timeline-item:last-child .rt-timeline-connector {
    display: none;
}

.rt-timeline-connector {
    position: absolute;
    left: 24px;
    top: 48px;
    width: 2px;
    height: calc(100% + 8px);
    background: var(--rt-border);
    z-index: 0;
}

.rt-timeline-connector.active {
    background: var(--rt-primary);
}

.rt-timeline-content-wrapper {
    position: relative;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.rt-timeline-icon {
    position: relative;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 1;
}

.rt-timeline-icon.rt-status-completed {
    background: var(--rt-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 179, 166, 0.3);
}

.rt-timeline-icon.rt-status-current {
    background: white;
    color: var(--rt-primary);
    border: 4px solid var(--rt-primary);
    box-shadow: 0 4px 12px rgba(0, 179, 166, 0.2);
}

.rt-timeline-icon.rt-status-pending {
    background: var(--rt-background);
    color: var(--rt-text-tertiary);
    border: 2px solid var(--rt-border);
}

.rt-pulse-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(0, 179, 166, 0.2);
    animation: rt-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    transform: scale(1.5);
}

@keyframes rt-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1.5);
    }
    50% {
        opacity: 0;
        transform: scale(1.9);
    }
}

.rt-timeline-info {
    flex: 1;
    padding-top: 4px;
}

.rt-timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.rt-timeline-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.rt-timeline-title.rt-status-completed,
.rt-timeline-title.rt-status-current {
    color: var(--rt-text-primary);
}

.rt-timeline-title.rt-status-pending {
    color: var(--rt-text-tertiary);
}

.rt-timeline-date {
    font-size: 14px;
}

.rt-timeline-date.rt-status-completed {
    color: var(--rt-primary);
}

.rt-timeline-date.rt-status-current {
    color: var(--rt-primary);
}

.rt-timeline-date.rt-status-pending {
    color: var(--rt-text-tertiary);
}

.rt-current-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(0, 179, 166, 0.1);
    border-radius: 20px;
    margin-top: 8px;
}

.rt-pulse-dot {
    width: 6px;
    height: 6px;
    background: var(--rt-primary);
    border-radius: 50%;
    animation: rt-pulse-dot 1.5s ease-in-out infinite;
}

@keyframes rt-pulse-dot {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.rt-current-badge span {
    color: var(--rt-primary);
    font-size: 12px;
    font-weight: 600;
}

/* Información adicional */
.rt-additional-info {
    background: var(--rt-background);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--rt-border);
}

.rt-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.rt-info-item {
    display: flex;
    flex-direction: column;
}

.rt-info-label {
    margin: 0 0 12px 0;
    color: var(--rt-text-tertiary);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rt-info-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rt-info-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rt-primary);
    box-shadow: var(--rt-shadow);
    border: 1px solid var(--rt-border);
}

.rt-info-value {
    margin: 0;
    color: var(--rt-text-primary);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}

.rt-info-address .rt-info-content {
    align-items: flex-start;
}

.rt-info-address-text {
    flex: 1;
}

.rt-info-subtext {
    margin: 4px 0 0 0;
    color: var(--rt-text-tertiary);
    font-size: 12px;
}

/* Error */
.rt-modern-error {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    border: 2px solid #fee;
    border-left: 6px solid var(--rt-error);
    border-radius: var(--rt-radius);
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    box-shadow: var(--rt-shadow-md);
}

.rt-error-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.rt-error-content h3 {
    margin: 0 0 8px 0;
    color: var(--rt-error);
    font-size: 18px;
    font-weight: 600;
}

.rt-error-content p {
    margin: 0;
    color: var(--rt-text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

/* Responsive */
@media (max-width: 768px) {
    .rt-info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .rt-modern-tracking-page {
        padding: 20px 16px;
    }
    
    .rt-modern-card {
        padding: 24px 20px;
    }
    
    .rt-modern-header {
        padding: 20px 24px;
    }
    
    .rt-modern-form-grid {
        grid-template-columns: 1fr;
    }
    
    .rt-tracking-input-group {
        flex-direction: column;
    }
    
    .rt-tracking-carrier-card {
        flex-direction: column;
    }
    
    .rt-section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .rt-quick-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .rt-action-btn {
        flex: 1;
    }
}

/* =====================================================================
   ESTILOS — PÁGINA "RASTREAR ENVÍO" EN MI CUENTA DE WOOCOMMERCE
   Clases usadas por render_my_account_tracking()
   ===================================================================== */

/* Enlace "← Ver todos mis envíos" */
.rt-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--rt-primary, #00B3A6);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    margin-bottom: 20px;
}
.rt-back-link:hover {
    color: var(--rt-primary-hover, #009688);
    text-decoration: underline;
}

/* Bloque resumen del pedido */
.rt-order-summary {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--rt-border, #e2e8f0);
}
.rt-order-summary h3 {
    margin: 0 0 10px 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--rt-text-primary, #1e293b);
}

/* Badges de estado del pedido */
.rt-order-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}
.rt-status-pending    { background: #fff3cd; color: #856404; }
.rt-status-processing { background: #cfe2ff; color: #084298; }
.rt-status-on-hold    { background: #fff3cd; color: #856404; }
.rt-status-completed  { background: #d1e7dd; color: #0f5132; }
.rt-status-cancelled  { background: #f8d7da; color: #842029; }
.rt-status-refunded   { background: #e2e3e5; color: #41464b; }
.rt-status-failed     { background: #f8d7da; color: #842029; }

/* Sección "Productos y envíos" */
.rt-shipments-section h3 {
    margin: 0 0 16px 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--rt-text-primary, #1e293b);
}

/* Tarjeta individual de producto + guía */
.rt-shipment-item {
    border: 1px solid var(--rt-border, #e2e8f0);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 16px;
    background: #fff;
}
.rt-shipment-item:last-child { margin-bottom: 0; }

/* Fila imagen + nombre */
.rt-product-info {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--rt-border, #e2e8f0);
}
.rt-product-thumbnail {
    flex-shrink: 0;
}
.rt-product-thumbnail img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--rt-border, #e2e8f0);
}
.rt-product-details h4 {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--rt-text-primary, #1e293b);
    line-height: 1.4;
}
.rt-product-details .rt-product-qty {
    margin: 0;
    font-size: 13px;
    color: var(--rt-text-secondary, #64748b);
}

/* Cabecera de tracking: etiqueta + código + badge en fila */
.rt-tracking-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.rt-tracking-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--rt-text-secondary, #64748b);
    white-space: nowrap;
}
.rt-tracking-code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 14px;
    font-weight: 700;
    color: var(--rt-text-primary, #1e293b);
    background: var(--rt-background, #f8fafc);
    padding: 3px 10px;
    border-radius: 6px;
    border: 1px solid var(--rt-border, #e2e8f0);
    letter-spacing: 0.5px;
}

/* Badges de estado de guía */
.rt-status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.rt-badge-delivered { background: #d1e7dd; color: #0f5132; }
.rt-badge-transit   { background: #cfe2ff; color: #084298; }
.rt-badge-pending   { background: #fff3cd; color: #856404; }
.rt-badge-cancelled { background: #f8d7da; color: #842029; }

/* Estado Teiker */
.rt-teiker-status {
    font-size: 14px;
    color: var(--rt-text-secondary, #64748b);
    margin-bottom: 12px;
}
.rt-teiker-status strong {
    color: var(--rt-text-primary, #1e293b);
}
.rt-teiker-status span {
    font-weight: 600;
    color: var(--rt-primary, #00B3A6);
}

/* Timeline de eventos */
.rt-tracking-timeline h5 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--rt-text-primary, #1e293b);
}
.rt-timeline-list {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
}
.rt-timeline-list::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--rt-border, #e2e8f0);
}
.rt-timeline-event {
    position: relative;
    padding: 0 0 16px 28px;
}
.rt-timeline-event:last-child { padding-bottom: 0; }
.rt-timeline-dot {
    position: absolute;
    left: 0;
    top: 5px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--rt-primary, #00B3A6);
    z-index: 1;
}
.rt-timeline-event:first-child .rt-timeline-dot {
    background: var(--rt-primary, #00B3A6);
}
.rt-timeline-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.rt-timeline-date {
    font-size: 12px;
    font-weight: 600;
    color: var(--rt-primary, #00B3A6);
}
.rt-timeline-desc {
    font-size: 14px;
    color: var(--rt-text-primary, #1e293b);
    line-height: 1.4;
}

/* Estados vacíos */
.rt-no-tracking,
.rt-tracking-unavailable,
.rt-no-shipments-message {
    padding: 14px 16px;
    background: var(--rt-background, #f8fafc);
    border-radius: 8px;
    border: 1px dashed var(--rt-border, #e2e8f0);
}
.rt-no-tracking p,
.rt-tracking-unavailable p,
.rt-no-shipments-message p {
    margin: 0;
    font-size: 14px;
    color: var(--rt-text-secondary, #64748b);
}

/* Lista de pedidos (vista inicial) */
.rt-tracking-orders-list {
    display: grid;
    gap: 12px;
}
.rt-order-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border: 1px solid var(--rt-border, #e2e8f0);
    border-radius: 10px;
    background: #fff;
    transition: box-shadow 0.2s;
}
.rt-order-list-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}
.rt-order-list-item .button {
    white-space: nowrap;
    flex-shrink: 0;
}

/* Responsive */
@media (max-width: 480px) {
    .rt-product-info { flex-direction: column; }
    .rt-order-list-item { flex-direction: column; align-items: flex-start; gap: 12px; }
    .rt-order-list-item .button { width: 100%; text-align: center; }
    .rt-tracking-header { flex-direction: column; align-items: flex-start; }
}
