/* ================================================================
   ESTILOS PROFESIONALES Y RESPONSIVE
   ================================================================ */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    color: #333;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ================================================================
   HEADER
   ================================================================ */
.header {
    background: linear-gradient(135deg, #1a3a5c, #2a5f8f);
    color: #fff;
    padding: 18px 30px;
    border-radius: 12px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 15px rgba(26, 58, 92, 0.3);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 22px;
    font-weight: 700;
}

.logo i {
    font-size: 28px;
}

/* ================================================================
   BUSCADOR
   ================================================================ */
.buscador {
    background: #fff;
    padding: 20px 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 25px;
}

.buscador-wrapper {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.buscador-wrapper input {
    flex: 1;
    min-width: 200px;
    padding: 12px 18px;
    border: 2px solid #e0e5ea;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
    outline: none;
}

.buscador-wrapper input:focus {
    border-color: #2a5f8f;
}

.btn-buscar {
    padding: 12px 30px;
    background: #2a5f8f;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-buscar:hover {
    background: #1a3a5c;
    transform: scale(1.02);
}

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

.mensaje-error {
    margin-top: 12px;
    padding: 12px 18px;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 8px;
    border-left: 4px solid #dc2626;
    font-weight: 500;
}

/* ================================================================
   CABECERA GUÍA
   ================================================================ */
.cabecera-guia {
    background: #fff;
    padding: 18px 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px 40px;
    border-bottom: 3px solid #2a5f8f;
}

.guia-item {
    display: flex;
    flex-direction: column;
}

.guia-label {
    font-size: 11px;
    text-transform: uppercase;
    color: #888;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.guia-value {
    font-size: 16px;
    font-weight: 700;
    color: #1a3a5c;
    margin-top: 2px;
}

/* ================================================================
   DATOS DE ENTREGA
   ================================================================ */
.datos-entrega {
    background: #fff;
    padding: 20px 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.datos-entrega h3 {
    font-size: 16px;
    color: #1a3a5c;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.datos-entrega h3 i {
    color: #2a5f8f;
}

.datos-entrega-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 40px;
}

.dato-linea {
    display: flex;
    padding: 4px 0;
    border-bottom: 1px dashed #f0f0f0;
}

.dato-label {
    font-weight: 600;
    color: #555;
    min-width: 100px;
    font-size: 14px;
}

.dato-value {
    color: #1a3a5c;
    font-size: 14px;
    word-break: break-word;
}

/* ================================================================
   LÍNEA DE TIEMPO HORIZONTAL
   ================================================================ */
.timeline-horizontal {
    background: #fff;
    padding: 25px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    overflow-x: auto;
}

.timeline-horizontal-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    min-width: 700px;
    position: relative;
}

.timeline-horizontal-wrapper::before {
    content: '';
    position: absolute;
    top: 32px;
    left: 40px;
    right: 40px;
    height: 3px;
    background: #e0e5ea;
    z-index: 1;
}

.timeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
    z-index: 2;
    cursor: default;
}

.timeline-step .step-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid #d1d5db;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #aaa;
    transition: all 0.4s;
    position: relative;
}

.timeline-step.active .step-circle {
    border-color: #2a5f8f;
    background: #2a5f8f;
    color: #fff;
    box-shadow: 0 0 0 6px rgba(42, 95, 143, 0.15);
}

.timeline-step.completed .step-circle {
    border-color: #10b981;
    background: #10b981;
    color: #fff;
}

.timeline-step.completed .step-circle::after {
    content: '✓';
    font-size: 16px;
}

.timeline-step .step-label {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-align: center;
    margin-top: 8px;
    min-height: 32px;
    line-height: 1.2;
    max-width: 80px;
}

.timeline-step.active .step-label {
    color: #1a3a5c;
}

.timeline-step .step-date {
    font-size: 10px;
    color: #aaa;
    margin-top: 4px;
    text-align: center;
}

/* ================================================================
   INFERIOR WRAPPER (2 COLUMNAS)
   ================================================================ */
.inferior-wrapper {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 20px;
    margin-top: 0;
}

/* ================================================================
   COLUMNA IZQUIERDA - LÍNEA DE TIEMPO VERTICAL
   ================================================================ */
.col-timeline-vertical {
    min-width: 0;
}

.timeline-vertical-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    padding: 20px;
    height: 100%;
}

.timeline-vertical-card h4 {
    font-size: 15px;
    color: #1a3a5c;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 2px solid #f0f2f5;
    padding-bottom: 12px;
}

#timelineVertical {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Scroll personalizado */
#timelineVertical::-webkit-scrollbar {
    width: 4px;
}
#timelineVertical::-webkit-scrollbar-track {
    background: #f0f2f5;
    border-radius: 4px;
}
#timelineVertical::-webkit-scrollbar-thumb {
    background: #2a5f8f;
    border-radius: 4px;
}

.timeline-vertical-item {
    display: grid;
    grid-template-columns: 1fr 1px 1.2fr;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f2f5;
    align-items: start;
}

.timeline-vertical-item:last-child {
    border-bottom: none;
}

.timeline-vertical-item .fecha {
    font-size: 13px;
    font-weight: 600;
    color: #1a3a5c;
    line-height: 1.3;
}

.timeline-vertical-item .separador {
    background: #d1d5db;
    width: 1px;
    height: 100%;
    min-height: 40px;
    justify-self: center;
}

.timeline-vertical-item .info {
    padding-left: 4px;
}

.timeline-vertical-item .info .estado {
    font-weight: 600;
    font-size: 14px;
    color: #1a3a5c;
}

.timeline-vertical-item .info .motivo {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

.timeline-vertical-item .circulo {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #2a5f8f;
    margin-right: 8px;
    flex-shrink: 0;
}

.timeline-vertical-item .fecha-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ESTADO ACTUAL - BLOQUE INFERIOR */
.estado-actual {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 2px solid #f0f2f5;
}

.estado-actual .estado-titulo {
    font-size: 14px;
    font-weight: 700;
    color: #1a3a5c;
}

.estado-actual .estado-detalles {
    font-size: 13px;
    color: #555;
    margin-top: 4px;
    line-height: 1.5;
}

.estado-actual .estado-detalles .highlight {
    color: #2a5f8f;
    font-weight: 600;
}

/* ================================================================
   COLUMNA DERECHA - TABS
   ================================================================ */
.col-tabs {
    min-width: 0;
}

.tabs-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Navegación Tabs */
.tabs-nav {
    display: flex;
    flex-wrap: wrap;
    background: #f8f9fa;
    border-bottom: 2px solid #e0e5ea;
    padding: 4px 8px 0 8px;
    gap: 2px;
}

.tabs-nav .tab-btn {
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 8px 8px 0 0;
    font-size: 12px;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    white-space: nowrap;
}

.tabs-nav .tab-btn:hover {
    color: #1a3a5c;
    background: rgba(42, 95, 143, 0.05);
}

.tabs-nav .tab-btn.active {
    color: #1a3a5c;
    background: #fff;
    box-shadow: 0 -2px 0 #2a5f8f;
}

.tabs-nav .tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 20%;
    right: 20%;
    height: 3px;
    background: #2a5f8f;
    border-radius: 4px 4px 0 0;
}

/* Contenido Tabs */
.tabs-content {
    flex: 1;
    padding: 20px 25px;
    overflow-y: auto;
    max-height: 500px;
}

.tab-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Estilos internos de cada tab */
.tab-panel .panel-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 30px;
}

.tab-panel .panel-item {
    display: flex;
    flex-direction: column;
    padding: 6px 0;
    border-bottom: 1px dashed #f0f2f5;
}

.tab-panel .panel-item .label {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tab-panel .panel-item .value {
    font-size: 15px;
    font-weight: 500;
    color: #1a3a5c;
    margin-top: 2px;
    word-break: break-word;
}

.tab-panel .panel-full {
    grid-column: 1 / -1;
}

/* Textarea para requerimientos/reclamos */
.tab-panel textarea {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 2px solid #e0e5ea;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
    outline: none;
}

.tab-panel textarea:focus {
    border-color: #2a5f8f;
}

.tab-panel textarea:disabled {
    background: #f8f9fa;
    cursor: not-allowed;
}

.btn-actualizar {
    margin-top: 12px;
    padding: 10px 28px;
    background: #10b981;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-actualizar:hover {
    background: #059669;
    transform: scale(1.02);
}

.btn-actualizar:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
}

.btn-actualizar i {
    font-size: 14px;
}

/* Georeferenciación */
.geo-coordenadas {
    font-size: 14px;
    font-weight: 500;
    color: #1a3a5c;
    padding: 8px 0;
}

.geo-link {
    display: inline-block;
    margin-top: 8px;
    padding: 8px 20px;
    background: #2a5f8f;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.3s;
}

.geo-link:hover {
    background: #1a3a5c;
}

.geo-mapa {
    margin-top: 15px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e0e5ea;
    min-height: 200px;
    background: #f8f9fa;
    display: none;
}

.geo-mapa.visible {
    display: block;
}

.geo-mapa iframe {
    width: 100%;
    height: 250px;
    border: none;
}

/* ================================================================
   FOOTER
   ================================================================ */
.footer {
    margin-top: 30px;
    text-align: center;
    padding: 20px;
    color: #888;
    font-size: 13px;
    border-top: 1px solid #e0e5ea;
}

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

/* Tablets */
@media (max-width: 1024px) {
    .inferior-wrapper {
        grid-template-columns: 1fr;
    }
    
    .col-timeline-vertical {
        order: 2;
    }
    
    .col-tabs {
        order: 1;
    }
    
    .timeline-vertical-card {
        max-height: none;
    }
    
    #timelineVertical {
        max-height: 300px;
    }
    
    .datos-entrega-grid {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

/* Móviles grandes */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header {
        padding: 14px 18px;
        flex-direction: column;
        text-align: center;
        gap: 6px;
    }
    
    .logo {
        font-size: 18px;
    }
    
    .buscador-wrapper {
        flex-direction: column;
    }
    
    .buscador-wrapper input {
        min-width: auto;
    }
    
    .btn-buscar {
        justify-content: center;
    }
    
    .cabecera-guia {
        padding: 14px 16px;
        gap: 10px 20px;
        justify-content: center;
    }
    
    .guia-item {
        align-items: center;
        flex: 1 1 40%;
        min-width: 80px;
    }
    
    .guia-value {
        font-size: 14px;
    }
    
    .datos-entrega {
        padding: 14px 16px;
    }
    
    .datos-entrega-grid {
        grid-template-columns: 1fr;
        gap: 2px;
    }
    
    .dato-linea {
        flex-wrap: wrap;
        padding: 6px 0;
    }
    
    .dato-label {
        min-width: 80px;
        font-size: 12px;
    }
    
    .dato-value {
        font-size: 13px;
    }
    
    .timeline-horizontal {
        padding: 16px 12px;
        overflow-x: auto;
    }
    
    .timeline-horizontal-wrapper {
        min-width: 600px;
    }
    
    .timeline-step .step-label {
        font-size: 9px;
        max-width: 60px;
    }
    
    .timeline-step .step-circle {
        width: 80px;
        height: 80px;
        font-size: 11px;
    }
    
    .timeline-horizontal-wrapper::before {
        top: 26px;
        left: 20px;
        right: 20px;
    }
    
    .tabs-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 4px 4px 0 4px;
        gap: 0;
    }
    
    .tabs-nav .tab-btn {
        padding: 10px 12px;
        font-size: 10px;
        flex-shrink: 0;
    }
    
    .tabs-content {
        padding: 14px 16px;
        max-height: 400px;
    }
    
    .tab-panel .panel-grid {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    
    .timeline-vertical-item {
        grid-template-columns: 1fr 1px 1fr;
        gap: 8px;
        padding: 8px 0;
    }
    
    .timeline-vertical-item .fecha {
        font-size: 11px;
    }
    
    .timeline-vertical-item .info .estado {
        font-size: 12px;
    }
    
    .timeline-vertical-item .info .motivo {
        font-size: 10px;
    }
    
    .inferior-wrapper {
        gap: 14px;
    }
    
    .col-timeline-vertical {
        order: 2;
    }
    
    .col-tabs {
        order: 1;
    }
    
    .estado-actual .estado-titulo {
        font-size: 13px;
    }
    
    .estado-actual .estado-detalles {
        font-size: 12px;
    }
}

/* Móviles pequeños */
@media (max-width: 480px) {
    .cabecera-guia {
        flex-direction: column;
        align-items: center;
        gap: 6px;
    }
    
    .guia-item {
        flex: 1 1 auto;
        width: 100%;
        align-items: center;
    }
    
    .guia-value {
        font-size: 13px;
    }
    
    .tabs-nav .tab-btn {
        font-size: 9px;
        padding: 8px 10px;
    }
    
    .tab-panel .panel-item .value {
        font-size: 13px;
    }
    
    .timeline-vertical-item {
        grid-template-columns: 1fr;
        gap: 2px;
        border-bottom: 1px solid #f0f2f5;
        padding: 10px 0;
    }
    
    .timeline-vertical-item .separador {
        display: none;
    }
    
    .timeline-vertical-item .fecha-wrapper {
        justify-content: flex-start;
    }
    
    .btn-actualizar {
        width: 100%;
        justify-content: center;
    }
}

/* ================================================================
   LÍNEA DE TIEMPO HORIZONTAL - Iconos personalizados
   ================================================================ */
.timeline-step .step-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid #d1d5db;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s;
    position: relative;
    padding: 6px;
}

.timeline-step .step-circle .step-icon {
    width: 30px;
    height: 30px;
    object-fit: contain;
    transition: all 0.4s;
}

/* Estados inactivos (grises) */
.timeline-step .step-circle .step-icon {
    opacity: 0.3;
    filter: grayscale(100%);
}

/* Estados completados (verde) */
.timeline-step.completed .step-circle {
    border-color: #10b981;
    background: #d1fae5;
}

.timeline-step.completed .step-circle .step-icon {
    opacity: 1;
    filter: grayscale(0%);
}

/* Estado activo (azul) */
.timeline-step.active .step-circle {
    border-color: #2a5f8f;
    background: #e8f0fe;
    box-shadow: 0 0 0 6px rgba(42, 95, 143, 0.15);
    animation: pulse-circle 1.5s ease-in-out infinite;
}

.timeline-step.active .step-circle .step-icon {
    opacity: 1;
    filter: grayscale(0%);
}

@keyframes pulse-circle {
    0%, 100% { box-shadow: 0 0 0 6px rgba(42, 95, 143, 0.15); }
    50% { box-shadow: 0 0 0 12px rgba(42, 95, 143, 0.05); }
}

/* Ajuste responsive para los iconos */
@media (max-width: 768px) {
    .timeline-step .step-circle {
        width: 80px;
        height: 80px;
        padding: 4px;
    }
    
    .timeline-step .step-circle .step-icon {
        width: 24px;
        height: 24px;
    }
}

@media (max-width: 480px) {
    .timeline-step .step-circle {
        width: 34px;
        height: 34px;
        padding: 3px;
    }
    
    .timeline-step .step-circle .step-icon {
        width: 20px;
        height: 20px;
    }
}