/* ============================================
   COFECI Design System (CFX)
   by Fábio Dias
   ============================================ */

/* ===========================================
   0. VARIÁVEIS (Design Tokens)
   =========================================== */
:root {
    /* Primary */
    --cfx-primary: #003D6B;
    --cfx-primary-light: #005491;
    --cfx-primary-hover: #004273;

    /* Semantic */
    --cfx-error: #BA1A1A;

    /* Neutrals */
    --cfx-background: #f8f9ff;
    --cfx-surface: #ffffff;
    --cfx-surface-variant: #dee3eb;
    --cfx-outline: #727781;
    --cfx-outline-variant: #c1c7d1;
    --cfx-text-primary: #171c22;
    --cfx-text-secondary: #414750;

    /* Spacing & Borders */
    --cfx-radius-sm: 4px;
    --cfx-radius-md: 8px;
    --cfx-radius-lg: 12px;
    --cfx-transition: all 0.2s ease;
}


/* ===========================================
   1. BOTÕES
   =========================================== */

/* --- Base --- */
.cfx-btn {
    padding: 12px 24px;
    border-radius: var(--cfx-radius-md);
    font-family: "Public Sans", sans-serif;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: var(--cfx-transition);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    line-height: 1.5;
}

/* --- Primary (azul) --- */
.cfx-btn-primary {
    background-color: var(--cfx-primary-light);
    color: #ffffff;
}

.cfx-btn:hover,
.cfx-btn:focus {
    text-decoration: none;
}

.cfx-btn-primary:hover,
.cfx-btn-primary:focus {
    background-color: var(--cfx-primary-hover);
    color: #ffffff;
}

/* --- Secondary (outlined) --- */
.cfx-btn-secondary {
    background: transparent;
    border: 1px solid var(--cfx-outline-variant);
    color: var(--cfx-primary-light);
}

.cfx-btn-secondary:hover,
.cfx-btn-secondary:focus {
    background-color: var(--cfx-background);
    color: var(--cfx-primary-light);
}

/* --- Disabled --- */
.cfx-btn:disabled,
.cfx-btn.cfx-btn-disabled {
    background-color: var(--cfx-surface-variant);
    color: var(--cfx-outline);
    cursor: not-allowed;
    opacity: 0.6;
    border: none;
}

.cfx-btn:disabled:hover,
.cfx-btn.cfx-btn-disabled:hover {
    background-color: var(--cfx-surface-variant);
    color: var(--cfx-outline);
}

/* --- Loading state --- */
.cfx-btn.is-loading {
    opacity: 0.7;
    pointer-events: none;
}

.cfx-btn .btn-loading-text {
    display: none;
}

.cfx-btn.is-loading .btn-default-text {
    display: none;
}

.cfx-btn.is-loading .btn-loading-text {
    display: inline-block;
}

.cfx-btn .bi-arrow-repeat {
    display: inline-block;
    animation: cfx-spin 1s linear infinite;
}

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

/* ===========================================
   2. FORMULÁRIOS
   =========================================== */

/* --- Campo container --- */
.cfx-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
}

/* --- Label --- */
.cfx-field label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--cfx-text-secondary);
    transition: var(--cfx-transition);
}

/* --- Input & Select (Default) --- */
.cfx-input,
.cfx-select {
    width: 100%;
    padding: 12px 16px;
    background-color: #f1f4f9;
    border: none;
    border-bottom: 2px solid var(--cfx-outline-variant);
    font-family: inherit;
    font-size: 14px;
    color: var(--cfx-text-primary);
    transition: var(--cfx-transition);
}

/* --- Disabled --- */
.cfx-input:disabled,
.cfx-select:disabled {
    background-color: var(--cfx-surface-variant);
    color: var(--cfx-outline);
    cursor: not-allowed;
    opacity: 0.7;
    border-bottom-color: transparent;
}

/* --- Active (focus) --- */
.cfx-input:focus,
.cfx-select:focus {
    outline: none;
    border-bottom-color: var(--cfx-primary-light);
    background-color: #ebf1f8;
}

.cfx-field:focus-within label {
    color: var(--cfx-primary-light);
}

/* --- Error state --- */
.cfx-field.cfx-field-error label {
    color: var(--cfx-error);
}

.cfx-field.cfx-field-error .cfx-input,
.cfx-field.cfx-field-error .cfx-select {
    background-color: rgba(186, 26, 26, 0.05);
    border-bottom-color: var(--cfx-error);
}

/* --- Ícone de erro (só aparece no estado error) --- */
.cfx-field .cfx-error-icon {
    display: none;
    position: absolute;
    right: 12px;
    top: 38px;
    color: var(--cfx-error);
    font-size: 20px;
}

.cfx-field.cfx-field-error .cfx-error-icon {
    display: block;
}

/* --- Mensagem de erro do validator --- */
.cfx-field .cfx-field-msg {
    font-size: 11px;
    color: var(--cfx-error);
    font-weight: 600;
}


/* ===========================================
   3. CHECKBOX
   =========================================== */

.cfx-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--cfx-text-primary);
    cursor: pointer;
}

.cfx-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--cfx-primary-light);
    margin: 0;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.cfx-checkbox input[type="checkbox"]:checked {
    animation: cfx-check-pop 0.3s ease;
}

@keyframes cfx-check-pop {
    0% { transform: scale(1); }
    40% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.cfx-checkbox label {
    font-size: 14px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
    color: var(--cfx-text-primary);
    cursor: pointer;
    margin: 0;
}


/* ===========================================
   3.1. RADIO BUTTON
   =========================================== */

.cfx-radio {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--cfx-text-primary);
    cursor: pointer;
}

.cfx-radio input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--cfx-primary-light);
    margin: 0;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.cfx-radio input[type="radio"]:checked {
    animation: cfx-check-pop 0.3s ease;
}

.cfx-radio label {
    font-size: 14px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
    color: var(--cfx-text-primary);
    cursor: pointer;
    margin: 0;
}

/* --- Radio group (vertical) --- */
.cfx-radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* --- Radio group (horizontal) --- */
.cfx-radio-group-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
}

/* ===========================================
   4. BANNERS (Status Feedback)
   =========================================== */

/* --- Base --- */
.cfx-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-radius: var(--cfx-radius-md);
    border-left: 4px solid transparent;
    background: var(--cfx-surface);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    animation: cfx-slideIn 0.3s ease-out;
    margin-bottom: 16px;
}

.cfx-banner-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cfx-banner-icon {
    font-size: 24px;
}

.cfx-banner-title {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 2px;
}

.cfx-banner-text {
    font-size: 13px;
    color: var(--cfx-text-secondary);
}

.cfx-banner-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--cfx-outline);
    padding: 4px;
    font-size: 20px;
    transition: var(--cfx-transition);
}

.cfx-banner-close:hover {
    color: var(--cfx-text-primary);
}

/* --- Success (verde) --- */
.cfx-banner-success {
    border-left-color: #006E27;
}

.cfx-banner-success .cfx-banner-icon {
    color: #006E27;
}

/* --- Warning (dourado) --- */
.cfx-banner-warning {
    border-left-color: var(--cfx-primary-light);
}

.cfx-banner-warning .cfx-banner-icon {
    color: var(--cfx-primary-light);
}

/* --- Danger (vermelho) --- */
.cfx-banner-danger {
    border-left-color: var(--cfx-error);
    background-color: #ffdad6;
}

.cfx-banner-danger .cfx-banner-icon {
    color: var(--cfx-error);
}

.cfx-banner-danger .cfx-banner-title,
.cfx-banner-danger .cfx-banner-text {
    color: #93000a;
}

/* --- Info (azul) --- */
.cfx-banner-info {
    border-left-color: var(--cfx-primary-light);
    background-color: #e8edf9;
}

.cfx-banner-info .cfx-banner-icon {
    color: var(--cfx-primary-light);
}

/* ===========================================
   5. CARD (Container de formulário)
   =========================================== */

.cfx-card {
    background-color: var(--cfx-surface);
    border-radius: var(--cfx-radius-lg);
    box-shadow: 0 1px 3px rgba(23, 28, 34, 0.05);
    padding: 40px;
}


/* ===========================================
   6. INFO CARD (Painel informativo)
   =========================================== */

.cfx-info-card {
    background-color: #f0f4fd;
    border-radius: var(--cfx-radius-lg);
    padding: 32px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.cfx-info-card-body {
    display: flex;
    gap: 20px;
    position: relative;
    z-index: 1;
}

.cfx-info-card-icon {
    flex-shrink: 0;
    font-size: 28px;
    color: var(--cfx-primary);
}

.cfx-info-card-title {
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--cfx-primary);
    margin-bottom: 12px;
}

.cfx-info-card-content {
    color: var(--cfx-text-secondary);
    font-size: 14px;
    line-height: 1.7;
    text-align: justify;
}


/* ===========================================
   7. SELECTION CARD (Cards de seleção)
   =========================================== */

/* --- Título da seleção --- */
.cfx-selection-title {
    font-size: 2.5rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    color: var(--cfx-text-primary);
    margin-bottom: 16px;
}

.cfx-selection-subtitle {
    font-size: 1.125rem;
    color: var(--cfx-text-secondary);
    max-width: 600px;
    margin: 0 auto 48px auto;
    line-height: 1.6;
}

/* --- Card --- */
.cfx-selection-card {
    background-color: var(--cfx-surface);
    border: 1px solid var(--cfx-outline-variant);
    border-radius: 24px;
    padding: 24px;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: flex-start;
    gap: 20px;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
}

.cfx-selection-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.1);
    border-color: transparent;
    text-decoration: none;
    color: inherit;
}

/* --- Barra lateral colorida --- */
.cfx-selection-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 6px;
    height: 100%;
    transition: width 0.3s ease, opacity 0.3s ease;
}

.cfx-selection-card-pf::before {
    background-color: var(--cfx-primary);
}

.cfx-selection-card-pj::before {
    background-color: #006E27;
}

.cfx-selection-card:hover::before {
    width: 100%;
    opacity: 0.05;
}

/* --- Ícone --- */
.cfx-selection-card-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--cfx-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 2rem;
}

.cfx-selection-card-pf .cfx-selection-card-icon {
    background-color: #e0f2fe;
    color: var(--cfx-primary);
}

.cfx-selection-card-pj .cfx-selection-card-icon {
    background-color: #dcfce7;
    color: #006E27;
}


/* --- Conteúdo --- */
.cfx-selection-card-content {
    flex: 1;
}

.cfx-selection-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.cfx-selection-card-pf .cfx-selection-card-title {
    color: var(--cfx-primary);
}

.cfx-selection-card-pj .cfx-selection-card-title {
    color: #006E27;
}

.cfx-selection-card-desc {
    font-size: 0.875rem;
    color: var(--cfx-text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}

/* --- Footer (link) --- */
.cfx-selection-card-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    font-weight: 700;
    transition: gap 0.2s;
}

.cfx-selection-card-pf .cfx-selection-card-footer {
    color: var(--cfx-primary);
}

.cfx-selection-card-pj .cfx-selection-card-footer {
    color: #006E27;
}

.cfx-selection-card:hover .cfx-selection-card-footer {
    gap: 12px;
}

/* --- Responsivo --- */
@media (max-width: 576px) {
    .cfx-selection-title {
        font-size: 1.75rem;
    }

    .cfx-selection-subtitle {
        font-size: 1rem;
        margin-bottom: 32px;
    }

    .cfx-selection-card {
        padding: 20px;
    }
}


/* ===========================================
   8. PAGE HEADER (Título da página)
   =========================================== */

.cfx-page-header {
    position: relative;
    padding-left: 20px;
    margin-bottom: 40px;
}

.cfx-page-header::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: var(--cfx-primary);
    border-radius: 4px;
}

.cfx-page-header-title {
    font-family: "Public Sans", sans-serif;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--cfx-text-primary);
    margin: 0;
    line-height: 1.2;
}

.cfx-page-header-subtitle {
    font-size: 1.1rem;
    color: var(--cfx-text-secondary);
    margin: 4px 0 0 0;
}

@media (max-width: 576px) {
    .cfx-page-header-title {
        font-size: 1.5rem;
    }

    .cfx-page-header-subtitle {
        font-size: 1rem;
    }
}


@keyframes cfx-slideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ===========================================
   9. UTILITÁRIOS
   =========================================== */

/* --- Banner variantes de layout --- */
.cfx-banner-block {
    display: block;
}

.cfx-banner-content-top {
    align-items: flex-start;
}


/* --- Responsivo --- */
@media (max-width: 576px) {
    .cfx-btn {
        width: 100%;
        margin-bottom: 8px;
    }
}
