/**
 * Estilos públicos para Warao Express
 */

/* Contenedores principales */
.te-tracking-form-container,
.te-calculator-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.te-tracking-result {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* Títulos */
.te-tracking-title,
.te-calculator-title {
    font-size: 2rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 1rem;
    text-align: center;
}

.te-calculator-subtitle {
    text-align: center;
    color: #495057;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.te-result-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
}

/* Instrucciones */
.te-tracking-instructions {
    background: #e6f0ff;
    border: 1px solid #0057b7;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    color: #004494;
}

/* Formularios */
.te-tracking-form .te-form-group,
.te-calculator-form .te-form-group {
    margin-bottom: 1.5rem;
}

.te-tracking-form .te-form-group {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.te-input,
.te-select,
.te-textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    line-height: 1.5;
    transition: all 0.3s ease;
    background: #ffffff;
}

.te-input:focus,
.te-select:focus,
.te-textarea:focus {
    outline: none;
    border-color: #0057b7;
    box-shadow: 0 0 0 3px rgba(0, 87, 183, 0.1);
}

.te-input::placeholder {
    color: #6c757d;
}

/* Formulario de tracking específico */
.te-tracking-form .te-input {
    flex: 1;
    height: 56px;
}

.te-tracking-form .te-btn-primary {
    height: 56px;
    padding: 0 2rem;
    white-space: nowrap;
}

/* Botones */
.te-btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    background: none;
}

.te-btn-primary {
    background: #0057b7;
    color: #ffffff;
}

.te-btn-primary:hover {
    background: #004494;
    transform: scale(1.03);
}

.te-btn-primary:active {
    transform: scale(0.98);
}

.te-btn-secondary {
    background: transparent;
    color: #0057b7;
    border: 1px solid #0057b7;
}

.te-btn-secondary:hover {
    background: #e6f0ff;
}

/* Mensajes */
.te-form-message {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    font-weight: 500;
}

.te-form-message.success {
    background: #e8f3ed;
    color: #1b8754;
    border: 1px solid #1b8754;
}

.te-form-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #dc3545;
}

.te-error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #dc3545;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    font-weight: 500;
}

/* Calculadora - secciones */
.te-form-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.te-form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.te-form-section h4 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 1rem;
}

/* Filas de formulario */
.te-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.te-form-group-sm {
    margin-bottom: 0;
}

/* Labels */
.te-input + label,
.te-select + label,
.te-textarea + label {
    margin-bottom: 0.5rem;
    display: block;
    font-weight: 600;
    color: #495057;
}

/* Acciones del formulario */
.te-form-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* Estado del envío - resumen */
.te-shipment-overview {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 12px;
}

.te-status-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 32px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.te-status-received {
    background: #e6f0ff;
    color: #0057b7;
}

.te-status-in_transit {
    background: #fff3cd;
    color: #856404;
}

.te-status-customs {
    background: #ffeaa7;
    color: #d63031;
}

.te-status-delivered {
    background: #e8f3ed;
    color: #1b8754;
}

.te-status-exception,
.te-status-returned {
    background: #f8d7da;
    color: #721c24;
}

/* Detalles del envío */
.te-shipment-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.te-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.te-label {
    font-weight: 600;
    color: #495057;
}

.te-value {
    font-weight: 500;
    color: #212529;
}

/* Historial de tracking */
.te-tracking-history {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #e9ecef;
}

.te-tracking-history h4 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 1.5rem;
}

/* Timeline */
.te-timeline {
    position: relative;
    padding-left: 2rem;
}

.te-timeline::before {
    content: '';
    position: absolute;
    left: 0.75rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e9ecef;
}

.te-timeline-item {
    position: relative;
    margin-bottom: 2rem;
}

.te-timeline-marker {
    position: absolute;
    left: -2rem;
    top: 0.5rem;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    border: 3px solid #ffffff;
    box-shadow: 0 0 0 2px #e9ecef;
}

.te-timeline-marker.te-status-received {
    background: #0057b7;
    box-shadow: 0 0 0 2px #0057b7;
}

.te-timeline-marker.te-status-in_transit {
    background: #ffc107;
    box-shadow: 0 0 0 2px #ffc107;
}

.te-timeline-marker.te-status-customs {
    background: #ff6b6b;
    box-shadow: 0 0 0 2px #ff6b6b;
}

.te-timeline-marker.te-status-delivered {
    background: #1b8754;
    box-shadow: 0 0 0 2px #1b8754;
}

.te-timeline-content {
    background: #ffffff;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.te-timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.te-timeline-status {
    font-weight: 600;
    color: #212529;
}

.te-timeline-date {
    font-size: 0.875rem;
    color: #6c757d;
}

.te-timeline-location {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.25rem;
}

.te-timeline-notes {
    font-size: 0.875rem;
    color: #6c757d;
    font-style: italic;
}

/* Resultado de la calculadora */
.te-calculator-result {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.te-calculator-result h4 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 1.5rem;
    text-align: center;
}

.te-result-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.te-result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

.te-result-row.te-result-total {
    border-top: 2px solid #0057b7;
    padding-top: 1rem;
    margin-top: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.te-result-notes {
    font-size: 0.875rem;
    color: #6c757d;
    text-align: center;
    font-style: italic;
}

/* Lista de envíos */
.te-shipments-list {
    max-width: 100%;
    margin: 0 auto;
}

.te-shipments-header {
    margin-bottom: 1.5rem;
}

.te-shipments-header h4 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #212529;
}

.te-shipments-table {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.te-table-header,
.te-table-row {
    display: grid;
    grid-template-columns: 2fr 2fr 1.5fr 1fr 1.5fr;
    gap: 1rem;
    padding: 1rem;
    align-items: center;
}

.te-table-header {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
    border-bottom: 1px solid #e9ecef;
}

.te-table-row {
    border-bottom: 1px solid #e9ecef;
}

.te-table-row:last-child {
    border-bottom: none;
}

.te-table-row:hover {
    background: #f8f9fa;
}

.te-table-cell {
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
    .te-tracking-form-container,
    .te-calculator-container,
    .te-tracking-result {
        margin: 1rem;
        padding: 1.5rem;
    }

    .te-tracking-title,
    .te-calculator-title {
        font-size: 1.5rem;
    }

    .te-tracking-form .te-form-group {
        flex-direction: column;
    }

    .te-tracking-form .te-input {
        height: auto;
    }

    .te-tracking-form .te-btn-primary {
        height: auto;
        padding: 1rem;
    }

    .te-form-row {
        grid-template-columns: 1fr;
    }

    .te-form-actions {
        flex-direction: column;
    }

    .te-shipment-overview {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .te-timeline {
        padding-left: 1.5rem;
    }

    .te-timeline-marker {
        left: -1.5rem;
    }

    .te-table-header,
    .te-table-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        text-align: left;
    }

    .te-table-header::before,
    .te-table-row::before {
        content: attr(data-label);
        font-weight: 600;
        color: #495057;
        display: block;
        margin-bottom: 0.25rem;
    }

    .te-timeline-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.te-tracking-result,
.te-calculator-result {
    animation: fadeIn 0.5s ease-out;
}

/* Loading states */
.te-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
    position: relative;
}

.te-btn.loading::after {
    content: '';
    position: absolute;
    width: 1rem;
    height: 1rem;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility */
.te-input:focus-visible,
.te-select:focus-visible,
.te-textarea:focus-visible,
.te-btn:focus-visible {
    outline: 2px solid #0057b7;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .te-tracking-form-container,
    .te-calculator-container,
    .te-tracking-result {
        border: 2px solid #000000;
    }
    
    .te-btn-primary {
        border: 2px solid #000000;
    }
}