/* CGNAT Generator - Estilo próprio (sem AdminLTE) */
:root {
    --bg-page: #0f1419;
    --bg-card: #1a2332;
    --bg-input: #242f3d;
    --border: #2d3a4d;
    --text: #e6edf3;
    --text-muted: #8b9eb0;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-soft: rgba(59, 130, 246, 0.15);
    --success: #22c55e;
    --danger: #ef4444;
    --radius: 12px;
    --radius-sm: 8px;
    --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --transition: 0.2s ease;
}

* {
    box-sizing: border-box;
}

html {
    height: 100%;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    margin: 0;
    min-height: 100%;
    min-width: 0;
    font-family: var(--font-sans);
    font-size: clamp(15px, 2.5vw, 16px);
    line-height: 1.5;
    color: var(--text);
    background: var(--bg-page);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Layout principal */
.app-wrap {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    min-width: 0;
    width: 100%;
}

/* Faixa do header (mesma cor do footer) */
.header-band {
    width: 100%;
    max-width: 100%;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: center;
    padding: 1.5rem 1rem;
}

.header-band .page-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0;
    width: 100%;
    max-width: 1200px;
}

.header-band .page-hero .page-logo {
    margin-bottom: 0;
}

.lang-switcher {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.9rem;
}

.lang-switcher .lang-link {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
}

.lang-switcher .lang-link:hover {
    color: var(--text);
    background: var(--accent-soft);
}

.lang-switcher .lang-link.is-active {
    color: var(--accent);
    font-weight: 600;
}

.lang-switcher .lang-sep {
    color: var(--text-muted);
    opacity: 0.6;
    user-select: none;
}

.header-band .page-logo img {
    max-width: 100%;
    height: auto;
    max-height: 48px;
}

/* Conteúdo centralizado */
.app-main {
    flex: 1;
    padding: 1.5rem 1rem;
    min-width: 0;
    width: 100%;
    max-width: 100%;
}

.app-main--centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
}

.app-main--centered .card,
.app-main--centered .content {
    width: 100%;
    min-width: 0;
    max-width: min(60rem, 100%);
}

/* Formulário da página inicial: largura mínima maior em telas médias/grandes */
.app-main--centered form .card {
    min-width: 28rem;
    max-width: min(72rem, 100%);
}

.app-main--centered .content .card {
    max-width: min(1000px, 100%);
}

/* Desktop: resultado mais alto e card mais largo para evitar overflow na largura */
@media (min-width: 800px) {
    .app-main--centered .content .card {
        max-width: min(1200px, 100%);
    }

    .result-block {
        max-height: 90vh;
    }

    .result-block #pedrindabalsa {
        max-height: 65vh;
    }
}

.app-main--centered .card {
    text-align: left;
}

/* Título acima do formulário */
.app-main--centered .page-title {
    margin: 0 0 1.5rem;
}

/* Logo no header-band */
.page-hero {
    margin-bottom: 0;
}

.page-logo {
    display: inline-block;
    margin-bottom: 1.25rem;
}

.page-logo {
    display: inline-block;
    margin-bottom: 0.75rem;
}

.page-logo img {
    height: 48px;
    width: auto;
    max-width: 100%;
    display: block;
}

.page-title {
    margin: 0 0 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.page-title small {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-muted);
}

/* Card / Box */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.card-body {
    padding: 1.25rem 1rem;
}

/* Formulário */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
}

.form-control {
    width: 100%;
    max-width: 100%;
    padding: 0.75rem 0.85rem;
    font-family: var(--font-sans);
    font-size: 16px; /* evita zoom no iOS */
    color: var(--text);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.8;
}

.form-control:hover {
    border-color: #3d4d62;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

select.form-control {
    cursor: pointer;
}

.phone-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
    min-width: 0;
}

.phone-row .form-control--ddi {
    flex: 0 0 auto;
    width: 9rem;
    min-width: 0;
    max-width: 50%;
}

.phone-row .form-control--phone {
    flex: 1;
    min-width: 0;
}

/* Botões */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px; /* área de toque adequada no mobile */
    padding: 0.75rem 1.25rem;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition), color var(--transition), transform 0.1s ease;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    color: #fff;
    background: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-primary .icon {
    font-size: 1rem;
}

.btn:not(.btn-primary) {
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn:not(.btn-primary):hover {
    background: #2d3a4d;
}

/* Alerta */
.alert {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

.alert.hidden {
    display: none !important;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition);
}

.modal-backdrop.is-open {
    opacity: 1;
    visibility: visible;
}

.modal {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    z-index: 1001;
    width: calc(100% - 2rem);
    max-width: 420px;
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition), transform var(--transition);
    overflow: hidden;
}

.modal form {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.modal.is-open {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    transition: color var(--transition), background var(--transition);
}

.modal-close:hover {
    color: var(--text);
    background: var(--bg-input);
}

.modal-body {
    padding: 1.25rem 1rem;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    min-width: 0;
}

.modal-body .form-group {
    margin-bottom: 1rem;
    min-width: 0;
}

.modal-body .form-control {
    min-width: 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

/* Footer da página (estilo made4it) */
.app-footer {
    margin-top: auto;
    width: 100%;
    max-width: 100%;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    overflow-x: hidden;
}

.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1rem 1.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 2rem;
    width: 100%;
}

.footer-brand .page-logo img {
    max-width: 100%;
    height: auto;
    max-height: 40px;
}

/* Telas médias/grandes: mais respiro no notebook, formulário mais largo */
@media (min-width: 800px) {
    .app-main {
        padding: 2rem 1.5rem;
    }

    .header-band {
        padding: 2rem 1.5rem;
    }

    .card-body {
        padding: 1.5rem;
    }

    .app-main--centered form .card {
        min-width: 32rem;
        max-width: min(72rem, 100%);
    }
}

/* Responsivo: tablet e abaixo */
@media (max-width: 800px) {
    .app-main--centered form .card {
        min-width: 0;
    }

    .header-band {
        padding: 1.25rem 1rem;
    }

    .header-band .page-logo img {
        max-height: 40px;
    }

    .app-main {
        padding: 1.25rem 1rem;
    }

    .page-title {
        font-size: 1.25rem;
    }

    .page-title small {
        font-size: 0.85rem;
    }

    .card-body {
        padding: 1rem;
    }

    .footer-inner {
        grid-template-columns: 1fr;
        padding: 1.5rem 1rem 1rem;
        gap: 1.5rem;
    }

    .footer-brand .footer-desc {
        max-width: 100%;
    }

    .footer-copy {
        padding: 1rem;
        font-size: 0.75rem;
        word-break: break-word;
    }
}

/* Responsivo: celular */
@media (max-width: 800px) {
    body {
        font-size: 15px;
    }

    .header-band {
        padding: 1rem 0.75rem;
    }

    .header-band .page-logo img {
        max-height: 36px;
    }

    .app-main {
        padding: 1rem 0.75rem;
    }

    .page-title {
        font-size: 1.15rem;
    }

    .page-title small {
        font-size: 0.8rem;
    }

    /* Formulário: overflow lateral no celular (igual ao result-block) */
    .app-main--centered form {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }

    .app-main--centered form .card {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        min-width: min-content;
    }

    .result-block {
        max-height: 75vh;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .result-block #pedrindabalsa {
        max-height: 45vh;
        overflow-x: auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        max-width: none;
        min-width: min-content;
    }

    .result-block pre {
        padding: 0.75rem;
        font-size: 0.75rem;
        max-width: none;
        min-width: min-content;
    }

    .footer-inner {
        padding: 1.25rem 0.75rem 1rem;
    }

    .footer-contacts li,
    .footer-links a {
        font-size: 0.85rem;
    }
}

.footer-brand .footer-logo {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.75rem;
    letter-spacing: -0.02em;
}

.footer-brand .footer-logo .logo-it {
    color: var(--accent);
}

.footer-brand .footer-desc {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-muted);
    margin: 0 0 1.25rem;
    max-width: 280px;
}

.footer-social {
    display: flex;
    gap: 0.5rem;
}

.footer-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-input);
    color: var(--text-muted);
    transition: color var(--transition), background var(--transition);
}

.footer-social a:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.footer-social svg {
    width: 18px;
    height: 18px;
}

.footer-column h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    color: var(--text);
}

.footer-column .footer-underline {
    width: 40px;
    height: 3px;
    background: var(--accent);
    margin-bottom: 1rem;
    border-radius: 2px;
}

.footer-contacts {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-contacts li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
}

.footer-contacts li:last-child {
    margin-bottom: 0;
}

.footer-contacts .footer-icon {
    flex-shrink: 0;
    color: var(--accent);
    margin-top: 2px;
}

.footer-contacts .footer-icon svg {
    width: 16px;
    height: 16px;
}

.footer-links {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-links a {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-copy {
    text-align: center;
    padding: 1rem 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

.footer-copy a {
    color: var(--accent);
    text-decoration: none;
}

.footer-copy a:hover {
    text-decoration: underline;
}

/* Página de resultado (geracgnat) */
.result-block {
    margin-bottom: 1rem;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
}

.result-block pre {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.5;
    margin: 0 0 1rem;
    padding: 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    overflow-x: auto;
    min-width: 0;
    max-width: 100%;
}

/* Área do script gerado: altura limitada com rolagem */
.result-block #pedrindabalsa {
    max-height: 50vh;
    overflow: auto;
    margin-bottom: 0;
    flex-shrink: 0;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
}

.result-block .btn {
    margin-bottom: 0.5rem;
}

/* Utilitários */
.hidden { display: none !important; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

/* SEO content section */
.seo-content {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 1rem;
}

.seo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 1.25rem;
}

.seo-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.seo-card h2 {
    margin: 0 0 0.6rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.seo-card p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.65;
}

@media (max-width: 640px) {
    .seo-grid {
        grid-template-columns: 1fr;
    }
    .seo-content {
        padding: 1.5rem 1rem 0.5rem;
    }
}
