/**
 * ===============================================
 * LOCATION MODALS - RotaTruck v7.1.0
 * ===============================================
 * Modais para edição e confirmação dos locais Home e Work
 * - Modal de Edição (cadastro/edição)
 * - Modal de Confirmação (deletar)
 * - Suporte completo a tema Light/Dark
 * Data: 25/11/2025
 * ===============================================
 */

/* ==================== MODAL DE EDIÇÃO - OVERLAY ==================== */
.location-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    z-index: var(--z-modal);
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.location-modal-overlay.active {
    display: flex;
    opacity: 1;
}

/* ==================== MODAL DE EDIÇÃO - CONTAINER ==================== */
.location-modal {
    position: relative;
    width: 90%;
    max-width: 480px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(30px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
    padding: 24px;
    z-index: calc(var(--z-modal) + 1);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.location-modal-overlay.active .location-modal {
    transform: scale(1);
}

/* ==================== MODAL DE EDIÇÃO - HEADER ==================== */
.location-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.location-modal-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 600;
    color: white;
}

.location-modal-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 107, 53, 0.1);
    border-radius: 12px;
    font-size: 20px;
}

.location-modal-icon.home {
    color: #FF6B35;
}

.location-modal-icon.work {
    color: #4A90E2;
}

.location-modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.location-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* ==================== MODAL DE EDIÇÃO - BODY ==================== */
.location-modal-body {
    margin-bottom: 20px;
}

/* ==================== MODAL DE EDIÇÃO - FORM GROUP ==================== */
.location-form-group {
    margin-bottom: 20px;
}

.location-form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
}

/* ==================== MODAL DE EDIÇÃO - INPUT WRAPPER ==================== */
.location-input-wrapper {
    position: relative;
    display: flex;
    gap: 8px;
}

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

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

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

/* ==================== MODAL DE EDIÇÃO - BOTÃO GPS ==================== */
.location-btn-gps {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #FF6B35 0%, #FF8C5A 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.location-btn-gps:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 107, 53, 0.4);
}

.location-btn-gps:active {
    transform: translateY(0);
}

.location-btn-gps.loading {
    animation: pulseGPS 1.5s ease-in-out infinite;
    cursor: wait;
}

@keyframes pulseGPS {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

/* ==================== MODAL DE EDIÇÃO - FOOTER ==================== */
.location-modal-footer {
    display: flex;
    gap: 12px;
}

.location-btn {
    flex: 1;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Botão Cancelar */
.location-btn-cancel {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.location-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

/* Botão Salvar */
.location-btn-save {
    background: linear-gradient(135deg, #FF6B35 0%, #FF8C5A 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.location-btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 107, 53, 0.4);
}

.location-btn-save:active {
    transform: translateY(0);
}

.location-btn-save:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ==================== MODAL DE CONFIRMAÇÃO - OVERLAY ==================== */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: calc(var(--z-modal) + 2);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ==================== MODAL DE CONFIRMAÇÃO - CONTAINER ==================== */
.confirm-modal {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(30px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 28px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ==================== MODAL DE CONFIRMAÇÃO - HEADER ==================== */
.confirm-header {
    text-align: center;
    margin-bottom: 24px;
}

.confirm-header i {
    font-size: 48px;
    color: #FF6B35;
    margin-bottom: 16px;
    display: block;
}

.confirm-header h3 {
    margin: 0;
    color: white;
    font-size: 22px;
    font-weight: 600;
}

/* ==================== MODAL DE CONFIRMAÇÃO - BODY ==================== */
.confirm-body {
    margin-bottom: 28px;
    text-align: center;
}

.confirm-body p {
    margin: 10px 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 15px;
    line-height: 1.5;
}

.confirm-address {
    color: #FF6B35 !important;
    font-weight: 600;
    font-size: 16px;
    margin-top: 12px !important;
}

/* ==================== MODAL DE CONFIRMAÇÃO - FOOTER ==================== */
.confirm-footer {
    display: flex;
    gap: 12px;
}

.confirm-btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.confirm-btn-cancel {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.confirm-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.confirm-btn-delete {
    background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 68, 68, 0.3);
}

.confirm-btn-delete:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 68, 68, 0.4);
}

.confirm-btn-delete:active {
    transform: translateY(0);
}

/* ========================================================
   TEMA LIGHT - MODAL DE EDIÇÃO
======================================================== */
body:not(.theme-dark) .location-modal {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

body:not(.theme-dark) .location-modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

body:not(.theme-dark) .location-modal-title {
    color: #1F2937;
}

body:not(.theme-dark) .location-modal-icon {
    background: rgba(255, 107, 53, 0.1);
}

body:not(.theme-dark) .location-modal-close {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.6);
}

body:not(.theme-dark) .location-modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #1F2937;
}

body:not(.theme-dark) .location-form-label {
    color: #374151;
}

body:not(.theme-dark) .location-input {
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    color: #1F2937;
}

body:not(.theme-dark) .location-input::placeholder {
    color: #9CA3AF;
}

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

body:not(.theme-dark) .location-btn-cancel {
    background: #F3F4F6;
    color: #374151;
    border: 1px solid #E5E7EB;
}

body:not(.theme-dark) .location-btn-cancel:hover {
    background: #E5E7EB;
    color: #1F2937;
}

/* ========================================================
   TEMA LIGHT - MODAL DE CONFIRMAÇÃO
======================================================== */
body:not(.theme-dark) .confirm-overlay {
    background: rgba(0, 0, 0, 0.3);
}

body:not(.theme-dark) .confirm-modal {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.15);
}

body:not(.theme-dark) .confirm-header h3 {
    color: #1F2937;
}

body:not(.theme-dark) .confirm-body p {
    color: #6B7280;
}

body:not(.theme-dark) .confirm-btn-cancel {
    background: #F3F4F6;
    color: #374151;
    border: 1px solid #E5E7EB;
}

body:not(.theme-dark) .confirm-btn-cancel:hover {
    background: #E5E7EB;
    color: #1F2937;
}

/* ========================================================
   RESPONSIVO - MOBILE
======================================================== */
@media (max-width: 480px) {
    .location-modal {
        width: 95%;
        padding: 20px;
        border-radius: 20px;
    }

    .location-modal-title {
        font-size: 18px;
    }

    .location-modal-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .location-btn {
        padding: 12px 20px;
        font-size: 14px;
    }

    .location-btn-gps {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }

    .confirm-modal {
        width: 95%;
        padding: 24px;
    }

    .confirm-header i {
        font-size: 40px;
    }

    .confirm-header h3 {
        font-size: 20px;
    }

    .confirm-body p {
        font-size: 14px;
    }

    .confirm-address {
        font-size: 15px;
    }

    .confirm-btn {
        padding: 12px 16px;
        font-size: 14px;
    }
}

/* ========================================================
   🆕 v2.0.0: AUTOCOMPLETE DROPDOWN - HOME/WORK MODAL
======================================================== */

.location-autocomplete {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 48px !important; /* Espaço para o botão GPS */
    width: auto !important;
    max-height: 280px;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: var(--z-critico) !important;
    margin-top: 4px;
}

.location-autocomplete .autocomplete-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.location-autocomplete .autocomplete-item:last-child {
    border-bottom: none;
}

.location-autocomplete .autocomplete-item:hover,
.location-autocomplete .autocomplete-item.highlighted {
    background: rgba(255, 107, 53, 0.15);
}

.location-autocomplete .autocomplete-item-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.location-autocomplete .autocomplete-item-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.location-autocomplete .autocomplete-item-label {
    font-size: 14px;
    font-weight: 500;
    color: #FFFFFF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.location-autocomplete .autocomplete-item-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.location-autocomplete .autocomplete-loading,
.location-autocomplete .autocomplete-empty,
.location-autocomplete .autocomplete-error {
    padding: 16px;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

.location-autocomplete .autocomplete-loading i,
.location-autocomplete .autocomplete-empty i,
.location-autocomplete .autocomplete-error i {
    margin-right: 8px;
}

.location-autocomplete .autocomplete-error {
    color: #FF6B35;
}

/* ==================== TEMA LIGHT - AUTOCOMPLETE ==================== */
body:not(.theme-dark) .location-autocomplete {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

body:not(.theme-dark) .location-autocomplete .autocomplete-item {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

body:not(.theme-dark) .location-autocomplete .autocomplete-item:hover,
body:not(.theme-dark) .location-autocomplete .autocomplete-item.highlighted {
    background: rgba(255, 107, 53, 0.1);
}

body:not(.theme-dark) .location-autocomplete .autocomplete-item-icon {
    background: rgba(0, 0, 0, 0.05);
    color: #6B7280;
}

body:not(.theme-dark) .location-autocomplete .autocomplete-item-label {
    color: #1F2937;
}

body:not(.theme-dark) .location-autocomplete .autocomplete-item-desc {
    color: #6B7280;
}

body:not(.theme-dark) .location-autocomplete .autocomplete-loading,
body:not(.theme-dark) .location-autocomplete .autocomplete-empty {
    color: #6B7280;
}

/* ==================== RESPONSIVO - AUTOCOMPLETE ==================== */
@media (max-width: 480px) {
    .location-autocomplete {
        right: 52px !important;
        max-height: 220px;
    }

    .location-autocomplete .autocomplete-item {
        padding: 10px 12px;
        gap: 10px;
    }

    .location-autocomplete .autocomplete-item-icon {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .location-autocomplete .autocomplete-item-label {
        font-size: 13px;
    }

    .location-autocomplete .autocomplete-item-desc {
        font-size: 11px;
    }
}