/* public/css/modals.css */

/* =========================================
   ESTRUTURA BASE DOS MODAIS (MANTIDO)
   ========================================= */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    /* Fundo atualizado para dar um tom mais profissional (SaaS), com desfoque */
    background-color: rgba(15, 23, 42, 0.6); 
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* O quadro original (usado no Tutorial) */
.modal-content {
    width: 60%;
    /* height: 70%; */
    background-color: var(--color-white-translucent, #ffffff);
    border: 2px solid var(--color-black, #000000);
    border-radius: 10px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 40px 20px;
    box-shadow: 0px 4px 15px rgba(0,0,0,0.2);
}

.btn-close {
    position: absolute;
    top: -12%;
    right: 0px; 
    background-color: var(--color-white, #ffffff);
    border: 2px solid var(--color-black, #000000);
    border-radius: var(--border-radius-default, 10px);
    padding: 10px 20px;
    font-size: var(--font-size-medium, 16px);
    font-weight: bold;
    cursor: pointer;
}

.modal-title {
    font-size: var(--font-size-large, 24px);
    font-weight: bold;
    text-align: center;
}


/* =========================================
   NOVO DESIGN: MODAL DE UPLOAD DE GEOJSON
   (Usa a classe .modern-upload-modal para não quebrar o tutorial)
   ========================================= */

.modal-content.modern-upload-modal {
    width: 100%;
    max-width: 550px; /* Largura controlada e elegante */
    background-color: #ffffff;
    border: 1px solid #e7e5e4;
    border-radius: 20px;
    padding: 35px 40px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    align-items: stretch; /* Estica os itens para preencher a largura */
    
    /* --- CORREÇÃO DE RESPONSIVIDADE --- */
    max-height: 90vh; /* O modal nunca será maior que 90% da altura da tela */
    overflow-y: auto; /* Adiciona scroll interno se o conteúdo não couber */
}

/* Deixa a barra de rolagem interna do modal fina e elegante */
.modal-content.modern-upload-modal::-webkit-scrollbar {
    width: 6px;
}
.modal-content.modern-upload-modal::-webkit-scrollbar-track {
    background: transparent;
    margin-block: 20px; /* Descola o trilho das bordas arredondadas */
}
.modal-content.modern-upload-modal::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 10px;
}
.modal-content.modern-upload-modal::-webkit-scrollbar-thumb:hover {
    background-color: #94a3b8;
}

.upload-modal-header {
    text-align: center;
    margin-bottom: 25px;
}

.upload-modal-header .icon-wrapper {
    width: 60px;
    height: 60px;
    background: #f0f9ff;
    color: #1F5568;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 15px auto;
}

.modern-upload-modal .modal-title {
    font-size: 22px;
    font-weight: 900;
    color: #1e293b;
    margin-bottom: 5px;
}

.modal-subtitle {
    font-size: 13px;
    color: #64748b;
    text-align: center;
}

/* --- ÁREA DO BOTÃO PONTILHADO (DASHED) --- */
.upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.btn-upload-custom {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 25px 20px;
    background-color: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-upload-custom:hover {
    background-color: #f0f9ff;
    border-color: #0ea5e9;
}

.btn-upload-custom .cloud-icon {
    font-size: 42px;
    color: #0ea5e9;
    margin-bottom: 10px;
    transition: transform 0.2s ease;
}

.btn-upload-custom:hover .cloud-icon {
    transform: translateY(-4px);
}

.upload-primary-text {
    font-size: 14px;
    font-weight: bold;
    color: #1F5568;
    margin-bottom: 4px;
}

.upload-secondary-text {
    font-size: 11px;
    color: #64748b;
}

/* --- REGRAS DO PROJETO (UX Limpo) --- */
.rules-text {
    text-align: center;
    font-size: var(--font-size-small, 14px);
    line-height: 1.1;
}

.modern-upload-modal .rules-text {
    background: #f1f5f9;
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 25px;
    text-align: left;
}

.rules-title {
    font-size: 11px;
    font-weight: bold;
    color: #475569;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.rules-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0;
    margin: 0;
}

.rules-list li {
    font-size: 12px;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rules-list li i {
    color: #1F5568;
    font-size: 16px;
}

/* --- BOTÃO "INICIAR MAPEAMENTO" (Antigo btn-close) --- */
.btn-start-project {
    background: #1c1917;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 16px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(31, 85, 104, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
}

.btn-start-project:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(31, 85, 104, 0.3);
}

.btn-start-project:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}


/* =========================================
   ELEMENTOS DO TUTORIAL E LEGADOS
   ========================================= */

.icon-upload-large {
    font-size: 8vw;
    background: none;
    border: none;
    cursor: pointer;
    transition: transform 0.2s;
}

.icon-upload-large:hover {
    transform: scale(1.5);
}

.modal-pagination {
    display: flex;
    gap: 10px;
    align-items: center;
}

.modal-pagination .dot {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background-color: var(--color-bg-gray, #E2E9EB);
    border: none;
    cursor: pointer;
}

.modal-pagination .dot.active {
    background-color: var(--color-primary-rubro, #751537);
}


/* =========================================
   RESPONSIVIDADE
   ========================================= */

@media (max-width: 768px) {
    /* Regra Original do Tutorial */
    .modal-content {
        width: 90%;
        height: 80%;
    }
    
    /* Regra Nova da Tela de Upload */
    .modal-content.modern-upload-modal {
        height: auto; /* Deixa o conteúdo ditar a altura */
        padding: 25px 20px;
    }

    .btn-close {
        right: 0;
        top: -50px; 
    }
}



/* =========================================
   SESSÃO: UPLOAD VIA GOOGLE DRIVE
   ========================================= */
.drive-upload-section {
    margin: 25px 0;
}

.divider-text {
    display: flex;
    align-items: center;
    text-align: center;
    color: #94a3b8;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 20px;
}

.divider-text::before,
.divider-text::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e2e8f0;
}

.divider-text span {
    padding: 0 15px;
}

/* Caixa principal do Drive */
.drive-box {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 20px;
    position: relative;
    overflow: hidden; /* Importante para a máscara não vazar */
}

.drive-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.drive-header h4 {
    margin: 0;
    font-size: 15px;
    color: #1e293b;
    flex-grow: 1;
    text-align: left;
}

.premium-badge-tiny {
    background: #751537;
    color: white;
    font-size: 9px;
    font-weight: 900;
    padding: 3px 8px;
    border-radius: 12px;
    letter-spacing: 0.5px;
}

/* Campos de Input do Drive */
.drive-input-group {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8fafc;
    border-radius: 6px;
    padding: 0 10px;
    border: 1px solid transparent;
    transition: border-color 0.2s;
}

.input-row:focus-within {
    border-color: #1F5568;
    background: #ffffff;
}

.input-row i {
    color: #94a3b8;
    font-size: 16px;
}

.drive-url-input, 
.drive-name-input {
    border: none;
    background: transparent;
    padding: 10px 0;
    width: 100%;
    font-size: 13px;
    color: #334155;
    outline: none;
}

.system-loading-spinner {
    animation: geodash-loading-spin 0.9s linear infinite;
}

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

/* Acabamento visual da importação por Google Drive, mantendo a mesma estrutura HTML. */
.drive-upload-section {
    margin: 28px 0 24px;
}

.drive-upload-section .divider-text {
    color: #64748b;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.15px;
    margin-bottom: 16px;
}

.drive-upload-section .divider-text::before,
.drive-upload-section .divider-text::after {
    border-bottom-color: #dbe5ef;
}

.drive-box {
    background: linear-gradient(145deg, #ffffff 0%, #f7fbff 58%, #f2fbf8 100%);
    border: 1px solid #cbddea;
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 10px 24px rgba(31, 85, 104, 0.07);
}

.drive-header {
    gap: 9px;
    margin-bottom: 10px;
}

.drive-header > i {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: #eaf8f1;
    border: 1px solid #c7ead8;
    font-size: 17px;
}

.drive-header h4 {
    color: #173f50;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.1px;
}

.premium-badge-tiny {
    background: linear-gradient(135deg, #8b1e4a, #67133a);
    box-shadow: 0 3px 8px rgba(103, 19, 58, 0.2);
    border-radius: 999px;
    font-size: 8px;
    letter-spacing: 0.7px;
    padding: 4px 8px;
}

.drive-box > p {
    margin: 0 0 14px !important;
    padding: 9px 11px;
    border-left: 3px solid #35a778;
    border-radius: 0 8px 8px 0;
    background: rgba(234, 248, 241, 0.7);
    color: #476174 !important;
    line-height: 1.5 !important;
}

#drive-links-wrapper {
    display: grid;
    gap: 10px;
}

.drive-input-group {
    position: relative;
    margin-bottom: 0;
    padding: 9px;
    gap: 7px;
    background: #ffffff;
    border: 1px solid #d9e5ee;
    border-radius: 11px;
    box-shadow: 0 4px 12px rgba(30, 64, 85, 0.045);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.drive-input-group:focus-within {
    border-color: #75b4cb;
    box-shadow: 0 7px 17px rgba(31, 85, 104, 0.1);
}

.drive-input-group[data-processed="true"] {
    border-left: 3px solid #35a778;
}

.drive-box .input-row {
    min-height: 44px;
    gap: 9px;
    padding: 0 12px;
    border: 1px solid #edf2f6;
    border-radius: 8px;
    background: #f8fafc;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.drive-box .input-row:focus-within {
    border-color: #1f6b84;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(31, 107, 132, 0.11);
}

.drive-box .input-row i {
    color: #6d92a6;
    font-size: 15px;
}

.drive-box .drive-url-input,
.drive-box .drive-name-input {
    padding: 10px 0;
    color: #243b53;
    font-size: 12px;
    font-weight: 600;
}

.drive-box .drive-url-input::placeholder,
.drive-box .drive-name-input::placeholder {
    color: #8ca0b3;
    font-weight: 500;
}

#btn-add-drive-link {
    min-height: 40px;
    margin-top: 12px !important;
    border: 1px dashed #4d91ab !important;
    border-radius: 9px;
    background: #f1f8fb;
    color: #1f637c;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.15px;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

#btn-add-drive-link:hover {
    background: #1f637c;
    border-color: #1f637c !important;
    color: #ffffff;
    transform: translateY(-1px);
}

#btn-add-drive-link i {
    font-size: 14px;
}

.drive-box .btn-remove-link {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #fecdd3 !important;
    border-radius: 7px;
    background: #fff1f2 !important;
    color: #be123c !important;
}

.drive-box .btn-remove-link:hover {
    background: #ffe4e6 !important;
    border-color: #fda4af !important;
}

/* =========================================
   ESTADO BLOQUEADO (Para usuários Free)
   ========================================= */
.drive-box.locked .locked-overlay {
    display: flex;
}

.locked-overlay {
    display: none; /* Escondido por padrão para usuários premium */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(3px); /* Efeito de vidro embaçado lindo */
    -webkit-backdrop-filter: blur(3px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    text-align: center;
}


#auth-modal-box {
    max-width: 720px !important;
    width: 100%;
}
