/* ============================================
   VCP Message Scheduler - Novo Design de Mensagens
   Design moderno, compacto e focado em UX
   ============================================ */

/* Container principal de mensagens */
.messages-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 16px;
    padding: 0;
    margin: 0;
}

/* Card de mensagem - Novo design compacto */
.message-card-new {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.08);
    border: 1px solid #e8ecf7;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.message-card-new:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.15);
    border-color: #667eea;
}

.message-card-new::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s;
}

.message-card-new:hover::before {
    width: 6px;
}

/* Status indicator */
.message-card-new.status-active::before {
    background: linear-gradient(180deg, #10b981 0%, #059669 100%);
}

.message-card-new.status-paused::before {
    background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
}

.message-card-new.status-completed::before {
    background: linear-gradient(180deg, #6b7280 0%, #4b5563 100%);
}

/* Header do card */
.msg-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 12px;
}

.msg-title-section {
    flex: 1;
    min-width: 0;
}

.msg-title {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 4px 0;
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.4;
}

.msg-title-text {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

.msg-preview {
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin: 0;
}

/* Badge de status */
.msg-status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.msg-status-badge.active {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #047857;
}

.msg-status-badge.paused {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
}

.msg-status-badge.completed {
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
    color: #374151;
}

/* Contador regressivo - Destaque */
.msg-countdown {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    margin: 12px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.msg-countdown-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    opacity: 0.9;
    font-weight: 600;
}

.msg-countdown-time {
    font-size: 18px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
}

.msg-countdown-time.urgent {
    animation: pulse-urgent 2s infinite;
}

@keyframes pulse-urgent {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.msg-countdown.paused {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
}

.msg-countdown.completed {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

/* Grid de informações */
.msg-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 12px 0;
}

.msg-info-item {
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.msg-info-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    font-weight: 600;
    margin-bottom: 2px;
    display: block;
}

.msg-info-value {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 4px;
}

.msg-info-value .emoji {
    font-size: 14px;
}

/* Grupos (destaque especial) */
.msg-groups {
    margin: 12px 0;
    padding: 10px 12px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 6px;
    border: 1px solid #bae6fd;
}

.msg-groups-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #0369a1;
    font-weight: 700;
    margin-bottom: 6px;
    display: block;
}

.msg-groups-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.msg-group-tag {
    background: white;
    color: #0369a1;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #7dd3fc;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Ações do card - Novo layout com ícones (5 botões) */
.msg-actions {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #e2e8f0;
}

.msg-action-btn {
    padding: 10px 8px;
    border: none;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    position: relative;
    overflow: hidden;
}

.msg-action-btn .icon {
    font-size: 18px;
    line-height: 1;
}

.msg-action-btn .label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.2;
}

.msg-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.msg-action-btn:active {
    transform: translateY(0);
}

/* Botão Pausar/Ativar */
.msg-action-btn.toggle {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.msg-action-btn.toggle.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.msg-action-btn.toggle:hover {
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

/* Botão Enviar Agora */
.msg-action-btn.send {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.msg-action-btn.send:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Botão Editar */
.msg-action-btn.edit {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.msg-action-btn.edit:hover {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* Botão Duplicar */
.msg-action-btn.duplicate {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
}

.msg-action-btn.duplicate:hover {
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

/* Botão Ver Detalhes */
.msg-action-btn.details {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: white;
}

.msg-action-btn.details:hover {
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
}

/* Botão Excluir */
.msg-action-btn.delete {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.msg-action-btn.delete:hover {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}


/* Badge de mídia */
.msg-media-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: linear-gradient(135deg, #fdf4ff 0%, #fae8ff 100%);
    border: 1px solid #f0abfc;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    color: #a21caf;
}

/* Responsividade */
@media (max-width: 768px) {
    .messages-list {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .msg-info-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .msg-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .msg-countdown-time {
        font-size: 16px;
    }

    .msg-action-btn .icon {
        font-size: 20px;
    }

    .msg-action-btn .label {
        font-size: 9px;
    }
}

@media (max-width: 480px) {
    .msg-actions {
        grid-template-columns: repeat(2, 1fr);
    }

    .msg-action-btn {
        padding: 12px 6px;
    }
}

/* Loading state */
.message-card-new.loading {
    pointer-events: none;
    opacity: 0.6;
}

.message-card-new.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.5) 50%,
        transparent 100%
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Empty state */
.messages-empty {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.messages-empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.messages-empty-title {
    font-size: 20px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
}

.messages-empty-text {
    font-size: 14px;
    color: #94a3b8;
}

/* ============================================
   Contacts Grid - Modern Design
   ============================================ */

.contacts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 16px;
    padding: 0;
    margin: 0;
}

/* Responsividade para contatos */
@media (max-width: 768px) {
    .contacts-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* Modal de contato */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.modal-overlay .modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px;
    border-bottom: 2px solid #e2e8f0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.btn-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 28px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="tel"],
.form-group input[type="email"],
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
}

.btn-primary {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    padding: 10px 20px;
    background: #64748b;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #475569;
}
