/* ============ CONFIGURAÇÕES (LADO ESQUERDO) ============ */
.config-section {
    flex: 1;
    background: white;
    border-radius: 16px;
    padding: 15px 25px 25px 25px; /* less top padding */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px; /* reduced vertical gap */
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.section-title {
    font-size: 26px;
    color: #2d3748;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-header-left-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-title i {
    color: #667eea;
}

.btn-default {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
}

.btn-default:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.25);
}

/* Seções colapsáveis */
.collapsible-section {
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    transition: all 0.3s ease;
    margin-top: 0; /* ensure no top gap */
}

.section-header-collapsible {
    padding: 14px 20px; /* slightly reduced vertical padding */
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.section-header-collapsible:hover {
    background: #edf2f7;
}

.section-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

.section-info h3 {
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 4px;
}

.section-info p {
    font-size: 13px;
    color: #718096;
    line-height: 1.4;
}

.toggle-arrow {
    color: #a0aec0;
    font-size: 14px;
    transition: transform 0.3s ease;
}

.toggle-arrow.open {
    transform: rotate(180deg);
    color: #667eea;
}

/* Conteúdo da seção (escondido por padrão) */
.section-content {
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.section-content.open {
    padding: 12px 25px 25px 25px; /* less top padding when section opens */
    max-height: 9999px;
}

#profile-section {
    overflow: visible;
}

#profile-content.section-content.open {
    overflow: visible;
}

/* Input boxes */
.input-box {
    margin-bottom: 12px;
}

/* Extra spacing above endereço field (reduced for tighter layout) */
.input-box.address-box {
    margin-top: 8px;
}

/* Reduzir padding-left dos campos da seção Identidade do Perfil */
#profile-content .form-control {
    padding-left: 8px;
}

/* Endereço + número */
.address-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.address-row > .form-control {
    flex: 2;
    min-width: 220px;
}

.street-number-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 160px;
}

.street-number-field {
    display: flex;
    align-items: center;
    gap: 8px;
}

.street-number-field input {
    flex: 1;
}

.sn-checkbox {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #111111;
    cursor: pointer;
}

.sn-checkbox input {
    width: 14px;
    height: 14px;
    accent-color: var(--theme-primary, var(--primary-color, #667eea));
}

/* categorias section */
.perfil-categorias {
    margin-bottom: 20px;
    overflow: visible;
}
.perfil-categorias .categorias-title {
    /* reuse form-label styles plus spacing */
    margin: 0;
    color: #4a5568;
    font-weight: 500;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    display: inline;
    line-height: 1.2;
}

/* preview segments tag styling */
.phone-segments-container {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.segment-tag {
    background: var(--primary-color);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}
.categorias-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    overflow: visible;
}
@media (max-width: 640px) {
    .categorias-grid {
        grid-template-columns: 1fr;
    }
}
.categoria-item label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'Poppins', sans-serif;
}

/* Header button grid for top-right controls */
.header-btn-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 8px;
    justify-content: end;
    align-items: stretch;
}

.header-btn-grid button {
    width: 100%;
    min-width: 0;
    justify-content: center;
    white-space: nowrap;
    font-size: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    height: 44px;
}

.header-btn-grid .btn-danger {
    grid-column: 1 / -1;
}

@media (max-width: 1024px) {
    .header-btn-grid {
        margin-top: 10px;
        width: 100%;
    }
}

@media (max-width: 640px) {
    .header-btn-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        gap: 6px;
    }

    .header-btn-grid button {
        height: 40px;
        padding: 6px 10px;
        font-size: 11px;
        border-radius: 8px;
    }

    .header-btn-grid button i {
        font-size: 11px;
    }

    .header-btn-grid .btn-danger {
        grid-column: 1 / -1;
    }
}

/* make header button icons smaller */
.header-btn-grid button i {
    font-size: 12px;
}

/* Location row - state, neighborhood and city */
.location-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 15px;
}

@media (max-width: 1024px) {
    .location-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .location-row {
        grid-template-columns: 1fr;
    }
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: #4a5568;
    font-weight: 500;
    font-size: 14px;
    text-transform: none; /* respect casing in markup */
}
.form-label strong {
    font-weight: 600;
    text-transform: none;
}

.input-field {
    position: relative;
    width: 100%;
    display: flex;
}

.input-icons {
    display: flex;
    flex-direction: row;
    gap: 8px;
    margin-right: 12px;
    padding-top: 12px;
    align-items: center;
}

.input-icons i {
    color: #a0aec0;
    font-size: 15px;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.emoji-btn {
    color: #a0aec0;
    font-size: 15px;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emoji-btn:hover,
.input-icons i:hover {
    color: var(--primary-color, var(--theme-panel-icon-bg, var(--theme-primary, #667eea)));
    background: color-mix(in srgb, var(--primary-color, var(--theme-panel-icon-bg, var(--theme-primary, #667eea))) 10%, white);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
    flex: 1;
}

/* File upload específico */
.upload-area {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px; /* reduced spacing between cards */
    margin-top: 6px;
}

.upload-box {
    border: 2px dashed var(--theme-panel-icon-bg, #cbd5e0);
    border-radius: 8px;
    padding: 12px 10px; /* smaller padding */
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-box:hover {
    border-color: var(--theme-panel-icon-bg, #667eea);
    background: #edf2f7;
}

.upload-box.has-file {
    border-color: var(--theme-panel-icon-bg, #667eea);
    background: color-mix(in srgb, var(--theme-panel-icon-bg, #667eea) 8%, #f8fafc);
}

.upload-box > i {
    font-size: 18px; /* smaller icon */
    color: var(--theme-panel-icon-bg, #667eea);
    margin-bottom: 6px;
}

.upload-box p {
    color: #4a5568;
    margin-bottom: 4px;
    font-size: 12px; /* smaller title */
    font-weight: 500;
}

.upload-box small {
    color: #a0aec0;
    font-size: 10px; /* smaller secondary text */
}

/* Remove button for upload boxes */
.upload-box .remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: transparent;
    color: var(--theme-panel-icon-bg, #667eea);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 8px; /* extra small x icon */
    /* remove shadow to avoid background look */
    transition: color 0.2s ease, transform 0.1s ease;
}

.upload-box .remove-btn:hover {
    background: transparent;
    filter: brightness(0.9);
}

.upload-box .remove-btn:active {
    transform: scale(0.9);
}

.upload-box {
    position: relative;
}

/* Contador de caracteres */
.char-count {
    text-align: right;
    font-size: 12px;
    color: #a0aec0;
    margin-top: 5px;
}

.char-count.warning {
    color: #e53e3e;
}

/* Botões dentro das seções */
.section-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--theme-panel-icon-bg, #667eea);
    color: var(--theme-panel-icon-color, white);
}

.btn-primary:hover {
    filter: brightness(0.92);
}

.btn-secondary {
    background: #718096;
    color: white;
}

.btn-secondary:hover {
    background: #4a5568;
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover {
    background: #c53030;
}

.btn-outline {
    background: transparent;
    border: 1px solid #cbd5e0;
    color: #4a5568;
}

.btn-outline:hover {
    background: #f8fafc;
    border-color: #a0aec0;
}

/* Estados visuais dos selects de categorias */
select.categoria-select {
    color: #2d3748;
    transition: all 0.3s ease;
}

/* Estado não selecionado (vazio) */
select.categoria-select.empty {
    color: #9e9e9e;
    background: #f5f5f5;
}

/* Opções dentro do dropdown (sempre com cor normal) */
select.categoria-select.empty option {
    color: #000;
}

/* Opção placeholder dentro do dropdown */
select.categoria-select.empty option[value=""] {
    color: #000;
}

/* Label com ícone de ajuda */
.label-with-help {
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}

.label-with-help.label-with-switch {
    justify-content: space-between;
}

/* Ajusta alinhamento quando há input-field abaixo */
.input-box .label-with-help {
    margin-bottom: 8px;
}

/* Label dentro de label-with-help fica inline */
.input-box .label-with-help .form-label,
.input-box .label-with-help label {
    display: inline;
    margin: 0;
    line-height: 1.2;
}

.input-box .label-with-help .smart-switch {
    flex-shrink: 0;
    transform: translateY(-1px);
}

.location-row .input-box {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.location-row .form-label {
    min-height: 26px;
    display: flex;
    align-items: flex-end;
    margin-bottom: 4px;
}

.location-state-box {
    position: relative;
}

.location-state-box .form-label {
    padding-right: 88px;
}

.state-preview-toggle {
    position: absolute;
    top: 0;
    right: 0;
    height: 26px;
    display: flex;
    align-items: flex-end;
}

.help-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--theme-panel-icon-bg, var(--theme-button-bg, var(--theme-bg, var(--primary-color, var(--theme-primary, #667eea)))));
    font-size: 16px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    min-width: 24px;
    height: 24px;
    line-height: 1;
    flex-shrink: 0;
}

.help-icon:hover {
    filter: brightness(0.9);
    transform: scale(1.15);
}

.help-icon:active {
    transform: scale(0.95);
}

/* Tooltip de ajuda */
.help-tooltip {
    position: fixed;
    background: white;
    border: 2px solid var(--primary-color, var(--theme-panel-icon-bg, var(--theme-primary, #667eea)));
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 13px;
    color: #2d3748;
    max-width: 250px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
    z-index: 13000;
    animation: tooltipSlideIn 0.2s ease-out;
}

@keyframes tooltipSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Estado selecionado (preenchido) */
select.categoria-select.filled {
    color: #000;
    background: white;
}

.categoria-item--autocomplete {
    position: relative;
    overflow: visible;
}

.categoria-item--autocomplete select.categoria-select {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.category-autocomplete {
    position: relative;
    overflow: visible;
}

.category-autocomplete-input {
    padding-right: 48px !important;
}

.category-autocomplete-input.empty {
    color: #9e9e9e;
    background: #f5f5f5;
}

.category-autocomplete-input.filled {
    color: #000;
    background: #ffffff;
}

.category-autocomplete-toggle {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #1f2937;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 3;
}

.category-autocomplete-menu {
    z-index: 1300;
    max-height: min(360px, 52vh);
}

.category-autocomplete.opens-up .category-autocomplete-menu {
    top: auto;
    bottom: calc(100% + 8px);
}
