/**
 * 🔍 SEARCH CARD - RotaTruck v5.1.2
 * Logo 110px conforme documentação master (linhas 889-915)
 */

/* ==================== SEARCH CONTAINER ==================== */
.search-container {
    position: fixed;
    top: 200px !important;
    left: 16px;
    width: 90%;
    max-width: 480px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(30px);
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: calc(var(--z-painel) + 2);
    padding: 20px;
    transition: all 0.3s ease;
}

.search-container.expanded {
    max-height: calc(100vh - 220px);
    overflow-y: auto;
}

/* ==================== SEARCH OVERLAY ==================== */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
    z-index: calc(var(--z-painel) + 1);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.search-overlay.active {
    opacity: 1;
    visibility: visible;
}


/* ==================== LOGO CONTAINER ==================== */
/* Conforme documentação master linha 889-915 */
.search-container-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 90px;
    padding: 16px 0;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo-image {
    width: 110px; /* ✅ Conforme documentação master linha 902 */
    height: auto;
    object-fit: contain;
}

/* ==================== SEARCH BAR ==================== */
.search-bar {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 12px 16px;
    margin-bottom: 16px;
    transition: all 0.2s;
}

.search-bar:focus-within {
    background: rgba(255, 255, 255, 0.08);
    border-color: #FF6B35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.search-icon {
    color: rgba(255, 255, 255, 0.5);
    font-size: 18px;
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: white;
    font-size: 15px;
    font-weight: 500;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.mic-icon {
    color: #FF6B35;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.mic-icon:hover {
    transform: scale(1.1);
    color: #FF814F;
}

/* ==================== CARD TABS ==================== */
.card-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.card-tab-btn {
    flex: 1;
    padding: 10px 14px;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.card-tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.8);
}

.card-tab-btn.active {
    background: #FF6B35;
    color: white;
}

.card-tab-btn i {
    font-size: 16px;
}

/* ==================== CARD TAB CONTENT ==================== */
.card-tab-content {
    max-height: none;
    overflow-y: visible;
    padding-bottom: 16px; /* ✅ v5.1.0: REDUZIDO 40px → 16px (card compacto) */
    position: relative;
    z-index: calc(var(--z-mapa) + 1);
}

.card-tab-content::-webkit-scrollbar {
    width: 6px;
}

.card-tab-content::-webkit-scrollbar-thumb {
    background: rgba(255, 107, 53, 0.5);
    border-radius: 3px;
}

.card-tab-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 107, 53, 0.7);
}

.card-tab-panel {
    display: none;
}

.card-tab-panel.active {
    display: block;
    animation: fadeInCard 0.3s;
}

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

/* ==================== SUGGESTIONS LIST ==================== */
.suggestions-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.suggestion-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 107, 53, 0.3);
    transform: translateX(4px);
}

.suggestion-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 107, 53, 0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #FF6B35;
    flex-shrink: 0;
}

.suggestion-text {
    flex: 1;
}

.suggestion-title {
    font-size: 15px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6); /* ✅ v6.0.2: Cinza claro (era white) */
    margin-bottom: 4px;
}

.suggestion-subtitle {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    /* ✅ v6.0.2: Endereço em 1 linha */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ==================== CARD FORM GROUP ==================== */
.card-form-group {
    margin-bottom: 16px;
}

.card-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
}

.card-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: white;
    font-size: 15px;
    transition: all 0.2s;
}

.card-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.card-input:focus {
    outline: none;
    border-color: #FF6B35;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.card-select {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: white;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.card-select:focus {
    outline: none;
    border-color: #FF6B35;
    background: rgba(255, 255, 255, 0.08);
}

/* ==================== INPUT GROUP COM GPS ==================== */
.card-input-group {
    display: flex;
    gap: 8px;
}

.card-input-group .card-input {
    flex: 1;
}

.card-btn-gps {
    width: 44px;
    height: 44px;
    background: #FF6B35;
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.card-btn-gps:hover {
    background: #FF814F;
    transform: scale(1.05);
}

.card-btn-gps:active {
    transform: scale(0.95);
}

/* ==================== BOTÃO CALCULAR ==================== */
.card-btn-primary {
    width: 100%;
    padding: 14px;
    background: #FF6B35;
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
}

.card-btn-primary:hover {
    background: #FF814F;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
}

.card-btn-primary:active {
    transform: translateY(0);
}

/* ==================== LOCAIS SALVOS ==================== */
.saved-locations {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    z-index: calc(var(--z-mapa) + 2);
}

.saved-location {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    margin-bottom: 8px;
    z-index: calc(var(--z-mapa) + 3);
}

.saved-location:last-child {
    margin-bottom: 8px; /* ✅ v5.1.0: REDUZIDO 20px → 8px (compacto) */
}

.saved-location:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(4px);
    z-index: var(--z-popup);
}

.saved-location-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.saved-location-icon.home {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.saved-location-icon.work {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.saved-location-actions {
    display: flex;
    gap: 8px;
    position: absolute; /* ✅ v5.0.9: Fixar à direita */
    right: 12px; /* ✅ v5.0.9: 12px da borda */
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.2s;
    z-index: var(--z-controle);
}

.saved-location:hover .saved-location-actions {
    opacity: 1;
}

.location-action-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
    z-index: calc(var(--z-controle) + 1);
}

.location-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
    z-index: calc(var(--z-controle) + 2);
}

.location-action-btn.delete {
    border-color: rgba(239, 68, 68, 0.3);
    color: #EF4444;
}

.location-action-btn.delete:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* ==================== HISTÓRICO ==================== */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(4px);
}

.history-icon {
    width: 40px;
    height: 40px;
    background: rgba(156, 163, 175, 0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
}

.history-text {
    flex: 1;
}

.history-title {
    font-size: 15px;
    font-weight: 600;
    color: white;
    margin-bottom: 4px;
}

.history-subtitle {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
}
/* ==================== BOTÃO "USAR COMO DESTINO" ==================== */
.destination-action-bar {
    width: 100%;
    padding: 12px;
    margin-top: 8px;
    margin-bottom: 16px;
    animation: slideDown 0.3s ease;
}

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

.btn-use-destination {
    width: 100%;
    padding: 14px 16px;
    background: #FF6B35;
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.btn-use-destination:hover {
    background: #FF814F;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 107, 53, 0.5);
}

.btn-use-destination:active {
    transform: translateY(0);
}

.btn-use-destination i {
    font-size: 18px;
}

/* Tema DIA */
body:not(.theme-dark) .btn-use-destination {
    background: #FF6B35;
    color: white;
}

body:not(.theme-dark) .btn-use-destination:hover {
    background: #FF814F;
}

/* ==================== TEMA DIA ==================== */
body:not(.theme-dark) .search-container {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

body:not(.theme-dark) .search-overlay {
    background: rgba(0, 0, 0, 0.1);
}

body:not(.theme-dark) .logo-image {
    content: url('../assets/icons/logo-dia.png');
}

body.theme-dark .logo-image {
    content: url('../assets/icons/logo.svg');
}

body:not(.theme-dark) .search-bar {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

body:not(.theme-dark) .search-bar:focus-within {
    background: rgba(0, 0, 0, 0.06);
    border-color: #FF6B35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

body:not(.theme-dark) .search-icon {
    color: rgba(0, 0, 0, 0.6);
}

body:not(.theme-dark) .search-input {
    color: #1a1a1a;
}

body:not(.theme-dark) .search-input::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

body:not(.theme-dark) .mic-icon {
    color: #FF6B35;
}

body:not(.theme-dark) .mic-icon:hover {
    color: #FF814F;
}

body:not(.theme-dark) .card-tab-btn {
    color: rgba(0, 0, 0, 0.5);
}

body:not(.theme-dark) .card-tab-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.8);
}

body:not(.theme-dark) .card-tab-btn.active {
    background: #FF6B35;
    color: white;
}

body:not(.theme-dark) .card-tab-content::-webkit-scrollbar-thumb {
    background: rgba(255, 107, 53, 0.5);
}

body:not(.theme-dark) .card-tab-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 107, 53, 0.7);
}

body:not(.theme-dark) .suggestion-item {
    background: rgba(0, 0, 0, 0.03);
}

body:not(.theme-dark) .suggestion-item:hover {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(255, 107, 53, 0.3);
}

body:not(.theme-dark) .suggestion-icon {
    background: rgba(255, 107, 53, 0.1);
    color: #FF6B35;
}

body:not(.theme-dark) .suggestion-title {
    color: rgba(0, 0, 0, 0.6); /* ✅ v6.0.2c: Cinza 60% (era #1a1a1a preto) */
}

body:not(.theme-dark) .suggestion-subtitle {
    color: rgba(0, 0, 0, 0.5);
}

body:not(.theme-dark) .card-form-group label {
    color: rgba(0, 0, 0, 0.7);
}

body:not(.theme-dark) .card-input {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #1a1a1a;
}

body:not(.theme-dark) .card-input::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

body:not(.theme-dark) .card-input:focus {
    border-color: #FF6B35;
    background: rgba(0, 0, 0, 0.06);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

body:not(.theme-dark) .card-select {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #1a1a1a;
}

body:not(.theme-dark) .card-select:focus {
    border-color: #FF6B35;
    background: rgba(0, 0, 0, 0.06);
}

body:not(.theme-dark) .card-btn-gps {
    background: #FF6B35;
    color: white;
}

body:not(.theme-dark) .card-btn-gps:hover {
    background: #FF814F;
}

body:not(.theme-dark) .card-btn-primary {
    background: #FF6B35;
    color: white;
}

body:not(.theme-dark) .card-btn-primary:hover {
    background: #FF814F;
}

body:not(.theme-dark) .saved-location {
    background: rgba(0, 0, 0, 0.03);
}

body:not(.theme-dark) .saved-location:hover {
    background: rgba(0, 0, 0, 0.06);
}

body:not(.theme-dark) .saved-location-icon.home {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

body:not(.theme-dark) .saved-location-icon.work {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

body:not(.theme-dark) .location-action-btn {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: rgba(0, 0, 0, 0.6);
}

body:not(.theme-dark) .location-action-btn:hover {
    background: rgba(0, 0, 0, 0.08);
}

body:not(.theme-dark) .location-action-btn.delete {
    border-color: rgba(239, 68, 68, 0.3);
    color: #DC2626;
}

body:not(.theme-dark) .location-action-btn.delete:hover {
    background: rgba(239, 68, 68, 0.1);
}

body:not(.theme-dark) .history-item {
    background: rgba(0, 0, 0, 0.03);
}

body:not(.theme-dark) .history-item:hover {
    background: rgba(0, 0, 0, 0.06);
}

body:not(.theme-dark) .history-icon {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.5);
}

body:not(.theme-dark) .history-title {
    color: #1a1a1a;
}

body:not(.theme-dark) .history-subtitle {
    color: rgba(0, 0, 0, 0.5);
}/* ==================== BOTÃO "USAR COMO DESTINO" - CLEAN ==================== */
.destination-action-bar {
    width: 100%;
    padding: 8px 12px;
    margin-top: 6px;
    margin-bottom: 12px;
    animation: slideDown 0.2s ease;
}

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

.btn-use-destination {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 107, 53, 0.15);
    border: 1.5px solid #FF6B35;
    border-radius: 10px;
    color: #FF6B35;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-use-destination:hover {
    background: #FF6B35;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(255, 107, 53, 0.3);
}

.btn-use-destination:active {
    transform: translateY(0);
}

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

/* Tema DIA */
body:not(.theme-dark) .btn-use-destination {
    background: rgba(255, 107, 53, 0.1);
    border: 1.5px solid #FF6B35;
    color: #FF6B35;
}

body:not(.theme-dark) .btn-use-destination:hover {
    background: #FF6B35;
    color: white;
}