/* =========================================================
   ESTILOS GERAIS
   ========================================================= */
body {
    font-family: 'Inter', sans-serif;
    background-color: #f0f2f5;
    margin: 0;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

/* Layout Principal (Lado a Lado) */
.main-layout {
    display: flex;
    gap: 25px;
    width: 100%;
    max-width: 1200px;
}

/* Containers dos Painéis */
.container {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 16px; 
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08); 
    box-sizing: border-box;
    flex: 1;
    min-width: 300px;
}

/* Ajuste de cor para diferenciar sutilmente os títulos */
.container h1 {
    font-size: 26px;
    color: #1a202c;
    margin-bottom: 20px;
    line-height: 1.3;
    border-bottom: 4px solid #4285f4; 
    padding-bottom: 10px;
}
.container.links-rastreio h1 {
    border-bottom-color: #0ea5e9;
}

p {
    color: #4a5568;
    font-size: 15px;
    line-height: 1.5;
}

/* =========================================================
   PAINEL 1: ESTILOS DE BUSCA E RESULTADOS
   ========================================================= */
.search-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}
input[type="text"] {
    flex-grow: 1;
    padding: 14px 12px;
    font-size: 16px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-sizing: border-box;
    transition: border-color 0.3s;
}
input[type="text"]:focus {
    border-color: #4285f4;
    outline: none;
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}
.search-button {
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    background-color: #4285f4;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
.search-button:hover {
    background-color: #3367d6;
}

/* Card de Resultado */
#resultados {
    margin-top: 20px;
}

.result-card {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    gap: 12px; /* Espaço entre as linhas */
}

/* LINHA 1: Cabeçalho do Envio */
.card-header {
    font-size: 18px;
    font-weight: 700;
    color: #4285f4;
    margin-bottom: 5px;
}

/* LINHA 2: Chips (Retângulos arredondados) - OBRIGATORIAMENTE NA MESMA LINHA */
.chips-row {
    display: flex;
    flex-wrap: nowrap; /* Impede quebra de linha */
    gap: 8px;
    align-items: center;
    overflow-x: auto; /* Permite scroll horizontal se a tela for minúscula */
    padding-bottom: 5px; /* Espaço para scrollbar se aparecer */
}
/* Esconde barra de rolagem para estética (Webkit only) */
.chips-row::-webkit-scrollbar {
    height: 0px;
    background: transparent;
}

.data-chip {
    display: inline-block;
    background-color: #f1f5f9;
    color: #334155;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 13px; /* Fonte levemente menor para caber */
    font-weight: 600;
    border: 1px solid #e2e8f0;
    white-space: nowrap; /* Garante que o texto dentro do chip não quebre */
    flex-shrink: 0; /* Impede que o chip seja esmagado */
}
.data-chip strong {
    color: #1e293b;
    font-weight: 700;
}

/* LINHA 3: Transportadora e Destino */
.info-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 15px;
    color: #4a5568;
    padding-bottom: 10px;
    border-bottom: 1px dashed #e2e8f0;
}
.info-item strong {
    color: #1a202c;
    font-weight: 600;
}

/* LINHA 4: Dados para Rastreio - FONTE MENOR E LINHA ÚNICA */
.tracking-row {
    font-size: 13px;
    color: #1a202c;
    background-color: #f8fafc;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    /* Estilos base */
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
}

.tracking-code {
    font-weight: 700;
    color: #0ea5e9;
    font-family: monospace;
    font-size: 1.1em;
    margin-left: 8px;
}

/* =========================================================
   PAINEL 2: ESTILOS DE LINKS
   ========================================================= */
.form-group {
    text-align: left;
    margin-bottom: 24px;
}
label {
    display: block;
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
}
select {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background-color: #f1f5f9;
    color: #1e293b;
    box-sizing: border-box;
}
.rastrear-button {
    width: 100%;
    padding: 14px;
    font-size: 17px;
    font-weight: 600;
    background-color: #0ea5e9;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-bottom: 10px;
}
.rastrear-button:hover {
    background-color: #0284c7;
}
.tutorial-link {
    font-size: 12px;
    color: #64748b;
    text-align: center;
}
.tutorial-link a {
    color: #0ea5e9;
    text-decoration: none;
    font-weight: 600;
}

/* FOOTER */
.footer-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
    flex-wrap: wrap;
    width: 100%;
}
.footer-layout img {
    max-width: 150px;
}
.support-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background-color: #fbbf24;
    color: #000000;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border-radius: 8px;
    box-shadow: 0 3px 8px rgba(251, 191, 36, 0.3);
    border: 1px solid #f59e0b;
}

/* RESPONSIVIDADE */
@media (max-width: 900px) {
    .main-layout {
        flex-direction: column;
    }
}
@media (max-width: 600px) {
    .search-group {
        flex-direction: column;
    }
    input[type="text"], .search-button {
        width: 100%;
    }
}

/* =========================================================
   CLASSES DE MENSAGENS DE STATUS
   ========================================================= */
.status-message {
    padding: 15px;
    border-radius: 8px;
    line-height: 1.5;
    font-weight: 500;
    margin: 10px 0;
}

.status-loading {
    color: #64748b;
    font-style: italic;
    padding: 0; 
    background: none;
    border: none;
}

.status-not-found {
    color: #4a5568;
    background-color: #fff3cd; 
    border: 1px solid #ffeeba; 
}

.status-warning {
    color: red;
    font-weight: 600;
    background-color: #fcebeb; 
    border: 1px solid #f8baba;
}


/* =========================================================
   ESTILOS DOS MODOS DE RASTREIO
   ========================================================= */

/* Modo Link (URL completo) */
.tracking-row.link-mode {
    background-color: #e0f2f7; 
    border: 1px solid #bae6fd;
    white-space: normal;
    text-align: left; 
    overflow: auto; 
    text-overflow: clip; 
}

.tracking-link {
    font-weight: 700;
    color: #0c4a6e;
    text-decoration: none; 
    margin-left: 8px;
    padding: 4px 8px;
    border-radius: 4px;
    background-color: #a5f3fc; 
    transition: background-color 0.2s;
    display: inline-block; 
}

.tracking-link:hover {
    background-color: #67e8f9;
}

/* Modo Código Único (Ex: Correios) */
.tracking-row.code-mode {
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Alinha o texto à esquerda */
    gap: 8px;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tracking-row.code-mode .tracking-code {
    flex-grow: 0; 
    flex-shrink: 0;
}
.tracking-row.code-mode .copy-button {
    margin-left: auto; /* Empurra o botão para o canto direito */
}

/* Modo Código Duplo (Ex: CNPJ + NF) - NOVO */
.tracking-row.dual-code-mode {
    background-color: #f0fdf4; /* Fundo verde claro para destacar a diferença */
    border: 1px solid #dcfce7;
    white-space: normal;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px; /* Resetar o padding do tracking-row */
    border-radius: 8px;
}

.tracking-row.dual-code-mode .tracking-label {
    font-size: 14px;
    font-weight: 600;
    color: #047857; /* Texto de instrução verde escuro */
    margin-bottom: 5px;
}

.code-pair {
    display: flex;
    flex-wrap: wrap; /* Permite quebrar se não houver espaço */
    gap: 15px; /* Espaço entre os pares CNPJ e NF */
}

.copy-group {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
}

.copy-group .code-label {
    font-weight: 600;
    color: #1a202c;
}

/* Botão de Cópia (Comum a todos os modos de código) */
.copy-button {
    background-color: #e0f2f7; 
    color: #0c4a6e;
    border: 1px solid #bae6fd;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.2s;
    line-height: 1;
    flex-shrink: 0;
}

.copy-button:hover {
    background-color: #bae6fd;
}