:root {
    --primary: #25D366;
    --dark: #075E54;
    --light: #f0f2f5;
    --danger: #dc3545;
    --warning: #ffc107;
    --text: #333;
    --blue: #007bff;
}

* { box-sizing: border-box; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; -webkit-tap-highlight-color: transparent; }

body { margin: 0; background-color: var(--light); color: var(--text); display: flex; flex-direction: column; min-height: 100vh; }

.container { max-width: 1000px; margin: 0 auto; padding: 20px; width: 100%; flex: 1; }

/* --- TOAST NOTIFICATIONS --- */
#toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 9999;
    display: flex; flex-direction: column; gap: 10px;
    pointer-events: none; /* Permite clicar através da área vazia */
}
.toast {
    min-width: 280px; padding: 15px 20px; border-radius: 8px; color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); display: flex; align-items: center; gap: 12px;
    font-size: 14px; font-weight: 500; opacity: 0; animation: slideIn 0.3s ease-out forwards;
    pointer-events: auto;
}
.toast.success { background-color: var(--primary); border-left: 6px solid var(--dark); }
.toast.error { background-color: var(--danger); border-left: 6px solid #b02a37; }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { to { transform: translateX(100%); opacity: 0; } }

/* Tabs */
.tabs { display: flex; margin-bottom: 20px; background: white; padding: 5px; border-radius: 10px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); overflow-x: auto; }
.tab-btn {
    flex: 1; padding: 15px; border: none; background: none; cursor: pointer;
    font-size: 16px; font-weight: bold; color: #666; border-bottom: 3px solid transparent; transition: 0.3s;
    white-space: nowrap;
}
.tab-btn.active { color: var(--dark); border-bottom-color: var(--primary); background-color: #f0fcf4; border-radius: 5px; }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.5s; }

/* Cards & Forms */
.card { background: white; padding: 20px; border-radius: 10px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); margin-bottom: 20px; }
.form-group { display: flex; gap: 10px; margin-bottom: 15px; align-items: flex-end; }
.input-wrapper { flex: 1; width: 100%; } /* Width 100% garante ajuste no mobile */
label { display: block; margin-bottom: 5px; font-size: 14px; color: #666; font-weight: 500; }
input { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 8px; outline: none; font-size: 16px; }
input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.2); }

/* Buttons */
.btn { padding: 12px 20px; border: none; border-radius: 8px; cursor: pointer; font-weight: bold; color: white; transition: 0.2s; display: inline-flex; align-items: center; justify-content: center; gap: 5px; font-size: 14px; }
.btn-primary { background-color: var(--primary); }
.btn-primary:hover { background-color: var(--dark); }
.btn-danger { background-color: var(--danger); }
.btn-warning { background-color: var(--warning); color: #333; }
.btn-dark { background-color: var(--dark); color: white; }
.btn-blue { background-color: var(--blue); color: white; }
.btn-secondary { background-color: #6c757d; color: white; }
.btn-sm { padding: 8px 12px; font-size: 13px; }

/* Variable & Emoji Buttons */
.label-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.tools-area { display: flex; gap: 5px; }

.btn-tool {
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    color: #495057;
    padding: 6px 12px; /* Botões um pouco maiores para toque */
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}
.btn-tool:hover { background-color: #dde2e6; border-color: #adb5bd; color: var(--primary); }

/* Emoji Picker Container */
.emoji-picker {
    display: none;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    grid-template-columns: repeat(8, 1fr);
    gap: 5px;
    max-height: 150px;
    overflow-y: auto;
}
.emoji-picker.active { display: grid; }
.emoji-item {
    font-size: 20px;
    cursor: pointer;
    text-align: center;
    padding: 5px;
    border-radius: 4px;
}

/* List Items */
.list-container { display: flex; flex-direction: column; gap: 10px; }
.list-header { display: flex; align-items: center; margin-bottom: 10px; padding: 0 15px; }

.list-item { 
    background: white; padding: 15px; border-radius: 8px; border-left: 5px solid var(--primary);
    display: flex; align-items: center; box-shadow: 0 2px 4px rgba(0,0,0,0.05); gap: 15px;
}

.item-checkbox-area { display: flex; align-items: center; justify-content: center; width: 30px; flex-shrink: 0; }
.contact-checkbox, #selectAll { transform: scale(1.5); cursor: pointer; margin: 0; }

.item-info { flex-grow: 1; text-align: left; min-width: 0; }
.item-info h4 { margin: 0 0 5px 0; font-size: 16px; color: var(--text); }
.item-info p { margin: 0; color: #666; font-size: 13px; }

/* Message Preview */
.message-preview {
    background-color: #f8f9fa;
    border-left: 3px solid #ccc;
    padding: 8px 12px;
    margin: 8px 0;
    font-size: 14px;
    color: #444;
    font-style: italic;
    border-radius: 0 4px 4px 0;
    white-space: pre-wrap;
}

.item-actions { display: flex; gap: 5px; flex-shrink: 0; }

/* Modais */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; justify-content: center; align-items: center; padding: 20px; }
.modal.active { display: flex; }
/* Modal responsivo: Width 90% no mobile, max-width 400px no desktop */
.modal-content { background: white; padding: 25px; border-radius: 15px; width: 90%; max-width: 400px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); box-sizing: border-box; }
.modal-header { display: flex; justify-content: space-between; margin-bottom: 15px; align-items: center; }
.close-modal { cursor: pointer; font-size: 24px; color: #999; padding: 5px; }

textarea { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 8px; resize: vertical; min-height: 100px; font-family: inherit; font-size: 14px; outline: none; box-sizing: border-box;}
textarea:focus { border-color: var(--primary); }

.badge { background: #eee; padding: 3px 8px; border-radius: 12px; font-size: 12px; color: #555; margin-right: 5px; display: inline-block; }

.confirm-content { text-align: center; max-width: 350px; }
.confirm-icon { font-size: 3rem; color: var(--warning); margin-bottom: 15px; }
.confirm-actions { display: flex; justify-content: center; gap: 10px; margin-top: 20px; }
.confirm-actions .btn { flex: 1; }

footer { text-align: center; padding: 20px; background-color: white; border-top: 1px solid #eee; font-size: 14px; color: #666; margin-top: auto; }
footer a { color: var(--dark); text-decoration: none; font-weight: bold; }

/* --- RESPONSIVIDADE MOBILE --- */
@media (max-width: 600px) {
    .container { padding: 15px; }
    
    /* Inputs ocupam 100% da linha */
    .form-group { flex-direction: column; gap: 15px; }
    .input-wrapper, input { width: 100%; }
    
    /* Botão de cadastrar full width */
    .form-group .btn { width: 100%; padding: 14px; font-size: 16px; }

    /* Lista empilhada no mobile */
    .list-item { flex-wrap: wrap; }
    .item-checkbox-area { width: auto; margin-right: 10px; }
    .item-info { width: calc(100% - 50px); } /* Texto ocupa o resto do topo */
    
    /* Botões de ação ocupam largura total abaixo */
    .item-actions { 
        width: 100%; 
        justify-content: space-between; 
        margin-top: 15px; 
        border-top: 1px solid #eee; 
        padding-top: 10px; 
    }
    .item-actions .btn { flex: 1; padding: 12px; } /* Botões maiores para toque */

    /* Ações em massa empilhadas */
    .card-mass-action { flex-direction: column; gap: 10px; }
    .card-mass-action .btn { width: 100%; padding: 12px; }
    
    /* Emoji picker ajustado */
    .emoji-picker { grid-template-columns: repeat(6, 1fr); }
    
    /* Garantir que o modal não "estoure" a tela */
    .modal-content { padding: 20px; width: 95%; }
}
