/* Rastreo público — estilos autocontenidos (Planet Express) */

:root {
    --color-primary: #e91a22;
    --color-primary-dark: #c4161d;
    --color-primary-light: #ff4d54;
    --color-primary-rgb: 233, 26, 34;
    --color-text-primary: #333;
    --color-text-secondary: #666;
    --color-text-muted: #6c757d;
    --bg-page: #f4f6f9;
    --bg-primary: #ffffff;
    --bg-hover: #f8f9fa;
    --border-color: #e9ecef;
    --border-radius: 8px;
    --border-radius-lg: 14px;
    --shadow-card: 0 2px 12px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-brand: 0 4px 14px rgba(var(--color-primary-rgb), 0.12);
    --font-family: 'Raleway', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-size-base: 14px;
    --font-size-sm: 13px;
    --transition-fast: 0.2s ease;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body.rastreo-page {
    min-height: 100vh;
    font-family: var(--font-family);
    color: var(--color-text-primary);
    position: relative;
    overflow-x: hidden;
    isolation: isolate;
    background: linear-gradient(
        180deg,
        rgba(var(--color-primary-rgb), 0.04) 0%,
        var(--bg-page) 180px,
        var(--bg-page) 100%
    ) !important;
}

body.rastreo-page::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(circle 170px at calc(100% - 30px) 20px, rgba(var(--color-primary-rgb), 0.06) 170px, transparent 170px),
        radial-gradient(circle 150px at 20px calc(100% - 40px), rgba(var(--color-primary-rgb), 0.05) 150px, transparent 150px),
        radial-gradient(circle 80px at 48% 42%, rgba(var(--color-primary-rgb), 0.04) 80px, transparent 80px),
        radial-gradient(circle 60px at 78% 78%, rgba(var(--color-primary-rgb), 0.035) 60px, transparent 60px);
}

.rastreo-wrap {
    position: relative;
    z-index: 1;
    max-width: 460px;
    margin: 0 auto;
    padding: 48px 20px 48px;
    animation: rastreoFadeInUp 0.55s ease-out;
}

.rastreo-results-wrap {
    max-width: 720px;
}

@keyframes rastreoFadeInUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rastreo-logo {
    text-align: center;
    margin-bottom: 0;
    padding-bottom: 24px;
}

.rastreo-logo a {
    display: inline-block;
    text-decoration: none;
}

.rastreo-logo img {
    max-width: min(100%, 360px);
    max-height: 120px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: inline-block;
}

.rastreo-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.rastreo-back-link:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

.rastreo-card {
    position: relative;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-card);
    padding: 28px 24px 24px;
    overflow: hidden;
    margin-bottom: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.rastreo-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 16px;
    bottom: 16px;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: var(--color-primary);
}

.rastreo-card:last-child {
    margin-bottom: 0;
}

.rastreo-card--form:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-brand);
}

.rastreo-card-header {
    margin: 0 0 16px;
    padding-left: 8px;
}

.rastreo-card-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--color-primary);
}

.rastreo-title {
    margin: 0 0 10px;
    text-align: center;
    font-size: 26px;
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: -0.3px;
}

.rastreo-subtitle {
    margin: 0 0 28px;
    text-align: center;
    font-size: 14px;
    line-height: 1.55;
    color: var(--color-text-secondary);
}

.rastreo-form .form-group {
    margin-bottom: 0;
}

.rastreo-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.rastreo-input-wrap {
    position: relative;
}

.rastreo-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    z-index: 2;
}

.rastreo-input {
    width: 100%;
    height: auto !important;
    padding: 14px 16px 14px 44px !important;
    border: 2px solid #e8ecf1 !important;
    border-radius: 10px !important;
    background: #f8fafc !important;
    font-size: 15px !important;
    letter-spacing: 0.4px;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
}

.rastreo-input:focus {
    border-color: var(--color-primary) !important;
    background: #fff !important;
    box-shadow: 0 0 0 4px rgba(var(--color-primary-rgb), 0.12) !important;
    outline: none;
}

.rastreo-submit {
    width: 100%;
    margin-top: 24px;
    padding: 14px 18px !important;
    border: none !important;
    border-radius: 10px !important;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light)) !important;
    color: #fff !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 15px rgba(var(--color-primary-rgb), 0.35);
    transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
}

.rastreo-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(var(--color-primary-rgb), 0.45);
    background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary)) !important;
}

.rastreo-submit:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

/* Empty / alert states */
.rastreo-empty {
    text-align: center;
    padding: 32px 24px;
}

.rastreo-empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: 16px;
    border-radius: 50%;
    background: rgba(var(--color-primary-rgb), 0.1);
    color: var(--color-primary);
    font-size: 24px;
    font-weight: 700;
}

.rastreo-empty p {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

/* Summary grid */
.rastreo-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding-left: 8px;
}

.rastreo-summary-item {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 12px 14px;
}

.rastreo-summary-item--full {
    grid-column: 1 / -1;
}

.rastreo-summary-label {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--color-text-muted);
}

.rastreo-summary-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-primary);
    word-break: break-word;
}

.rastreo-attachment-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
}

.rastreo-attachment-link:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

/* Tables */
.rastreo-table-wrap {
    padding-left: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-rastreo {
    width: 100%;
    border-collapse: collapse;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--bg-primary);
    font-size: var(--font-size-base);
}

.table-rastreo thead {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
}

.table-rastreo thead th {
    padding: 12px 14px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #fff;
    text-align: left;
    white-space: nowrap;
    border: none;
}

.table-rastreo tbody td {
    padding: 12px 14px;
    vertical-align: top;
    color: var(--color-text-primary);
    border-bottom: 1px solid var(--border-color);
    font-size: var(--font-size-sm);
}

.table-rastreo tbody tr:last-child td {
    border-bottom: none;
}

.table-rastreo tbody tr:hover {
    background: var(--bg-hover);
}

/* Timeline */
.rastreo-timeline {
    padding-left: 8px;
}

.rastreo-timeline-item {
    position: relative;
    padding: 0 0 20px 28px;
    border-left: 2px solid var(--border-color);
    margin-left: 8px;
}

.rastreo-timeline-item:last-child {
    padding-bottom: 0;
    border-left-color: transparent;
}

.rastreo-timeline-item::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-primary);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), 0.2);
}

.rastreo-timeline-date {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.rastreo-timeline-status {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 4px;
}

.rastreo-timeline-guide {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.rastreo-timeline-comment {
    font-size: 14px;
    color: var(--color-text-secondary);
    line-height: 1.45;
}

.rastreo-signature {
    margin-top: 12px;
}

.rastreo-signature img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.rastreo-btn-track {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 16px !important;
    border: none !important;
    border-radius: 8px !important;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light)) !important;
    color: #fff !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(var(--color-primary-rgb), 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rastreo-btn-track:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--color-primary-rgb), 0.4);
}

#StatusExt:empty {
    display: none;
}

@media (max-width: 767px) {
    .rastreo-wrap {
        padding: 36px 16px 36px;
    }

    .rastreo-logo {
        padding-bottom: 16px;
    }

    .rastreo-logo img {
        max-height: 100px;
        max-width: 320px;
    }

    .rastreo-card {
        padding: 22px 18px 18px;
    }

    .rastreo-title {
        font-size: 22px;
    }

    .rastreo-input {
        font-size: 14px !important;
        padding: 12px 14px 12px 40px !important;
    }

    .rastreo-summary-grid {
        grid-template-columns: 1fr;
    }

    .table-rastreo thead th,
    .table-rastreo tbody td {
        padding: 10px 12px;
        font-size: 12px;
    }
}
