/* --- PERMISSÕES UI PREMIUM (Card Style) --- */

/* Container dos Cards */
#modulos-permissoes-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Card Individual do Módulo */
.permission-card {
    background: #ffffff;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    transition: all 0.2s ease;
    overflow: hidden;
}

.permission-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    border-color: #d1d5db;
}

/* Cabeçalho do Card (Toggle Principal) */
.permission-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.permission-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.permission-icon {
    font-size: 1.4em;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 50%;
    border: 1px solid #eee;
    color: #2c3e50;
}

.permission-title h4 {
    margin: 0;
    font-size: 1.05em;
    color: #2c3e50;
    font-weight: 600;
}

.permission-title p {
    margin: 3px 0 0 0;
    font-size: 0.85em;
    color: #7f8c8d;
}

/* Toggle Switch (Estilo iOS) */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #e74c3c; /* Vermelho para desativado/remover ou Verde para ativar? Imagem mostra toggle vermelho para módulo habilitado (talvez seja o botão remover). Vamos usar Verde para Ligado. */
}
/* Analisando a imagem: O toggle é vermelho com ícone de remover '-' quando está expandido? Não. 
   Na imagem 2, "Gestão de Lotes" tem um botão vermelho quadrado com '-' (menos). Parece ser "Desabilitar Módulo".
   E na direita diz "Habilitar Módulo" (texto azul).
   Vamos replicar o visual exato da imagem: 
   - Se habilitado: Mostra conteúdo E botão vermelho "-" à direita.
   - Se desabilitado: Mostra apenas título e texto "Habilitar Módulo" azul à direita (ou toggle off).
   Vou usar Toggle Switch padrão para "Habilitar/Desabilitar" que é mais intuitivo que a imagem, mas se o usuário quer "aquele modelo", vou tentar aproximar.
   Na imagem: "Habilitar Módulo" é um texto clicável que vira um botão de remover?
   Vamos simplificar para Toggle Switch que é funcional e elegante.
*/

input:checked + .slider {
    background-color: #2ecc71; /* Verde Sucesso */
}

input:focus + .slider {
    box-shadow: 0 0 1px #2ecc71;
}

input:checked + .slider:before {
    transform: translateX(22px);
}

/* Ações Granulares (Botões internos) */
.permission-actions {
    padding: 15px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    background: #fff;
    opacity: 0.5; /* Desabilitado visualmente se modullo off */
    pointer-events: none;
    transition: opacity 0.3s;
}

.permission-card.active .permission-actions {
    opacity: 1;
    pointer-events: all;
}

/* Botão de Ação Checkbox Style */
.action-check-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    background: #fdfdfd;
}

.action-check-label:hover {
    background: #f8f9fa;
    border-color: #d0d0d0;
}

/* O input checkbox real (hidden) */
.action-check-input {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    flex-shrink: 0;
}

.action-check-input:checked {
    background-color: #e74c3c; /* Vermelho da marca nas imagens */
    border-color: #e74c3c;
}

.action-check-input:checked::after {
    content: '✓';
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.action-text {
    font-size: 0.9em;
    color: #444;
    font-weight: 500;
}

/* Acesso a Empreendimentos (Lista Estilo iOS) */
.loteamento-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.loteamento-item:last-child {
    border-bottom: none;
}

.loteamento-item:hover {
    background: #fafafa;
}

.loteamento-name {
    font-size: 0.95em;
    font-weight: 500;
    color: #2c3e50;
    text-transform: uppercase;
}

/* Botão Selecionar Todos no Empreendimentos */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.select-all-btn {
    font-size: 0.8em;
    color: #3498db;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
}
.select-all-btn:hover { text-decoration: underline; }
