/**
 * AFV Simple Portal - Formulários Compartilhados
 * CSS unificado para todos os formulários AFV
 * Baseado no Flow Design System
 */

/* ==========================================
/**
 * AFV Simple Portal - Formulários Compartilhados
 * CSS unificado para todos os formulários AFV
 * Baseado no Flow Design System
 */

/* ==========================================
   FORMULÁRIOS - DESIGN SYSTEM FLOW AFV
   ========================================== */

.afv-form-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Safe Area Support */
@supports (padding: max(0px)) {
    .afv-form-container {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
}

/* Hero Section */
.afv-form-hero-wrapper {
    margin-bottom: 2rem;
}

.afv-portal-hero {
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.08) 0%, rgba(196, 181, 253, 0.04) 100%);
    border-radius: 20px;
    padding: 40px;
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 32px;
    align-items: start;
    border: 1px solid rgba(167, 139, 250, 0.1);
}

.afv-portal-hero-text {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.afv-portal-hero-eyebrow {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #7c6fa8;
    text-transform: uppercase;
    margin: 0;
}

.afv-portal-hero h2 {
    font-size: 32px;
    font-weight: 700;
    color: #1f1953;
    margin: 0;
    line-height: 1.3;
}

.afv-portal-hero-description {
    font-size: 15px;
    color: #4d4975;
    line-height: 1.6;
    margin: 0;
}

.afv-portal-hero-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.afv-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.12), rgba(196, 181, 253, 0.08));
    color: #6d5b9d;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid rgba(167, 139, 250, 0.15);
}

/* Status Card */
.afv-portal-status-card {
    background: linear-gradient(135deg, #f8f7ff 0%, #fafbff 100%);
    border: 1px solid rgba(167, 139, 250, 0.15);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.afv-portal-status-card.is-draft {
    border-color: rgba(167, 139, 250, 0.2);
}

.afv-portal-status-card.is-submitted {
    border-color: rgba(16, 185, 129, 0.2);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05), rgba(16, 185, 129, 0.02));
}

.afv-portal-status-icon {
    font-size: 28px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.15), rgba(196, 181, 253, 0.1));
    border-radius: 12px;
}

.afv-portal-status-card.is-submitted .afv-portal-status-icon {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.1));
}

.afv-form-status-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.afv-portal-status-label {
    font-size: 13px;
    font-weight: 600;
    color: #7c6fa8;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin: 0;
}

.afv-portal-status-description {
    font-size: 16px;
    font-weight: 600;
    color: #1f1953;
    margin: 0;
    line-height: 1.4;
}

.afv-portal-status-list {
    list-style: none;
    margin: 8px 0 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 13px;
    color: #4d4975;
}

.afv-portal-status-list li {
    display: flex;
    align-items: center;
    gap: 6px;
}

.afv-portal-status-list li::before {
    content: '→';
    color: #a78bfa;
    font-weight: 600;
}

/* Alerts */
.afv-portal-alerts {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 2rem;
}

.afvsp-alert {
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    border-left: 4px solid;
}

.afvsp-alert p {
    margin: 0;
}

.afvsp-alert.success {
    background: rgba(16, 185, 129, 0.08);
    border-color: #10b981;
    color: #047857;
}

.afvsp-alert.error {
    background: rgba(239, 68, 68, 0.08);
    border-color: #ef4444;
    color: #b91c1c;
}

.afvsp-alert.info {
    background: rgba(59, 130, 246, 0.08);
    border-color: #3b82f6;
    color: #1e40af;
}

/* Form Wrapper */
.afv-form-wrapper {
    background: white;
    border-radius: 16px;
    border: 1px solid rgba(167, 139, 250, 0.08);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    padding: 28px;
    margin-bottom: 2rem;
}

/* Tabs Navigation - Mobile Optimized */
.afvsp-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid rgba(167, 139, 250, 0.1);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 4px;
    margin-bottom: 24px;
}

.afvsp-tab {
    flex-shrink: 0;
    min-width: 120px;
    min-height: 44px;
    /* Touch target */
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: #7c6fa8;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: none;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.afvsp-tab:hover {
    color: #a78bfa;
    border-bottom-color: rgba(167, 139, 250, 0.3);
}

.afvsp-tab.active,
.afvsp-tab.is-active {
    color: #a78bfa;
    border-bottom-color: #a78bfa;
}

/* Tab Panels */
.afvsp-tab-panel {
    display: none;
    animation: fadeIn 0.2s ease;
}

.afvsp-tab-panel.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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

.afvsp-tab-panel h3 {
    font-size: 20px;
    font-weight: 700;
    color: #1f1953;
    margin: 0 0 24px 0;
}

/* Form Sections */
.afvsp-form-section {
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.04), rgba(196, 181, 253, 0.02));
    border: 1px solid rgba(167, 139, 250, 0.1);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    position: relative;
    transition: all 0.2s ease;
}

.afvsp-form-section:hover {
    border-color: rgba(167, 139, 250, 0.15);
    box-shadow: 0 4px 12px rgba(167, 139, 250, 0.08);
}

.afvsp-form-section h3 {
    font-size: 20px;
    font-weight: 700;
    color: #1f1953;
    margin: 0 0 24px 0;
}

.afvsp-form-section h4 {
    font-size: 18px;
    font-weight: 700;
    color: #1f1953;
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(167, 139, 250, 0.1);
}

.afvsp-form-section h4::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background: linear-gradient(135deg, #a78bfa 0%, #8f73ff 100%);
    border-radius: 2px;
    margin-right: 12px;
    vertical-align: middle;
}

/* Grid Layouts - Mobile First */
.afvsp-grid-2,
.afvsp-grid-3,
.afvsp-grid-4 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 481px) {
    .afvsp-grid-2 {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }
}

@media (min-width: 769px) {
    .afvsp-grid-3 {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

    .afvsp-grid-4 {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }
}

/* Form Elements */
.afvsp-form-section>div,
.afvsp-grid-2>div,
.afvsp-grid-3>div {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Flexbox layout for optimized sections - Mobile First */
.afvsp-form-section>div:not(.afvsp-grid-2 > div):not(.afvsp-grid-3 > div) {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.afvsp-form-section>div:not(.afvsp-grid-2 > div):not(.afvsp-grid-3 > div)>div {
    display: flex;
    flex-direction: column;
    /* Mobile: column */
    gap: 16px;
}

.afvsp-form-section>div:not(.afvsp-grid-2 > div):not(.afvsp-grid-3 > div)>div>div {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

@media (min-width: 769px) {
    .afvsp-form-section>div:not(.afvsp-grid-2 > div):not(.afvsp-grid-3 > div)>div {
        flex-direction: row;
        /* Desktop: row */
        flex-wrap: wrap;
        align-items: end;
    }
}

.afvsp-form-section label {
    font-size: 14px;
    font-weight: 600;
    color: #1f1953;
}

.afvsp-section-subtitle {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    font-weight: 500 !important;
    margin: 12px 0;
}

.afvsp-section-subtitle input[type="checkbox"] {
    margin: 0 !important;
}

/* Field Controls */
.afv-form-field {
    width: 100%;
    border-radius: 999px;
    border: 1px solid rgba(118, 106, 255, 0.3);
    padding: 10px 16px;
    font-size: 14px;
    line-height: 1.4;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    color: #1f1953;
    box-shadow: inset 0 1px 2px rgba(31, 25, 83, 0.06);
}

.afv-form-field:focus {
    border-color: #a78bfa;
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.2);
    outline: none;
}

/* Focus Visible Improvement */
.afvsp-form-section input:focus-visible,
.afvsp-form-section select:focus-visible,
.afvsp-form-section textarea:focus-visible,
.afvsp-btn:focus-visible,
.afv-btn:focus-visible,
.afv-btn-primary:focus-visible {
    outline: 3px solid #a78bfa;
    outline-offset: 2px;
    border-color: #a78bfa;
}

.afv-form-field[type="date"] {
    font-size: 14px;
}

.afvsp-form-section label {
    font-size: 14px;
    font-weight: 600;
    color: #1f1953;
}

.afvsp-form-help {
    font-size: 13px;
    color: #6d6d91;
}

.afvsp-radio-group,
.afvsp-radio-group label {
    font-size: 14px;
    color: #1f1953;
}

/* Actions - Mobile First */
.afv-form-wrapper .afv-form-actions {
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    /* Mobile: stack */
    gap: 12px;
    width: 100%;
}

.afv-form-wrapper .afv-form-actions .afvsp-btn,
.afv-form-wrapper .afv-form-actions .afv-btn,
.afv-form-wrapper .afv-form-actions .afv-btn-primary {
    width: 100%;
    min-height: 48px;
    justify-content: center;
}

@media (min-width: 481px) {
    .afv-form-wrapper .afv-form-actions {
        flex-direction: row;
        /* Desktop: row */
        flex-wrap: wrap;
    }

    .afv-form-wrapper .afv-form-actions .afvsp-btn,
    .afv-form-wrapper .afv-form-actions .afv-btn,
    .afv-form-wrapper .afv-form-actions .afv-btn-primary {
        width: auto;
        flex: 1;
    }
}

.afvsp-form-section input[type="date"]:focus,
.afvsp-form-section input[type="number"]:focus,
.afvsp-form-section select:focus,
.afvsp-form-section textarea:focus {
    outline: none;
    border-color: #a78bfa;
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.1);
}

.afvsp-form-section input[type="text"]:disabled,
.afvsp-form-section input[type="email"]:disabled,
.afvsp-form-section input[type="tel"]:disabled,
.afvsp-form-section input[type="date"]:disabled,
.afvsp-form-section input[type="number"]:disabled,
.afvsp-form-section select:disabled,
.afvsp-form-section textarea:disabled {
    background: rgba(167, 139, 250, 0.05);
    color: #7c6fa8;
    cursor: not-allowed;
}

.afvsp-form-section textarea {
    min-height: 100px;
    resize: vertical;
}

.afvsp-form-help {
    font-size: 12px;
    color: #7c6fa8;
    line-height: 1.4;
    margin-top: 4px;
}

/* Repeatable Lists */
.afvsp-repeatable-list {
    margin: 16px 0;
}

.afvsp-repeatable-item {
    background: rgba(167, 139, 250, 0.03);
    border: 1px solid rgba(167, 139, 250, 0.1);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
}

.afvsp-repeatable-actions {
    margin-top: 8px;
}

.afvsp-repeatable-actions .button {
    font-size: 13px;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid rgba(167, 139, 250, 0.2);
    background: white;
    color: #a78bfa;
    cursor: pointer;
    transition: all 0.2s ease;
}

.afvsp-repeatable-actions .button:hover {
    background: rgba(167, 139, 250, 0.05);
    border-color: #a78bfa;
}

/* Dependents Table */
.afvsp-dependents-table {
    display: grid;
    gap: 16px;
    margin-top: 16px;
}

.afvsp-dependent-row {
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.04), rgba(196, 181, 253, 0.02));
    border: 1px solid rgba(167, 139, 250, 0.1);
    border-radius: 12px;
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    position: relative;
}

.afvsp-dependent-row::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(135deg, #a78bfa 0%, #8f73ff 100%);
    border-radius: 12px 12px 0 0;
}

.afvsp-dependent-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.afvsp-dependent-number {
    background: linear-gradient(135deg, #a78bfa 0%, #8f73ff 100%);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.afvsp-dependent-title {
    font-size: 16px;
    font-weight: 700;
    color: #1f1953;
    margin: 0;
}

.afvsp-dependent-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

@media (max-width: 768px) {
    .afvsp-dependent-fields {
        grid-template-columns: 1fr;
    }

    .afvsp-dependent-row {
        padding: 16px;
    }
}

/* Consent Section */
.afvsp-consent-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.afvsp-consent-list label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: 14px;
    color: #4d4975;
    line-height: 1.5;
    font-weight: 400;
}

.afvsp-consent-list input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    cursor: pointer;
    flex-shrink: 0;
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 4px;
    accent-color: #a78bfa;
}

/* Actions */
.afvsp-actions-final,
.afvsp-actions-intermediate {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 30px;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(90, 65, 244, 0.12);
}

.afv-btn-primary {
    background: linear-gradient(135deg, #a78bfa 0%, #8f73ff 100%);
    border: none;
    border-radius: 12px;
    padding: 14px 32px;
    font-size: 15px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(167, 139, 250, 0.25);
    transition: all 0.2s ease;
}

.afv-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(167, 139, 250, 0.35);
}

.afv-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.afv-btn {
    background: white;
    border: 1px solid rgba(167, 139, 250, 0.2);
    border-radius: 12px;
    padding: 14px 32px;
    font-size: 15px;
    font-weight: 600;
    color: #a78bfa;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.afv-btn:hover:not(:disabled) {
    background: rgba(167, 139, 250, 0.05);
    border-color: #a78bfa;
    text-decoration: none;
}

.afv-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.afv-btn.ghost {
    background: transparent;
    border: 1px solid rgba(167, 139, 250, 0.2);
}

.afv-btn.text {
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #a78bfa 0%, #8f73ff 100%);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.afv-sticky-cta-mobile.is-visible {
    transform: translateY(0);
}

.afv-sticky-text {
    font-size: 14px;
    font-weight: 600;
    flex: 1;
}

.afv-sticky-cta-btn {
    background: white;
    color: #a78bfa;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.afv-sticky-cta-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
}

/* Disclaimer Card */
.afv-disclaimer-card {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.05), rgba(245, 158, 11, 0.02));
    border: 1px solid rgba(245, 158, 11, 0.15);
    border-radius: 12px;
    padding: 20px;
    font-size: 13px;
    color: #92400e;
    line-height: 1.6;
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

@media (max-width: 1024px) {
    .afv-portal-hero {
        grid-template-columns: 1fr;
    }

    .afv-portal-hero h2 {
        font-size: 28px;
    }

    .afv-form-wrapper {
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .afv-form-container {
        padding: 1rem 0.5rem;
    }

    .afv-portal-hero {
        padding: 28px;
    }

    .afv-portal-hero h2 {
        font-size: 24px;
    }

    .afvsp-tabs {
        gap: 8px;
        -webkit-overflow-scrolling: touch;
    }

    .afvsp-tab {
        padding: 10px 16px;
        font-size: 13px;
    }

    .afvsp-grid-2,
    .afvsp-grid-3,
    .afvsp-grid-4 {
        grid-template-columns: 1fr;
    }

    .afvsp-form-section {
        padding: 16px;
    }

    .afvsp-actions-final,
    .afvsp-actions-intermediate {
        flex-direction: column;
    }

    .afv-btn-primary,
    .afv-btn {
        width: 100%;
    }

    .afvsp-consent-list label {
        font-size: 13px;
    }

    .afvsp-consent-list input[type="checkbox"] {
        width: 16px;
        height: 16px;
    }

    .afv-sticky-cta-mobile {
        padding: 12px 16px;
    }

    .afv-sticky-text {
        font-size: 13px;
    }

    .afv-sticky-cta-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .afv-portal-hero {
        padding: 20px;
    }

    .afv-portal-hero h2 {
        font-size: 20px;
    }

    .afv-form-wrapper {
        padding: 16px;
        border-radius: 12px;
    }
}

/* ==========================================
   ANIMATIONS E MICRO-INTERAÇÕES
   ========================================== */

.afv-form-section {
    transition: all 0.2s ease;
}

.afv-form-section:hover {
    border-color: rgba(167, 139, 250, 0.15);
    box-shadow: 0 2px 8px rgba(167, 139, 250, 0.08);
}

.afv-btn {
    position: relative;
    overflow: hidden;
}

.afv-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.afv-btn:active::before {
    width: 300px;
    height: 300px;
}

/* Focus states for accessibility */
.afv-btn:focus-visible,
.afvsp-form-section input:focus-visible,
.afvsp-form-section select:focus-visible,
.afvsp-form-section textarea:focus-visible {
    outline: 2px solid #a78bfa;
    outline-offset: 2px;
}

/* Loading states */
.afv-loading {
    position: relative;
    pointer-events: none;
}

.afv-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1rem;
    height: 1rem;
    margin: -0.5rem 0 0 -0.5rem;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: afv-spin 1s linear infinite;
}

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

/* Print styles */
@media print {

    .afv-sticky-cta-mobile,
    .afvsp-actions-final,
    .afvsp-actions-intermediate {
        display: none !important;
    }

    .afv-form-wrapper {
        box-shadow: none;
        border: 1px solid #000;
    }
}
.form-group .required {
    color: #d63638;
    font-weight: 600;
}

.form-group.has-error label {
    color: #b91c1c;
}

.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea,
.afv-field-error {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.2);
}

.afv-field-error-message {
    font-size: 0.875rem;
    color: #b91c1c;
    margin: 4px 0 0;
}

.afv-field-help-text {
    display: block;
    font-size: 0.813rem;
    color: #6b7280;
    margin-top: 4px;
    font-style: italic;
    line-height: 1.4;
}
