/* --------------------- */
/* RESET E BASE OTIMIZADOS */
/* --------------------- */
:root {
    --primary-color: #2d89ff;
    --primary-dark: #1a6fd9;
    --secondary-color: #1D4ED8;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #e74c3c;
    --text-dark: #2c3e50;
    --text-medium: #495057;
    --text-light: #6c757d;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --border-color: #e9ecef;
    --border-radius: 12px;
    --transition: all 0.3s ease;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f6fa 0%, #e9ecef 100%);
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    line-height: 1.6;
    color: var(--text-medium);
}

/* --------------------- */
/* ACESSIBILIDADE */
/* --------------------- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --------------------- */
/* ESTRUTURA DE FORMULÁRIO SEMÂNTICA */
/* --------------------- */
.form-group {
    border: none;
    padding: 0;
    margin: 0 0 2rem 0;
}

.form-group legend {
    font-weight: 600;
    color: var(--text-medium);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    width: 100%;
}

.form-field {
    margin-bottom: 1.5rem;
}

.form-field label {
    font-weight: 600;
    margin-bottom: 8px;
    display: block;
    color: var(--text-medium);
    font-size: 14px;
}

/* --------------------- */
/* LAYOUT PRINCIPAL */
/* --------------------- */
.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-white);
    padding: 0;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}

/* --------------------- */
/* CABEÇALHO OTIMIZADO */
/* --------------------- */
.site-header {
    width: 100%;
    max-width: 800px;
    margin: 0 auto 30px auto;
    padding: 0;
    text-align: center;
    background: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    box-sizing: border-box;
    overflow: hidden;
}

.header-image {
    width: 100%;
    height: 140px;
    background-image: url("../img/cabecalho.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    position: relative;
}

.header-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(45, 137, 255, 0.1) 0%, transparent 100%);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.header-content {
    width: 100%;
    padding: 20px 30px;
    background: var(--secondary-color);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 5px 0;
    color: var(--bg-white);
    letter-spacing: -0.5px;
}

.header-subtitle {
    font-size: 14px;
    opacity: 0.9;
    margin: 0;
    color: #e9ecef;
    line-height: 1.4;
}

/* --------------------- */
/* ALERTA */
/* --------------------- */
.alert-box {
    background: #fff3f3;
    border: 2px solid var(--warning-color);
    border-radius: var(--border-radius);
    padding: 25px 30px;
    margin: 30px auto;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.15);
    max-width: 800px;
    width: 100%;
    box-sizing: border-box;
    animation: fadeInUp 0.6s ease;
}

.alert-icon {
    font-size: 28px;
    flex-shrink: 0;
    color: var(--warning-color);
}

.alert-content {
    color: #c0392b;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
    flex: 1;
}

.alert-content strong {
    font-weight: 700;
}

/* --------------------- */
/* BARRA DE PROGRESSO */
/* --------------------- */
.progress {
    width: 90%;
    background: var(--border-color);
    height: 8px;
    border-radius: 10px;
    margin: 20px auto;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #4dabf7);
    border-radius: 10px;
    transition: width 0.4s ease;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* --------------------- */
/* FORMULÁRIO PRINCIPAL */
/* --------------------- */
form {
    padding: 30px;
}

/* --------------------- */
/* SEÇÕES DO FORMULÁRIO */
/* --------------------- */
.page {
    padding: 25px;
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    background: var(--bg-white);
    animation: fadeInUp 0.5s ease;
}

.page h2 {
    color: var(--text-dark);
    font-size: 22px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f1f3f4;
    position: relative;
    font-weight: 600;
}

.page h2::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: var(--primary-color);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --------------------- */
/* CAMPOS DE FORMULÁRIO */
/* --------------------- */
input,
select,
textarea {
    width: 100%;
    padding: 14px 16px;
    margin-top: 8px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
    box-sizing: border-box;
    transition: var(--transition);
    background: var(--bg-light);
    font-family: inherit;
}

input:hover,
select:hover,
textarea:hover {
    border-color: #c5d9f1;
    background: var(--bg-white);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-white);
    box-shadow: 0 0 0 3px rgba(45, 137, 255, 0.1);
    transform: translateY(-1px);
}

textarea {
    height: 100px;
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

::placeholder {
    color: var(--text-light);
    opacity: 0.7;
}

/* --------------------- */
/* LAYOUT FLEX */
/* --------------------- */
.flex-row {
    display: flex;
    gap: 15px;
}

.flex-row>* {
    flex: 1;
}

/* --------------------- */
/* ESTADOS DE CAMPO */
/* --------------------- */
.hidden {
    display: none !important;
}

.input-extra {
    margin-top: 10px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --------------------- */
/* CHECKBOXES */
/* --------------------- */
.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
    margin: 15px 0;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: var(--bg-light);
    border-radius: 8px;
    transition: var(--transition);
    cursor: pointer;
    margin: 0;
    border: 2px solid transparent;
}

.checkbox-group label:hover {
    background: #e9ecef;
    transform: translateY(-1px);
    border-color: #c5d9f1;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    margin: 0;
}

/* --------------------- */
/* BOTÕES */
/* --------------------- */
.actions {
    margin-top: 30px;
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: var(--transition);
    min-width: 120px;
    text-align: center;
    font-family: inherit;
    text-decoration: none;
    display: inline-block;
}

.btn.primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(45, 137, 255, 0.3);
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(45, 137, 255, 0.4);
}

.btn.primary:active {
    transform: translateY(0);
}

.btn.prev {
    background: var(--text-light);
    color: white;
}

.btn.prev:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

.btn:disabled::after {
    content: '...';
    animation: loading 1.5s infinite;
}

@keyframes loading {

    0%,
    33% {
        content: '.';
    }

    34%,
    66% {
        content: '..';
    }

    67%,
    100% {
        content: '...';
    }
}

/* --------------------- */
/* LGPD */
/* --------------------- */
.lgpd-container {
    margin-top: 20px;
    padding: 25px;
    background: #f8f9ff;
    border-radius: var(--border-radius);
    border: 2px solid #e3f2fd;
    transition: var(--transition);
}

.lgpd-container:hover {
    border-color: #c5d9f1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.lgpd-label {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-dark);
    margin-bottom: 15px;
    display: block;
}

.lgpd-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-medium);
    margin-bottom: 20px;
}

.lgpd-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.lgpd-option {
    flex: 1;
    min-width: 150px;
}

.lgpd-option input[type="radio"] {
    display: none;
}

.lgpd-button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    color: var(--text-medium);
    justify-content: center;
}

.lgpd-button:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.lgpd-icon {
    width: 20px;
    height: 20px;
    transition: var(--transition);
}

/* Botão Sim */
.lgpd-button-yes:hover {
    border-color: var(--success-color);
    color: var(--success-color);
}

.lgpd-option input[type="radio"]:checked+.lgpd-button-yes {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.lgpd-option input[type="radio"]:checked+.lgpd-button-yes .lgpd-icon {
    color: white;
}

/* Botão Não */
.lgpd-button-no:hover {
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.lgpd-option input[type="radio"]:checked+.lgpd-button-no {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.lgpd-option input[type="radio"]:checked+.lgpd-button-no .lgpd-icon {
    color: white;
}

/* --------------------- */
/* PIX */
/* --------------------- */
.pix-container {
    display: flex;
    align-items: flex-start;
    gap: 25px;
    margin: 25px 0;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9ff, #e3f2fd);
    border-radius: var(--border-radius);
    border: 2px dashed var(--primary-color);
    transition: var(--transition);
}

.pix-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(45, 137, 255, 0.15);
}

.pix-container img.qrcode {
    width: 200px;
    height: 200px;
    object-fit: contain;
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    padding: 8px;
    background: white;
    box-shadow: var(--shadow-sm);
}

.pix-info {
    flex: 1;
}

.pix-info h3 {
    color: var(--text-dark);
    margin-bottom: 15px;
    font-size: 18px;
}

.pix-key-container {
    margin: 20px 0;
}

.pix-key-wrapper {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

#pixKey {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-white);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: var(--text-medium);
    cursor: text;
}

.btn-copy {
    padding: 12px 20px;
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-copy:hover {
    background: #218838;
    transform: translateY(-1px);
}

.btn-copy.copied {
    background: #17a2b8;
}

.muted {
    color: var(--text-light);
    font-style: italic;
    font-size: 14px;
    margin: 0;
}

/* --------------------- */
/* INFORMAÇÕES DE ISENÇÃO */
/* --------------------- */
.isento-info {
    background-color: #f0f9ff;
    border-left: 4px solid #0ea5e9;
    padding: 20px;
    margin: 15px 0;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    color: #0369a1;
}

.isento-info p {
    margin-bottom: 12px;
}

.isento-info p:last-child {
    margin-bottom: 0;
}

.isento-info strong {
    color: #0c4a6e;
    font-weight: 600;
}

/* --------------------- */
/* VALIDAÇÃO E ERROS */
/* --------------------- */
.error-message {
    display: block;
    margin-top: 8px;
    color: var(--danger-color);
    font-size: 13px;
    font-weight: 500;
    padding: 8px 12px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
}

input.valid {
    border-color: var(--success-color) !important;
    background: #f8fff9 !important;
}

input.invalid {
    border-color: var(--danger-color) !important;
    background: #f8d7da !important;
}

/* Remover validação nativa do navegador */
input:invalid,
select:invalid,
textarea:invalid {
    border-color: var(--border-color) !important;
    background: var(--bg-light) !important;
    box-shadow: none !important;
}

input:invalid:focus,
select:invalid:focus,
textarea:invalid:focus {
    border-color: var(--primary-color) !important;
    background: var(--bg-white) !important;
    box-shadow: 0 0 0 3px rgba(45, 137, 255, 0.1) !important;
}

/* --------------------- */
/* RODAPÉ */
/* --------------------- */
.site-footer {
    width: 100%;
    max-width: 800px;
    margin: 20px auto 0 auto;
    padding: 25px 30px;
    text-align: center;
    background: var(--secondary-color);
    color: #e9ecef;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    box-sizing: border-box;
}

.footer-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-copyright {
    font-size: 15px;
    opacity: 0.9;
    margin: 0;
    font-weight: 500;
    color: var(--bg-white);
}

.footer-credits {
    font-size: 14px;
    opacity: 0.9;
    margin: 0;
    color: #f8f9fa;
}

.footer-credits strong {
    color: var(--bg-white);
    font-weight: 600;
}

.footer-credits:hover strong {
    color: #74c0fc;
    transition: color 0.3s ease;
}

/* --------------------- */
/* RESPONSIVIDADE */
/* --------------------- */
@media (max-width: 768px) {
    body {
        padding: 10px;
        background: var(--bg-light);
    }

    .container,
    .site-header,
    .alert-box,
    .site-footer {
        max-width: calc(100% - 40px);
    }

    .site-header,
    .alert-box {
        margin-bottom: 25px;
    }

    .site-footer {
        margin-top: 15px;
        padding: 20px 25px;
    }

    .header-image {
        height: 120px;
    }

    .header-content {
        padding: 18px 25px;
    }

    .header-title {
        font-size: 16px;
    }

    .header-subtitle {
        font-size: 13px;
    }

    .alert-box {
        padding: 20px 25px;
        gap: 15px;
    }

    .alert-icon {
        font-size: 24px;
    }

    .alert-content {
        font-size: 15px;
    }

    form {
        padding: 20px;
    }

    .page {
        padding: 20px;
    }

    .flex-row {
        flex-direction: column;
        gap: 0;
    }

    .checkbox-group {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .pix-container {
        flex-direction: column;
        text-align: center;
        gap: 20px;
        padding: 20px;
    }

    .pix-container img.qrcode {
        width: 130px;
        height: 130px;
    }

    .pix-key-wrapper {
        flex-direction: column;
    }

    .actions {
        flex-direction: column;
        gap: 10px;
    }

    .btn {
        width: 100%;
        padding: 16px 24px;
    }

    .progress {
        width: 85%;
        margin: 15px auto;
    }

    .lgpd-buttons {
        flex-direction: column;
    }

    .lgpd-option {
        min-width: auto;
    }

    .lgpd-button {
        padding: 14px 18px;
        font-size: 14px;
    }

    .lgpd-icon {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 480px) {

    .container,
    .site-header,
    .alert-box,
    .site-footer {
        max-width: calc(100% - 20px);
    }

    .site-header,
    .alert-box {
        margin-bottom: 20px;
    }

    .site-footer {
        margin-top: 10px;
        padding: 18px 20px;
    }

    .header-image {
        height: 100px;
    }

    .header-content {
        padding: 15px 20px;
    }

    .header-title {
        font-size: 15px;
    }

    .header-subtitle {
        font-size: 12px;
    }

    .alert-box {
        padding: 18px 20px;
        gap: 12px;
    }

    .alert-icon {
        font-size: 22px;
    }

    .alert-content {
        font-size: 14px;
        text-align: left;
    }

    form {
        padding: 15px;
    }

    .page {
        padding: 15px;
    }

    .page h2 {
        font-size: 20px;
        margin-bottom: 20px;
    }

    input,
    select,
    textarea {
        padding: 12px 14px;
        font-size: 14px;
    }

    .pix-container img.qrcode {
        width: 100px;
        height: 100px;
    }

    .footer-copyright {
        font-size: 13px;
    }

    .footer-credits {
        font-size: 12px;
    }

    .lgpd-container {
        padding: 20px;
    }

    .lgpd-button {
        padding: 12px 16px;
        font-size: 13px;
    }

    .lgpd-label {
        font-size: 15px;
    }

    .lgpd-text {
        font-size: 13px;
    }
}

/* --------------------- */
/* ANIMAÇÕES EXTRAS */
/* --------------------- */
@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}
