/* ===================== RASTREAR ENVÍO ===================== */

.rastrear-main {
    min-height: 100vh;
    padding: 100px 20px 40px;
    background: var(--cream);
}

.rastrear-container {
    max-width: 900px;
    margin: 0 auto;
}

.rastrear-header {
    text-align: center;
    margin-bottom: 50px;
}

.rastrear-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.5em;
    color: var(--dark-brown);
    margin-bottom: 10px;
}

.rastrear-header p {
    font-size: 1.1em;
    color: var(--gray);
    font-weight: 300;
}

/* ===================== SECCIÓN DE BÚSQUEDA ===================== */

.search-section {
    background: var(--white);
    padding: 40px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    margin-bottom: 40px;
}

.search-form {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.search-section .form-group {
    flex: 1;
    min-width: 250px;
    margin-bottom: 0;
}

.search-section .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-brown);
    font-size: 0.95em;
}

.search-section .form-group small {
    display: block;
    margin-top: 5px;
    color: var(--gray);
    font-size: 0.85em;
}

.search-section .form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--beige);
    border-radius: 8px;
    font-size: 1em;
    font-family: 'Poppins', sans-serif;
    color: var(--dark-brown);
    background: var(--white);
    transition: border-color 0.3s;
}

.search-section .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(192, 99, 49, 0.1);
}

.btn-buscar {
    padding: 12px 30px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.btn-buscar:hover {
    background: var(--dark-brown);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(79, 60, 54, 0.25);
}

.btn-buscar:active {
    transform: translateY(0);
}

/* ===================== TARJETA DE ORDEN ===================== */

.order-card {
    background: var(--white);
    border-radius: 15px;
    box-shadow: var(--shadow);
    padding: 40px;
    margin-bottom: 40px;
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0ebe3;
}

.order-info h2 {
    font-family: 'Playfair Display', serif;
    color: var(--dark-brown);
    margin: 0 0 10px 0;
}

.order-info h2 span {
    color: var(--primary);
    font-weight: 700;
}

.order-date {
    color: var(--gray);
    margin: 0;
    font-size: 0.95em;
}

.order-status-badge {
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 700;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-width: 150px;
    text-align: center;
    font-family: 'Poppins', sans-serif;
}

/* Estados del badge */
.status-confirmado,
.status-pagado {
    background: #fdf3ec;
    color: var(--primary);
    border: 1px solid #f0c4a0;
}

.status-preparando {
    background: #fdf5e0;
    color: #9a6700;
    border: 1px solid #f0d88a;
}

.status-en_camino {
    background: #eef4fd;
    color: #2558a3;
    border: 1px solid #b3cdf5;
}

.status-entregado {
    background: #edf7ee;
    color: #2e7d32;
    border: 1px solid #a8d5ab;
}

.status-cancelado,
.status-rechazado {
    background: #fdecea;
    color: #c0392b;
    border: 1px solid #f5b7b1;
}

.status-pendiente {
    background: #f5f0eb;
    color: var(--dark-brown);
    border: 1px solid var(--beige);
}

/* ===================== TIMELINE ===================== */

.timeline-container {
    margin: 50px 0;
    position: relative;
}

.timeline-item {
    display: flex;
    margin-bottom: 30px;
    position: relative;
}

/* Punto base — pendiente */
.timeline-dot {
    min-width: 24px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ddd5ca;
    border: 3px solid var(--white);
    box-shadow: 0 0 0 2px #ddd5ca;
    margin-right: 25px;
    flex-shrink: 0;
    margin-top: 5px;
    position: relative;
    z-index: 2;
    transition: all 0.4s ease;
}

/* Etapa ya superada — dorado/beige MADA */
.timeline-dot.completado {
    background: var(--beige);
    border-color: var(--white);
    box-shadow: 0 0 0 3px rgba(232, 189, 144, 0.35);
}

/* Etapa actual — naranja principal MADA con pulso */
.timeline-dot.activo {
    background: var(--primary);
    border-color: var(--white);
    box-shadow: 0 0 0 4px rgba(192, 99, 49, 0.25);
    animation: pulse-mada 2s infinite;
}

@keyframes pulse-mada {
    0%   { box-shadow: 0 0 0 4px rgba(192, 99, 49, 0.25); }
    50%  { box-shadow: 0 0 0 9px rgba(192, 99, 49, 0.08); }
    100% { box-shadow: 0 0 0 4px rgba(192, 99, 49, 0.25); }
}

/* Entregado — verde de éxito */
.timeline-dot.entregado-final {
    background: #2e7d32;
    border-color: var(--white);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.2);
}

/* Línea vertical */
.timeline-line {
    position: absolute;
    left: 11px;
    top: 35px;
    width: 2px;
    height: 60px;
    background: #ddd5ca;
    z-index: 1;
    transition: background 0.4s ease;
}

.timeline-line.completado {
    background: var(--beige);
}

.timeline-item:last-child .timeline-line {
    display: none;
}

.timeline-content h4 {
    margin: 0 0 5px 0;
    color: var(--dark-brown);
    font-weight: 700;
    font-size: 1.05em;
}

.timeline-content h4.texto-pendiente {
    color: var(--gray);
    font-weight: 400;
}

.timeline-content p {
    margin: 0;
    color: var(--gray);
    font-size: 0.9em;
}

/* ===================== DETALLES DEL PEDIDO ===================== */

.order-details {
    margin-top: 40px;
}

.details-section {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 2px solid #f0ebe3;
}

.details-section:last-child {
    border-bottom: none;
}

.details-section h3 {
    font-family: 'Playfair Display', serif;
    color: var(--dark-brown);
    margin: 0 0 20px 0;
    font-size: 1.3em;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.detail-item label {
    display: block;
    color: var(--gray);
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.detail-item p {
    margin: 0;
    color: var(--dark-brown);
    font-size: 1em;
}

.address-box {
    background: #fdf7f0;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.address-box p {
    margin: 8px 0;
    color: var(--dark-brown);
    line-height: 1.6;
}

.delivery-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.delivery-info p {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--dark-brown);
    font-size: 1.05em;
}

.delivery-info i {
    color: var(--primary);
    font-size: 1.2em;
}

.items-list {
    display: grid;
    gap: 15px;
}

.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #fdf7f0;
    border-radius: 8px;
}

.item-info h5 {
    margin: 0 0 5px 0;
    color: var(--dark-brown);
    font-weight: 700;
}

.item-info p {
    margin: 0;
    color: var(--gray);
    font-size: 0.9em;
}

.item-price {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1em;
}

/* ===================== BOTONES DE ACCIÓN ===================== */

.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.btn-secondary {
    flex: 1;
    min-width: 150px;
    padding: 14px 25px;
    background: var(--white);
    color: var(--dark-brown);
    border: 2px solid var(--beige);
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(192, 99, 49, 0.25);
}

/* ===================== ALERTAS ===================== */

.alert {
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.alert-error {
    background: #fdecea;
    color: #c0392b;
    border-left: 4px solid #c0392b;
}

.alert i {
    font-size: 1.5em;
    flex-shrink: 0;
}

.alert p {
    margin: 0;
    font-weight: 600;
}

/* ===================== SECCIÓN DE INFORMACIÓN ===================== */

.info-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 50px;
}

.info-card {
    background: var(--white);
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border-top: 3px solid var(--beige);
}

.info-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(79, 60, 54, 0.12);
    border-top-color: var(--primary);
}

.info-card i {
    font-size: 2.2em;
    color: var(--primary);
    margin-bottom: 15px;
}

.info-card h3 {
    font-family: 'Playfair Display', serif;
    color: var(--dark-brown);
    margin: 15px 0 10px 0;
    font-size: 1.15em;
}

.info-card p {
    color: var(--gray);
    line-height: 1.6;
    margin: 0;
    font-size: 0.95em;
}

/* ===================== RESPONSIVE ===================== */

@media (max-width: 768px) {
    .rastrear-main { padding: 80px 15px 30px; }
    .rastrear-header h1 { font-size: 1.8em; }
    .order-card { padding: 25px; }
    .order-header { flex-direction: column; gap: 15px; text-align: center; }
    .order-status-badge { width: 100%; }
    .search-form { flex-direction: column; }
    .btn-buscar { width: 100%; justify-content: center; }
    .action-buttons { flex-direction: column; }
    .btn-secondary { width: 100%; }
    .details-grid { grid-template-columns: 1fr; }
    .delivery-info { grid-template-columns: 1fr; }
    .timeline-item { margin-bottom: 25px; }
    .timeline-content h4 { font-size: 1em; }
}

@media (max-width: 480px) {
    .rastrear-header h1 { font-size: 1.5em; }
    .search-section { padding: 20px; }
    .order-card { padding: 20px; }
    .details-section { margin-bottom: 20px; padding-bottom: 20px; }
    .details-section h3 { font-size: 1.1em; }
    .timeline-dot { width: 20px; height: 20px; }
    .timeline-line { left: 9px; }
    .info-section { grid-template-columns: 1fr; }
}
