/* =========================================
   1. CONTAINER & GRID (LAYOUT AVANÇADO)
   ========================================= */
#configs-container {
    width: 100%;
    padding-bottom: 3rem;
}

.configs-grid {
    display: grid;
    grid-template-columns: 1fr; /* Mobile: 1 coluna */
    
    /* Mapa de Ordenação Mobile (Conta > Telegram > Status) */
    grid-template-areas: 
        "account"
        "telegram"
        "status";
        
    gap: 1.5rem;
}

/* Conexão das Classes com as Áreas do Mapa */
.account-section  { grid-area: account; }
.telegram-section { grid-area: telegram; }
.status-section   { grid-area: status; }

/* DESKTOP: Layout Mapeado (A partir de 900px) */
@media (min-width: 900px) {
    .configs-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-areas: 
            "account telegram"
            "status telegram";
        align-items: stretch; 
    }
}

/* =========================================
   2. CARD BASE (ESTILO GERAL)
   ========================================= */
.config-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    
    /* Flexbox vertical para organizar conteúdo */
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    
    /* Crucial: Faz o card ocupar 100% da célula do grid (Estica o Telegram) */
    height: 100%; 
    
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    transition: transform 0.2s ease, border-color 0.2s;
}

.config-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

/* Cabeçalhos dos Cards */
.config-card .card-header {
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 1rem;
    margin-bottom: -0.5rem;
    flex-shrink: 0; /* Impede que o cabeçalho encolha */
}

.card-header.row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h3 i { color: var(--brand-neon); }


/* =========================================
   3. SEÇÃO: DADOS DA CONTA (FORMS)
   ========================================= */
#account-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    flex: 1; /* Ocupa o espaço disponível */
}


.config-input {
    width: 100%;
    background-color: #09090b;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px 12px 12px 42px; /* Espaço p/ ícone */
    color: var(--text-primary);
    outline: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.config-input.loading {
    background: linear-gradient(90deg, #141416 25%, #1e1e22 50%, #141416 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite linear;
    color: transparent;
    pointer-events: none;
}

.config-input:focus {
    border-color: var(--brand-neon);
    background-color: #0f0f11;
    box-shadow: 0 0 0 2px rgba(0, 224, 131, 0.1);
}

.form-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: auto; /* Empurra botões para o fundo se sobrar espaço */
    padding-top: 0.5rem;
}

/* Botão Salvar (Neon) */
.btn-save-primary {
    background-color: var(--brand-neon);
    color: #000;
    font-weight: 700;
    padding: 12px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-save-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 224, 131, 0.25);
    background-color: var(--brand-neon-hover);
}

/* Botão Link (Alterar Senha) */
.btn-text-action {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-text-action:hover {
    color: var(--text-primary);
    text-decoration: underline;
}


/* =========================================
   4. SEÇÃO: TELEGRAM (LISTA)
   ========================================= */
.btn-add-mini {
    background-color: rgba(0, 224, 131, 0.1);
    color: var(--brand-neon);
    border: 1px solid rgba(0, 224, 131, 0.2);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: 0.2s;
}

.btn-add-mini:hover { 
    background-color: rgba(0, 224, 131, 0.2); 
    border-color: var(--brand-neon);
}

.telegram-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1; /* Permite que a lista ocupe espaço extra verticalmente */
}

.telegram-item {
    background-color: #0A0A0A; 
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: border-color 0.2s;
}

.telegram-item:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

/* Avatar com Iniciais */
.tg-avatar {
    width: 38px;
    height: 38px;
    background-color: #1a1a1a;
    color: var(--text-secondary);
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.85rem;
    font-weight: 700;
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.tg-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.tg-info strong { font-size: 0.9rem; color: var(--text-primary); text-transform: capitalize; }
.tg-info span { font-size: 0.75rem; color: var(--text-secondary); }

.tg-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Switch Mini */
.switch-mini {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
}

.switch-mini input { opacity: 0; width: 0; height: 0; }

.switch-mini .slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #333;
    transition: .3s;
    border-radius: 34px;
}

.switch-mini .slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

.switch-mini input:checked + .slider { background-color: var(--brand-neon); }
.switch-mini input:checked + .slider:before { transform: translateX(14px); }

/* Botões de Ícone */
.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon.edit:hover { color: #FFC107; background-color: rgba(255, 193, 7, 0.1); }
.btn-icon.delete:hover { color: var(--status-danger); background-color: rgba(221, 0, 0, 0.1); }

.card-footer-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: auto; /* Garante que fique no rodapé do card grandão */
    padding-top: 1rem;
}


/* =========================================
   5. SEÇÃO: STATUS DO SISTEMA
   ========================================= */
.status-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.status-row:last-child { border-bottom: none; padding-bottom: 0; }
.status-label { font-size: 0.9rem; color: var(--text-secondary); }

#configs-container .status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 100px;
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

#configs-container .status-badge.online {
    background-color: rgba(0, 224, 131, 0.1);
    color: var(--brand-neon);
}

.dot {
    width: 6px;
    height: 6px;
    background-color: currentColor;
    border-radius: 50%;
    box-shadow: 0 0 8px currentColor;
    animation: pulseStatus 2s infinite;
}

@keyframes pulseStatus {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

.status-value { font-weight: 600; font-size: 0.9rem; }
.status-value.mono { 
    font-family: monospace; 
    color: var(--text-muted); 
    background: #111; 
    padding: 2px 6px; 
    border-radius: 4px;
    font-size: 0.8rem;
}

/* =========================================
   6. MODAIS (SIMPLES E DIRETO)
   ========================================= */
.fipefy-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.fipefy-modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden; 
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    transform: translateY(0);
    transition: transform 0.2s ease;
}

.fipefy-modal.hidden .modal-content {
    transform: translateY(20px);
}


.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-close-modal:hover { color: var(--status-danger); }

.fipefy-modal .modal-body { padding: 1.5rem; }

/* .modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    background-color: transparent;
} */

/* 👇 Correção: Estilo do botão Cancelar que estava faltando */
.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
}

.btn-secondary:hover { 
    background: rgba(255,255,255,0.05); 
    color: white; 
}

/* 👇 Correção: Remove o espaço vazio da esquerda nos inputs do modal de senha */
#modal-senha .config-input {
    padding-left: 14px;
}

/* O olhinho da senha */
.password-wrapper { 
    position: relative; 
    display: flex; 
    align-items: center; 
}

.password-wrapper .config-input { 
    padding-right: 40px; 
    width: 100%; 
}

.toggle-password {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    transition: 0.2s;
}

.toggle-password:hover { color: var(--brand-neon); }

/* Correção para o ícone do Modal de Telegram (mantido direto e simples) */
.fipefy-modal .input-wrapper > i:first-child {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 1.1rem;
    z-index: 1;
}

/* =========================================
   7. AJUSTES GERAIS (UTILITÁRIOS)
   ========================================= */
/* Remove as setas (spinners) dos inputs do tipo number */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield; /* Correção para o Firefox */
}

/* =========================================
   8. CORREÇÃO DE ÍCONES (MODAL TELEGRAM)
   ========================================= */
#modal-telegram .input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

#modal-telegram .input-wrapper > i:first-child {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 1.1rem;
    z-index: 1;
}

#modal-telegram .config-input {
    padding-left: 40px; /* Abre espaço na esquerda para o texto não atropelar o ícone */
    width: 100%;
}

.input-hint {
    font-size: 12px;
    margin-top: 8px;
    display: block;
}

/* Modal de Pagamento */
#modal-pagamento .modal-content    { text-align: center; padding-bottom: 2rem; }
#modal-pagamento .modal-body       { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
#modal-pagamento .modal-body > p   { color: var(--text-secondary); font-size: 0.9rem; }
#modal-pagamento .input-group      { width: 100%; text-align: left; }
#modal-pix-valor                   { color: var(--brand-neon); font-size: 2rem; margin: 0.5rem 0; }
#modal-qr-wrapper                  { background: white; padding: 10px; border-radius: 8px; display: inline-block; }
#modal-pix-copy-area .input-wrapper { display: flex; gap: 8px; }
#pix-key-input                     { flex: 1; padding-left: 12px; text-align: center; }
#modal-pix-copy-area .btn-save-primary { padding: 0 16px; }
#btn-modal-logout {
    margin-top: 1.5rem;
    background: transparent;
    border: none;
    color: var(--status-danger);
    font-weight: 600;
    cursor: pointer;
    display: none;
}