/* Tren Roca Widget v3 */

.trv3-widget {
    max-width: 600px;
    margin: 20px auto;
    background: var(--surface-2);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    font-family: system-ui, -apple-system, sans-serif;
}

.trv3-header {
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: white;
    padding: 20px;
}

.trv3-title {
    margin: 0 0 12px 0;
    font-size: 22px;
    font-weight: 600;
}

.trv3-route {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 14px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.trv3-route span {
    background: rgba(255,255,255,0.2);
    padding: 4px 10px;
    border-radius: 4px;
}

.trv3-arrow {
    background: none !important;
    opacity: 0.9;
    font-weight: bold;
}

.trv3-time {
    font-size: 12px;
    opacity: 0.85;
}

.trv3-error,
.trv3-empty {
    padding: 20px;
    text-align: center;
    color: #666;
}

.trv3-error {
    background: #fee;
    color: #b71c1c;
    border-left: 4px solid #d32f2f;
}

.trv3-error p {
    margin: 0 0 8px 0;
    font-weight: 500;
}

.trv3-error small {
    display: block;
    font-size: 12px;
    opacity: 0.8;
}

.trv3-trains {
    padding: 12px;
    max-height: 500px;
    overflow-y: auto;
}

.trv3-train {
    padding: 14px;
    margin-bottom: 10px;
    background: #f9f9f9;
    border-radius: 8px;
    border-left: 4px solid #1e3c72;
    transition: all 0.2s;
}

.trv3-train:hover {
    background: #f0f0f0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.trv3-train-demora {
    border-left-color: #ff9800;
    background: #fff8f0;
}

.trv3-train-cancelado {
    border-left-color: #f44336;
    background: #ffebee;
    opacity: 0.7;
}

.trv3-hora {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.trv3-hora-text {
    font-size: 20px;
    font-weight: 700;
    color: #000;
    min-width: 60px;
}

.trv3-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 3px;
    text-transform: uppercase;
    white-space: nowrap;
}

.trv3-badge-demora {
    background: #ff9800;
    color: white;
}

.trv3-badge-cancelado {
    background: #f44336;
    color: white;
}

.trv3-info {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #666;
    margin-bottom: 6px;
}

.trv3-destino {
    font-weight: 600;
    color: #333;
}

.trv3-via {
    background: rgba(30,60,114,0.1);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
}

.trv3-estado {
    font-size: 11px;
    color: #666;
    font-style: italic;
    margin-top: 6px;
}

.trv3-footer {
    padding: 16px;
    background: #fafafa;
    border-top: 1px solid #eee;
    text-align: center;
}

.trv3-btn {
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-bottom: 8px;
    transition: all 0.3s;
}

.trv3-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30,60,114,0.3);
}

.trv3-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

.trv3-btn.loading::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 8px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

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

.trv3-footer small {
    display: block;
    color: #999;
    font-size: 11px;
}

/* Scroll */
.trv3-trains::-webkit-scrollbar {
    width: 6px;
}

.trv3-trains::-webkit-scrollbar-thumb {
    background: #bbb;
    border-radius: 3px;
}

.trv3-trains::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Responsive */
@media (max-width: 600px) {
    .trv3-widget {
        margin: 10px;
    }
    
    .trv3-header {
        padding: 14px;
    }
    
    .trv3-title {
        font-size: 18px;
    }
    
    .trv3-route {
        font-size: 12px;
    }
    
    .trv3-train {
        padding: 12px;
    }
    
    .trv3-hora-text {
        font-size: 18px;
    }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    .trv3-widget {
        background: #1e1e1e;
    }
    
    .trv3-train {
        background: #2a2a2a;
        color: #e0e0e0;
    }
    
    .trv3-train:hover {
        background: #333;
    }
    
    .trv3-hora-text {
        color: #fff;
    }
    
    .trv3-destino {
        color: #e0e0e0;
    }
    
    .trv3-footer {
        background: #252525;
        border-top-color: #333;
    }
}
