* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
    padding: 1.25rem 1rem;
}

.container {
    max-width: 75rem;
    margin: 0 auto;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.header h1 {
    font-size: 1.375rem;
    font-weight: 600;
    color: #1a2a3a;
    margin-bottom: 0.25rem;
}

.header p {
    font-size: 0.8125rem;
    color: #6c7a8a;
}

/* Tarjeta de búsqueda */
.search-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    border: 1px solid #eef2f6;
}

.search-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: #1a2a3a;
    margin-bottom: 0.75rem;
}

.input-group {
    display: flex;
    gap: 0.625rem;
    flex-wrap: wrap;
}

.input-group input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    transition: all 0.2s;
    background: #ffffff;
    font-family: monospace;
}

.input-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-group button {
    padding: 0.75rem 1.5rem;
    background: #1e3a5f;
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.input-group button:hover {
    background: #0f2b44;
    transform: translateY(-1px);
}

/* Grid de resultados */
.results-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Tarjetas de información */
.info-card {
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid #eef2f6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.card-header {
    padding: 0.875rem 1.25rem;
    background: #fafcfc;
    border-bottom: 1px solid #eef2f6;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-header h2 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0;
}

.card-header.pty h2 { color: #1e5a3a; }
.card-header.sfs h2 { color: #2c5f8a; }
.card-header.not-found h2 { color: #8a99aa; }

/* Estilo para tarjeta marítima (sin duplicados) */
.card-header.maritimo {
    background: #e8f4fd;
    border-bottom: 1px solid #cce5f0;
}

.card-header.maritimo .icon {
    font-size: 22px;
}

.card-header.maritimo h2 {
    color: #0c5460;
}

.card-body {
    padding: 1rem 1.25rem;
}

/* Grid de datos */
.data-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem 1.25rem;
}

.data-item {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.data-label {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #8a99aa;
}

.data-value {
    font-size: 0.875rem;
    font-weight: 500;
    color: #1e2a3a;
    word-break: break-word;
}

.data-value.large {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #0f2b44;
}

/* Badge de estado */
.status-badge {
    display: inline-block;
    padding: 0.1875rem 0.625rem;
    border-radius: 1.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
}

.status-delivered {
    background: #e6f7e6;
    color: #1e7a3a;
}

.status-transit {
    background: #e8f0fe;
    color: #1e5a8a;
}

.status-pending {
    background: #fff3e0;
    color: #c47a2e;
}

/* Timeline */
.timeline-section {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #eef2f6;
}

.timeline-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #8a99aa;
    margin-bottom: 0.75rem;
}

.timeline-item {
    position: relative;
    padding-bottom: 0.625rem;
    padding-left: 1.25rem;
    border-left: 2px solid #e2e8f0;
}

.timeline-item:last-child {
    border-left: 2px solid transparent;
    padding-bottom: 0;
}

.timeline-item::before {
    content: "●";
    position: absolute;
    left: -0.4375rem;
    top: 0;
    color: #3b82f6;
    font-size: 0.625rem;
}

.timeline-date {
    font-size: 0.625rem;
    color: #8a99aa;
    margin-bottom: 0.125rem;
    font-family: monospace;
}

.timeline-desc {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #1e2a3a;
}

/* Nota adicional */
.note-section {
    margin-top: 0.875rem;
    padding: 0.625rem 0.875rem;
    background: #f8fafc;
    border-radius: 0.75rem;
    font-size: 0.75rem;
    color: #4a5a6a;
    border-left: 3px solid #3b82f6;
}

/* Contenedor de imagen de estado */
.status-image-container {
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    text-align: center;
    background: #f8fafc;
    border-radius: 0.625rem;
}

.status-image {
    max-width: 100%;
    height: auto;
    width: auto;
    max-height: 10rem;
    object-fit: contain;
    display: inline-block;
}

/* Banner container */
.banner-container {
    margin-top: 1rem;
    text-align: center;
    background: transparent;
    border-radius: 0.75rem;
    overflow: hidden;
}

.banner-container iframe {
    width: 100%;
    min-height: 6.25rem;
    background: transparent;
    border: none;
}

/* ============================================
   LOGOS - TAMAÑOS RESPONSIVE CON REM
   ============================================ */

/* Móviles pequeños (menos de 480px) */
@media (max-width: 479px) {
    .pty-logo, .sfs-logo {
        width: 4rem;
        height: 2.75rem;
        object-fit: contain;
    }
    .card-header {
        gap: 0.625rem;
    }
    .card-header h2 {
        font-size: 0.8125rem;
    }
}

/* Móviles grandes y tablets pequeños (480px - 768px) */
@media (min-width: 480px) and (max-width: 767px) {
    .pty-logo, .sfs-logo {
        width: 5rem;
        height: 3.25rem;
        object-fit: contain;
    }
    .card-header {
        gap: 0.75rem;
    }
    .card-header h2 {
        font-size: 0.9375rem;
    }
}

/* Tablets (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .pty-logo, .sfs-logo {
        width: 6.5rem;
        height: 4rem;
        object-fit: contain;
    }
    .card-header {
        gap: 0.875rem;
    }
    .card-header h2 {
        font-size: 1.0625rem;
    }
}

/* PC escritorio (1024px - 1400px) */
@media (min-width: 1024px) and (max-width: 1399px) {
    .pty-logo, .sfs-logo {
        width: 8rem;
        height: 4.5rem;
        object-fit: contain;
    }
    .card-header {
        gap: 1rem;
    }
    .card-header h2 {
        font-size: 1.1875rem;
    }
}

/* Pantallas grandes (1400px en adelante) */
@media (min-width: 1400px) {
    .pty-logo, .sfs-logo {
        width: 9.5rem;
        height: 5.25rem;
        object-fit: contain;
    }
    .card-header {
        gap: 1.125rem;
    }
    .card-header h2 {
        font-size: 1.375rem;
    }
}

/* ============================================
   RESPONSIVE GENERAL
   ============================================ */

/* Tablets grandes y PC pequeños (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .container {
        max-width: 90%;
    }
    
    .data-grid {
        gap: 0.875rem 1.5rem;
    }
    
    .card-header {
        padding: 1rem 1.5rem;
    }
    
    .status-image {
        max-height: 8rem;
    }
}

/* PC escritorio (1024px en adelante) */
@media (min-width: 1024px) {
    body {
        padding: 2rem 1.5rem;
    }
    
    .container {
        max-width: 62.5rem;
    }
    
    .header h1 {
        font-size: 1.75rem;
    }
    
    .header p {
        font-size: 0.9375rem;
    }
    
    .search-card {
        padding: 1.75rem;
    }
    
    .search-title {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
    
    .input-group input {
        padding: 0.875rem 1.25rem;
        font-size: 0.9375rem;
    }
    
    .input-group button {
        padding: 0.875rem 2rem;
        font-size: 0.9375rem;
    }
    
    .card-header {
        padding: 1.125rem 1.75rem;
    }
    
    .card-body {
        padding: 1.25rem 1.75rem;
    }
    
    .data-grid {
        gap: 1rem 1.75rem;
    }
    
    .data-label {
        font-size: 0.6875rem;
    }
    
    .data-value {
        font-size: 0.9375rem;
    }
    
    .data-value.large {
        font-size: 1rem;
    }
    
    .status-badge {
        padding: 0.25rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .status-image {
        max-height: 12rem;
    }
    
    .timeline-date {
        font-size: 0.6875rem;
    }
    
    .timeline-desc {
        font-size: 0.875rem;
    }
    
    .note-section {
        font-size: 0.8125rem;
        padding: 0.75rem 1rem;
    }
}

/* Móviles pequeños (menos de 480px) - ajustes adicionales */
@media (max-width: 479px) {
    body {
        padding: 0.75rem;
    }
    
    .container {
        max-width: 100%;
    }
    
    .header h1 {
        font-size: 1.125rem;
    }
    
    .header p {
        font-size: 0.6875rem;
    }
    
    .search-card {
        padding: 0.875rem;
    }
    
    .search-title {
        font-size: 0.8125rem;
        margin-bottom: 0.625rem;
    }
    
    .input-group {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .input-group input {
        padding: 0.625rem 0.875rem;
        font-size: 0.8125rem;
    }
    
    .input-group button {
        padding: 0.625rem 1.25rem;
        font-size: 0.8125rem;
        justify-content: center;
    }
    
    .card-header {
        padding: 0.625rem 0.875rem;
    }
    
    .card-header h2 {
        font-size: 0.75rem;
    }
    
    .card-body {
        padding: 0.75rem 0.875rem;
    }
    
    .data-grid {
        grid-template-columns: 1fr;
        gap: 0.625rem;
    }
    
    .data-label {
        font-size: 0.5625rem;
    }
    
    .data-value {
        font-size: 0.8125rem;
    }
    
    .data-value.large {
        font-size: 0.875rem;
    }
    
    .status-badge {
        padding: 0.125rem 0.5rem;
        font-size: 0.625rem;
    }
    
    .status-image {
        max-height: 5rem;
    }
    
    .timeline-date {
        font-size: 0.5625rem;
    }
    
    .timeline-desc {
        font-size: 0.75rem;
    }
    
    .note-section {
        font-size: 0.6875rem;
        padding: 0.5rem 0.75rem;
    }
    
    .banner-container iframe {
        min-height: 4rem;
    }
}

/* Pantallas muy grandes (más de 1400px) */
@media (min-width: 1400px) {
    body {
        padding: 2.5rem;
    }
    
    .container {
        max-width: 75rem;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .search-card {
        padding: 2rem;
    }
    
    .card-header {
        padding: 1.25rem 2rem;
    }
    
    .card-body {
        padding: 1.5rem 2rem;
    }
    
    .data-grid {
        gap: 1.25rem 2rem;
    }
    
    .data-label {
        font-size: 0.75rem;
    }
    
    .data-value {
        font-size: 1rem;
    }
    
    .status-image {
        max-height: 14rem;
    }
}

/* Loader */
.loader-overlay {
    text-align: center;
    padding: 2.5rem;
}

.spinner {
    width: 2.25rem;
    height: 2.25rem;
    border: 3px solid #e2e8f0;
    border-top-color: #1e3a5f;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 0.75rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.no-data-card {
    text-align: center;
    padding: 2rem 1.25rem;
}

.no-data-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.no-data-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1a2a3a;
    margin-bottom: 0.375rem;
}

.no-data-text {
    font-size: 0.8125rem;
    color: #8a99aa;
}

.error-message {
    background: #fee;
    color: #c0392b;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    margin-bottom: 1.25rem;
    border-left: 3px solid #c0392b;
    font-size: 0.8125rem;
}

/* ============================================
   ALERTAS SUAVES
   ============================================ */
.alert-soft {
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: 12px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
    border-left: 4px solid;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.alert-soft::before {
    font-size: 1.25rem;
}

.alert-info {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border-left-color: #0284c7;
    color: #0369a1;
}
.alert-info::before { content: "ℹ️"; }

.alert-success {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border-left-color: #16a34a;
    color: #15803d;
}
.alert-success::before { content: "✅"; }

.alert-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-left-color: #d97706;
    color: #b45309;
}
.alert-warning::before { content: "⚠️"; }

.alert-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-left-color: #dc2626;
    color: #b91c1c;
}
.alert-danger::before { content: "🔴"; }

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-alert {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    color: inherit;
    padding: 0 4px;
}

.close-alert:hover {
    opacity: 1;
}

#alertas-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
    width: calc(100% - 40px);
}

@media (max-width: 480px) {
    #alertas-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        width: auto;
    }
    .alert-soft {
        padding: 0.75rem 1rem;
        font-size: 0.8125rem;
    }
}
/* Estilos personalizados para SweetAlert2 */
.swal-alerta-personalizada {
    border-radius: 16px !important;
    box-shadow: 0 20px 35px -10px rgba(0, 0, 0, 0.2) !important;
}

.swal-titulo {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
}

.swal-mensaje {
    font-size: 0.95rem !important;
    line-height: 1.5 !important;
}

/* Para pantallas pequeñas */
@media (max-width: 480px) {
    .swal2-popup {
        width: calc(100% - 30px) !important;
        margin: 0 15px !important;
    }
}