/**
 * WAYPOINTS.CSS - RotaTruck v8.2.1 COMPACTO
 * Modal de Paradas - Design alinhado com Modal Alertas
 *
 * 🆕 v8.2.1 (BUG #017 Visual - Correção):
 * - Fundo azul marinho escuro: #1a1a2e
 * - Laranja apenas em: botões, estados ativos, hover
 * - Header/Footer: bordas sutis brancas (sem fundo laranja)
 * - Cards: bordas sutis brancas (laranja só em selecionados)
 * - Estilo minimalista igual Modal Alertas
 */

/* ==================== VARIÁVEIS - ESCURO (padrão) ==================== */
:root {
    /* 🆕 v8.2.0: Cores alinhadas com Modal Alertas */
    --wp-bg: #1a1a2e;                          /* Azul marinho escuro (igual alerts.css) */
    --wp-bg-light: rgba(255, 255, 255, 0.08);  /* Items/cards com transparência */
    --wp-bg-input: rgba(0, 0, 0, 0.3);         /* Inputs */
    --wp-text: #ffffff;                         /* Texto principal branco */
    --wp-text-muted: #b0b0b0;                  /* Texto secundário (igual alerts.css) */
    --wp-border: rgba(255, 255, 255, 0.1);     /* Bordas sutis */
    --wp-accent: #ff6b35;                       /* Laranja accent */
    --wp-accent-hover: #f7931e;                /* Laranja hover */
    --wp-success: #22c55e;                      /* Verde sucesso */
    --wp-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* ==================== TEMA CLARO ==================== */
.theme-light .waypoints-modal-container {
    --wp-bg: #ffffff;
    --wp-bg-light: rgba(0, 0, 0, 0.05);
    --wp-bg-input: rgba(0, 0, 0, 0.08);
    --wp-text: #1f2937;
    --wp-text-muted: #6b7280;
    --wp-border: rgba(0, 0, 0, 0.1);
    --wp-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* ==================== MODO NOTURNO NAVEGAÇÃO ==================== */
.navigation-night .waypoints-modal-container {
    --wp-bg: #0f0a1a;                          /* Mais escuro para navegação noturna */
    --wp-bg-light: rgba(255, 255, 255, 0.06);
    --wp-bg-input: rgba(0, 0, 0, 0.4);
    --wp-text: #ffccaa;
    --wp-text-muted: #aa8866;
    --wp-border: rgba(255, 255, 255, 0.1);
    --wp-accent: #ff8844;
    --wp-success: #88aa44;
    --wp-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
}

/* ==================== MODAL ==================== */
.waypoints-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-modal) + 1);
}

.waypoints-modal.active {
    display: block;
}

.waypoints-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
}

/* ==================== CONTAINER - COMPACTO ==================== */
.waypoints-modal-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 320px;
    max-height: 55vh;
    background: var(--wp-bg);
    border-radius: 14px;
    border: 1px solid var(--wp-border);
    box-shadow: var(--wp-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: wpSlide 0.2s ease;
}

@keyframes wpSlide {
    from { opacity: 0; transform: translate(-50%, -48%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}

/* ==================== HEADER ==================== */
/* 🆕 v8.2.1: Header escuro igual Modal Alertas (sem fundo laranja) */
.waypoints-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--wp-border);
    background: transparent;
}

.waypoints-modal-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--wp-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Ícone no header */
.waypoints-modal-header h3::before {
    content: '🚛';
    font-size: 16px;
}

.waypoints-modal-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: var(--wp-text-muted);
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.waypoints-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--wp-text);
}

/* ==================== BODY ==================== */
.waypoints-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px 14px;
    max-height: 35vh;
}

/* ==================== LISTA VAZIA ==================== */
/* 🆕 v8.2.1: Card com borda sutil (igual Modal Alertas) */
.waypoints-empty {
    text-align: center;
    padding: 16px 12px;
    color: var(--wp-text-muted);
    background: var(--wp-bg-light);
    border: 1px solid var(--wp-border);
    border-radius: 10px;
}

.waypoints-empty span {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
    opacity: 0.7;
}

.waypoints-empty p {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--wp-text);
}

.waypoints-empty small {
    font-size: 11px;
    color: var(--wp-text-muted);
}

/* ==================== WAYPOINT ITEM ==================== */
.waypoints-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: var(--wp-bg-light);
    border-radius: 8px;
    margin-bottom: 5px;
    cursor: grab;
    border: 1px solid transparent;
}

.waypoints-item:hover {
    border-color: var(--wp-border);
    background: rgba(255, 255, 255, 0.12);
}

.waypoints-item-drag {
    color: var(--wp-text-muted);
    font-size: 10px;
    opacity: 0.4;
}

.waypoints-item-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.waypoints-item-info {
    flex: 1;
    min-width: 0;
}

.waypoints-item-info strong {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--wp-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.waypoints-item-info small {
    font-size: 9px;
    color: var(--wp-text-muted);
}

.waypoints-item-remove {
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0.4;
}

.waypoints-item-remove:hover {
    background: rgba(239, 68, 68, 0.15);
    opacity: 1;
}

/* ==================== FORMULÁRIO COMPACTO ==================== */
.waypoints-add-form {
    background: var(--wp-bg-light);
    border-radius: 8px;
    padding: 10px;
    border: 1px solid var(--wp-border);
}

.waypoints-form-group {
    margin-bottom: 8px;
}

.waypoints-form-group label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    color: var(--wp-text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
}

.waypoints-input-group {
    display: flex;
    gap: 5px;
}

.waypoints-input-group input {
    flex: 1;
    padding: 8px 10px;
    background: var(--wp-bg-input);
    border: 1px solid var(--wp-border);
    border-radius: 6px;
    color: var(--wp-text);
    font-size: 12px;
    outline: none;
}

.waypoints-input-group input::placeholder {
    color: var(--wp-text-muted);
    font-size: 11px;
}

.waypoints-input-group input:focus {
    border-color: var(--wp-accent);
}

.waypoints-gps-btn {
    width: 36px;
    height: 36px;
    background: var(--wp-accent);
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

/* ==================== TIPOS - GRID 3 COLUNAS ==================== */
.waypoints-types {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
}

.waypoints-type-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 2px;
    background: var(--wp-bg-input);
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
}

.waypoints-type-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.waypoints-type-option.selected {
    border-color: var(--wp-accent);
    background: rgba(255, 255, 255, 0.15);
}

.waypoints-type-option input {
    display: none;
}

.waypoints-type-icon {
    width: 24px;
    height: 24px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.waypoints-type-label {
    font-size: 8px;
    font-weight: 600;
    color: var(--wp-text-muted);
    text-align: center;
    line-height: 1.1;
}

.waypoints-type-option.selected .waypoints-type-label {
    color: var(--wp-accent);
}

/* ==================== AÇÕES FORMULÁRIO ==================== */
.waypoints-form-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

/* ==================== FOOTER ==================== */
/* 🆕 v8.2.1: Footer escuro igual Modal Alertas (sem fundo laranja) */
.waypoints-modal-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--wp-border);
    background: transparent;
}

/* ==================== BOTÕES ==================== */
.waypoints-btn-primary,
.waypoints-btn-secondary,
.waypoints-btn-success {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.waypoints-btn-primary {
    /* Gradiente laranja (igual tracking-btn-create em alerts.css) */
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: white;
    transition: transform 0.2s, box-shadow 0.2s;
}

.waypoints-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
}

.waypoints-btn-secondary {
    background: var(--wp-bg-light);
    color: var(--wp-text);
    border: 1px solid var(--wp-border);
}

.waypoints-btn-success {
    background: var(--wp-success);
    color: white;
}

.waypoints-btn-full {
    width: 100%;
}

/* ==================== MARCADORES MAPA ==================== */
.waypoint-marker {
    background: none !important;
    border: none !important;
}

.waypoint-marker-body {
    width: 24px;
    height: 24px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    border: 2px solid white;
}

.waypoint-marker-icon {
    transform: rotate(45deg);
    font-size: 10px;
}

.waypoint-marker-order {
    position: absolute;
    top: -6px;
    right: -6px;
    transform: rotate(45deg);
    background: #fff;
    color: #333;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    font-size: 8px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==================== POPUP ==================== */
.waypoint-popup strong {
    display: block;
    font-size: 11px;
    margin-bottom: 2px;
}

.waypoint-popup p {
    margin: 0 0 6px;
    font-size: 9px;
    color: #666;
}

.waypoint-popup-btn {
    width: 100%;
    padding: 5px 8px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 4px;
    color: #ef4444;
    font-size: 9px;
    font-weight: 600;
    cursor: pointer;
}

/* ==================== SCROLLBAR ==================== */
.waypoints-modal-body::-webkit-scrollbar {
    width: 3px;
}

.waypoints-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

/* ==================== RESPONSIVO ==================== */
@media (max-width: 360px) {
    .waypoints-modal-container {
        width: 94%;
        max-width: 300px;
    }
    
    .waypoints-types {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (prefers-reduced-motion: reduce) {
    .waypoints-modal-container {
        animation: none !important;
    }
}