/* =============================================
   RASTRAR EXPLORER - Estilos específicos para Lot
   Versión: 3.0
   Compatible con explorer.css
   ============================================= */

/* =============================================
   LOT HERO - Sección principal del lote
   ============================================= */
.lot-hero {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 32px;
    align-items: start;
}

@media (max-width: 768px) {
    .lot-hero {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

.lot-hero-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.lot-image-container {
    width: 180px;
    height: 180px;
    background: linear-gradient(135deg, var(--accent-info) 0%, #1d4ed8 100%);
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.lot-image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.lot-image-container i {
    font-size: 64px;
    color: white;
    opacity: 0.9;
}

.lot-barcode {
    background: white;
    padding: 10px 16px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    max-width: 200px;
    overflow: hidden;
}

.lot-barcode:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
}

.lot-barcode svg {
    max-width: 100%;
    height: auto;
}

.lot-hero-right {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.lot-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.lot-title {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lot-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.lot-number {
    font-size: 28px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.lot-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.lot-status-activo {
    background: rgba(76, 175, 80, 0.15);
    color: var(--accent-secondary);
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.lot-status-despachado {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-info);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.lot-product-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.lot-brand {
    font-weight: 400;
    color: var(--text-muted);
}

.lot-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* LGTIN Display */
.lgtin-display {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 12px 16px;
}

.lgtin-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.lgtin-code {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lgtin-code code {
    font-family: 'Fira Code', 'Monaco', monospace;
    font-size: 13px;
    color: var(--accent-primary);
    background: transparent;
    word-break: break-all;
    flex: 1;
}

.btn-icon-small {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(101, 195, 200, 0.15);
    color: var(--accent-primary);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.btn-icon-small:hover {
    background: rgba(101, 195, 200, 0.25);
    transform: scale(1.05);
}

/* Lot Info Grid */
.lot-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.lot-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lot-info-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.lot-info-value {
    font-size: 14px;
    color: var(--text-primary);
}

.lot-info-link {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.lot-info-link:hover {
    color: var(--accent-secondary);
}

.lot-info-link i {
    font-size: 10px;
    margin-left: 4px;
}

/* =============================================
   FLUJO ORIGEN → DESTINO
   ============================================= */
.flow-container {
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 20px 0;
}

@media (max-width: 900px) {
    .flow-container {
        flex-direction: column;
        gap: 20px;
    }
}

.flow-point {
    flex: 1;
    display: flex;
    gap: 16px;
    padding: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: all var(--transition-normal);
}

.flow-point:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-sm);
}

.flow-origin {
    border-left: 3px solid var(--accent-secondary);
}

.flow-destination {
    border-left: 3px solid var(--accent-info);
}

.flow-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.flow-origin .flow-icon {
    background: rgba(76, 175, 80, 0.15);
    color: var(--accent-secondary);
}

.flow-destination .flow-icon {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-info);
}

.flow-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.flow-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.flow-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.flow-name-pending {
    color: var(--text-muted);
    font-style: italic;
}

.flow-detail {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.flow-detail i {
    width: 16px;
    color: var(--text-muted);
}

.flow-detail-muted {
    color: var(--text-muted);
    font-style: italic;
}

.flow-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.flow-link:hover .gln-badge {
    background: rgba(101, 195, 200, 0.25);
}

.gln-badge {
    font-size: 11px;
    font-family: 'Fira Code', monospace;
    padding: 4px 10px;
    background: rgba(101, 195, 200, 0.15);
    color: var(--accent-primary);
    border-radius: 4px;
    border: 1px solid rgba(101, 195, 200, 0.3);
}

.flow-link i {
    font-size: 10px;
    color: var(--accent-primary);
}

/* Flecha central - HORIZONTAL */
.flow-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
    min-width: 220px;
    flex-direction: row;
}

@media (max-width: 900px) {
    .flow-arrow {
        flex-direction: column;
        padding: 20px 0;
        min-width: auto;
    }
}

.flow-arrow-line {
    flex: 1;
    height: 2px;
    min-width: 30px;
    background: linear-gradient(to right, var(--accent-secondary), var(--accent-info));
    position: relative;
}

/* Flecha al final de la línea derecha */
.flow-arrow-line:last-child::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 8px solid var(--accent-info);
}

/* Sin flecha en la línea izquierda */
.flow-arrow-line:first-child::after {
    display: none;
}

@media (max-width: 900px) {
    .flow-arrow-line {
        width: 2px;
        height: 30px;
        min-width: auto;
        flex: none;
        background: linear-gradient(to bottom, var(--accent-secondary), var(--accent-info));
    }
    
    .flow-arrow-line:last-child::after {
        right: auto;
        bottom: -6px;
        top: auto;
        left: 50%;
        transform: translateX(-50%);
        border-left: 6px solid transparent;
        border-right: 6px solid transparent;
        border-top: 8px solid var(--accent-info);
        border-bottom: none;
    }
}

.flow-arrow-info {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    text-align: center;
    min-width: 160px;
}

.flow-arrow-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    color: white;
    font-size: 18px;
}

.flow-arrow-weight {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.flow-arrow-lot {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.flow-arrow-dates {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 10px;
    font-size: 11px;
    color: var(--text-secondary);
}

.flow-arrow-dates span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.flow-arrow-dates i {
    color: var(--text-muted);
}

/* Badge de vencimiento */
.flow-expiry-badge {
    margin-top: 10px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.flow-expiry-badge.expired {
    background: rgba(255, 107, 107, 0.15);
    color: var(--accent-danger);
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.flow-expiry-badge.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.flow-expiry-badge.ok {
    background: rgba(76, 175, 80, 0.15);
    color: var(--accent-secondary);
    border: 1px solid rgba(76, 175, 80, 0.3);
}

/* =============================================
   STATS GRID - KPIs
   ============================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    transition: all var(--transition-normal);
}

.stat-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 20px;
}

.stat-icon-primary {
    background: rgba(101, 195, 200, 0.15);
    color: var(--accent-primary);
}

.stat-icon-input {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

.stat-icon-internal {
    background: rgba(76, 175, 80, 0.15);
    color: var(--accent-secondary);
}

.stat-icon-output {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-warning);
}

.stat-icon-days {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-info);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* =============================================
   ACORDEONES DE EVENTOS
   ============================================= */
.accordion {
    margin-bottom: 12px;
}

.accordion.has-events .accordion-header {
    background: var(--bg-secondary);
}

.accordion-count {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-primary);
    padding: 4px 10px;
    border-radius: 12px;
    margin-left: 12px;
}

.accordion[data-category="input"] .accordion-title i {
    color: #8b5cf6;
}

.accordion[data-category="internal"] .accordion-title i {
    color: var(--accent-secondary);
}

.accordion[data-category="output"] .accordion-title i {
    color: var(--accent-warning);
}

/* =============================================
   EVENT CARDS
   ============================================= */
.event-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    margin-bottom: 12px;
    overflow: hidden;
    transition: all var(--transition-normal);
}

.event-card:hover {
    border-color: var(--accent-primary);
}

.event-card:last-child {
    margin-bottom: 0;
}

.event-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.event-card-icon {
    width: 40px;
    height: 40px;
    background: rgba(101, 195, 200, 0.15);
    color: var(--accent-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.event-card-title {
    flex: 1;
}

.event-card-title h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.event-card-title p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

.event-card-title .event-location-display {
    font-size: 12px;
    color: var(--accent-primary);
    margin: 4px 0 0 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.event-card-title .event-location-display i {
    font-size: 10px;
}

.event-card-time {
    text-align: right;
    flex-shrink: 0;
}

.event-date {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.event-time {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
}

.event-card-body {
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.event-detail {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.event-detail i {
    color: var(--text-muted);
    width: 14px;
}

.event-detail-blockchain {
    color: var(--accent-secondary);
}

.event-detail-blockchain i:last-child {
    color: var(--accent-secondary);
}

.event-card-footer {
    padding: 12px 16px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
}

.btn-event-detail {
    background: transparent;
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-event-detail:hover {
    background: var(--accent-primary);
    color: white;
}

/* =============================================
   BLOCKCHAIN INFO
   ============================================= */
.blockchain-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.blockchain-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 16px;
}

.blockchain-network {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.blockchain-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.blockchain-dot-lacchain {
    background: #00c853;
}

.blockchain-dot-rollux {
    background: #9c27b0;
}

.blockchain-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.blockchain-value {
    display: flex;
    align-items: center;
    gap: 12px;
}

.blockchain-value code {
    font-family: 'Fira Code', monospace;
    font-size: 12px;
    color: var(--accent-primary);
    word-break: break-all;
    flex: 1;
}

.blockchain-value a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: inherit;
    text-decoration: none;
    flex: 1;
}

.blockchain-value a:hover code {
    color: var(--accent-secondary);
}

.blockchain-value a i {
    color: var(--text-muted);
    flex-shrink: 0;
}

/* =============================================
   EMPTY STATES
   ============================================= */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 64px;
    opacity: 0.3;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
}

.empty-state-small {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

/* =============================================
   LOT CARDS (para Cosecha/Salida)
   ============================================= */
.lot-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    margin-bottom: 12px;
    overflow: hidden;
    transition: all var(--transition-normal);
}

.lot-card:hover {
    border-color: var(--accent-primary);
}

.lot-card:last-child {
    margin-bottom: 0;
}

.lot-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.lot-card-barcode {
    background: white;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    flex-shrink: 0;
    max-width: 100px;
    overflow: hidden;
}

.lot-card-barcode:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.lot-card-barcode svg {
    display: block;
    max-width: 100%;
    height: auto;
}

.lot-card-icon {
    width: 40px;
    height: 40px;
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-warning);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.lot-card-title {
    flex: 1;
}

.lot-card-title h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.lot-card-title h4 a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.lot-card-title h4 a:hover {
    color: var(--accent-primary);
}

.lot-card-title .lot-card-lgtin {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'Fira Code', monospace;
    margin: 0;
}

.lot-card-status {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.lot-card-status-activo {
    background: rgba(76, 175, 80, 0.15);
    color: var(--accent-secondary);
}

.lot-card-status-despachado {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-info);
}

.lot-card-body {
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.lot-card-detail {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.lot-card-detail i {
    color: var(--text-muted);
    width: 14px;
}

.lot-card-detail-blockchain {
    color: var(--accent-secondary);
}

.lot-card-detail-blockchain i:last-child {
    color: var(--accent-secondary);
}

.lot-card-footer {
    padding: 12px 16px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
}

.btn-lot-detail {
    background: transparent;
    border: 1px solid var(--accent-warning);
    color: var(--accent-warning);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.btn-lot-detail:hover {
    background: var(--accent-warning);
    color: white;
}

/* =============================================
   BANNER ACTIONS
   ============================================= */
.banner-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

@media (max-width: 768px) {
    .banner-actions {
        margin-left: 0;
        margin-top: 12px;
        width: 100%;
        justify-content: flex-end;
    }
    
    .verification-banner {
        flex-wrap: wrap;
    }
}

/* =============================================
   RESPONSIVE FIXES
   ============================================= */
@media (max-width: 480px) {
    .lot-number {
        font-size: 22px;
    }
    
    .lot-product-name {
        font-size: 16px;
    }
    
    .flow-point {
        flex-direction: column;
        text-align: center;
    }
    
    .flow-icon {
        margin: 0 auto;
    }
    
    .flow-detail {
        justify-content: center;
    }
    
    .flow-link {
        justify-content: center;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}