/* ============================================= */
/* ESTILOS GERAIS - TEMA CLARO                  */
/* ============================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f4f8;
    color: #1e293b;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    width: 100%;
    background: #ffffff;
    padding: 30px 35px;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

/* ============================================= */
/* CABEÇALHO                                     */
/* ============================================= */

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.4rem;
    font-weight: 700;
    background: linear-gradient(135deg, #2563eb, #10b981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

header p {
    color: #64748b;
    font-size: 1rem;
    margin-top: 6px;
}

/* ============================================= */
/* CARD DE INSTALAÇÃO DO PWA                    */
/* ============================================= */

#installBanner {
    background: #dbeafe;
    border: 1px solid #93c5fd;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 20px;
    display: none; /* Escondido por padrão, será exibido via JS se necessário */
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

#installBanner .banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

#installBanner .banner-content span {
    font-size: 2rem;
}

#installBanner .banner-content div strong {
    color: #1e3a8a;
}

#installBanner .banner-content div p {
    margin: 0;
    color: #1e40af;
    font-size: 0.9rem;
}

#installBtn {
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

#installBtn:hover {
    background: #1d4ed8;
}

#closeInstallBanner {
    background: transparent;
    color: #64748b;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
}

#closeInstallBanner:hover {
    color: #1e293b;
}

/* ============================================= */
/* FORMULÁRIO                                    */
/* ============================================= */

form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Campos */
.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.field-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.field-row .field {
    flex: 1;
    min-width: 180px;
}

label {
    font-weight: 600;
    font-size: 0.9rem;
    color: #334155;
    letter-spacing: 0.3px;
}

label span {
    color: #ef4444;
}

/* Inputs, selects, textareas */
input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
    color: #1e293b;
    font-size: 0.95rem;
    transition: border 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

textarea {
    min-height: 70px;
    resize: vertical;
    font-family: inherit;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23475569' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
    cursor: pointer;
}

select option {
    background: #ffffff;
    color: #1e293b;
}

/* Checkboxes (opções específicas) */
#checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    padding-top: 6px;
}

#checkboxes label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    font-size: 0.9rem;
    color: #334155;
    cursor: pointer;
}

#checkboxes input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: #2563eb;
    cursor: pointer;
}

/* Campo obrigatório com destaque */
.required textarea {
    border-color: #bfdbfe;
}

.required textarea:focus {
    border-color: #2563eb;
}

/* Pequenos textos de ajuda */
small {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 4px;
}

small strong {
    color: #2563eb;
}

/* ============================================= */
/* BOTÕES                                        */
/* ============================================= */

button {
    padding: 10px 22px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    background: #e2e8f0;
    color: #1e293b;
}

button:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.15);
}

button:active {
    transform: scale(0.97);
}

#gerarBtn {
    background: linear-gradient(135deg, #2563eb, #10b981);
    color: #fff;
    font-size: 1.1rem;
    padding: 14px;
    margin-top: 8px;
    letter-spacing: 0.5px;
}

#gerarBtn:hover {
    background: linear-gradient(135deg, #1d4ed8, #059669);
    box-shadow: 0 8px 30px rgba(37, 99, 235, 0.3);
}

#recomendarBtn {
    background: #e2e8f0;
    color: #1e293b;
    border: 1px solid #cbd5e1;
    white-space: nowrap;
}

#recomendarBtn:hover {
    background: #cbd5e1;
    border-color: #2563eb;
}

/* Botões da área de saída */
#saidaArea button {
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
    flex: 0 1 auto;
}

#saidaArea button:hover {
    background: #cbd5e1;
}

#copiarAbrirBtn {
    background: #dbeafe;
    border-color: #93c5fd;
}

#copiarAbrirBtn:hover {
    background: #bfdbfe;
}

#salvarBtn {
    background: #d1fae5;
    border-color: #6ee7b7;
}

#salvarBtn:hover {
    background: #a7f3d0;
}

/* ============================================= */
/* ÁREA DE SAÍDA                                 */
/* ============================================= */

#saidaArea {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 2px solid #e2e8f0;
}

#saidaArea h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: #1e293b;
}

#saidaTexto {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 20px;
    min-height: 180px;
    max-height: 500px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-break: break-word;
    color: #1e293b;
    line-height: 1.7;
}

#saidaTexto:focus {
    outline: none;
    border-color: #2563eb;
}

#saidaArea button {
    margin-top: 10px;
}

/* ============================================= */
/* HISTÓRICO                                     */
/* ============================================= */

#historicoArea {
    margin-top: 40px;
    border-top: 2px solid #e2e8f0;
    padding-top: 25px;
}

#historicoArea h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1e293b;
}

#listaHistorico {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
}

.historico-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.historico-item .info {
    flex: 1;
    min-width: 200px;
}

.historico-item .info .meta {
    font-size: 0.85rem;
    color: #2563eb;
    font-weight: 600;
    margin-bottom: 4px;
}

.historico-item .info .preview {
    font-size: 0.9rem;
    color: #1e293b;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.historico-item .acoes {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.historico-item .acoes button {
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
}

.historico-item .acoes .copiar-historico {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1e40af;
}

.historico-item .acoes .copiar-historico:hover {
    background: #bfdbfe;
}

.historico-item .acoes .excluir-historico {
    background: #fee2e2;
    border-color: #fecaca;
    color: #b91c1c;
}

.historico-item .acoes .excluir-historico:hover {
    background: #fecaca;
}

/* ============================================= */
/* MODAL DE NOTIFICAÇÃO                         */
/* ============================================= */

#notificationModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

#notificationModal .modal-content {
    background: #ffffff;
    max-width: 420px;
    width: 90%;
    border-radius: 16px;
    padding: 28px 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    text-align: center;
    border: 1px solid #e2e8f0;
    animation: slideUp 0.3s ease;
}

#notificationModal .modal-content .icon {
    font-size: 3rem;
    margin-bottom: 8px;
}

#notificationModal .modal-content h3 {
    color: #1e293b;
    margin-bottom: 8px;
}

#notificationModal .modal-content p {
    color: #475569;
    margin-bottom: 20px;
}

#notificationModal .modal-content button {
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 10px 30px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

#notificationModal .modal-content button:hover {
    background: #1d4ed8;
}

/* Animações do modal */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* ============================================= */
/* RODAPÉ                                        */
/* ============================================= */

footer {
    margin-top: 35px;
    text-align: center;
    font-size: 0.9rem;
    color: #475569;
    border-top: 1px solid #e2e8f0;
    padding-top: 20px;
}

footer a {
    text-decoration: none;
    color: #25D366;
    font-weight: 600;
    transition: color 0.2s;
}

footer a:hover {
    color: #128C7E;
}

footer .sub {
    margin-top: 4px;
    font-size: 0.7rem;
    color: #94a3b8;
}

/* ============================================= */
/* BARRA DE ROLAGEM PERSONALIZADA               */
/* ============================================= */

/* Para navegadores baseados em WebKit (Chrome, Edge, Safari) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #e2e8f0;
    border-radius: 8px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #2563eb, #10b981);
    border-radius: 8px;
    border: 2px solid #f8fafc;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #1d4ed8, #059669);
}

/* Para Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #2563eb #e2e8f0;
}

/* ============================================= */
/* RESPONSIVIDADE                                */
/* ============================================= */

@media (max-width: 650px) {
    .container {
        padding: 20px 16px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .field-row {
        flex-direction: column;
        gap: 12px;
    }

    .field-row .field {
        min-width: unset;
    }

    #checkboxes {
        flex-direction: column;
        gap: 8px;
    }

    #saidaTexto {
        max-height: 350px;
        font-size: 0.8rem;
        padding: 14px;
    }

    #recomendarBtn {
        width: 100%;
        justify-content: center;
    }

    button {
        padding: 8px 14px;
        font-size: 0.85rem;
    }

    #gerarBtn {
        font-size: 1rem;
        padding: 12px;
    }

    #saidaArea button {
        flex: 1 1 100%;
    }

    .historico-item {
        flex-direction: column;
        align-items: stretch;
    }

    .historico-item .acoes {
        justify-content: flex-end;
    }

    #installBanner {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    #installBanner .banner-content {
        flex-direction: column;
    }
}

@media (max-width: 420px) {
    header h1 {
        font-size: 1.5rem;
    }
    .container {
        padding: 14px 12px;
    }
    label {
        font-size: 0.8rem;
    }
    input, select, textarea {
        font-size: 0.85rem;
        padding: 8px 10px;
    }
}