@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius-lg: 16px;
  --radius-md: 12px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
}

/* LAYOUT */
.view-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px;
  display: none;
}

#view-reminders.view-container {
  max-width: 1700px;
}

.view-active {
  display: flex;
  flex-direction: column;
  align-items: flex-start; /* Alinhado à esquerda como solicitado */
}

/* HEADER STYLE */
.page-header {
  display: flex;
  flex-direction: column; /* Força empilhamento em telas menores ou por padrão */
  width: 100%;
  margin-bottom: 32px;
  gap: 20px;
}

@media (min-width: 768px) {
  .page-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }
}

.page-title h1 {
  font-size: 1.875rem;
  font-weight: 800;
  color: #111827;
  letter-spacing: -0.025em;
}

.page-title p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 4px;
}

/* SEARCH & FILTERS */
.search-container {
  position: relative;
  width: 100%;
  max-width: 400px;
}

.search-input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  color: var(--text-main);
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* CARDS */
.bz-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

/* APP GRID (Store) */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
  margin-top: 24px;
  width: 100%;
}

.app-item {
  text-decoration: none;
  color: inherit;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.app-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.app-icon-wrapper {
  width: 64px;
  height: 64px;
  background: #f1f5f9;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.app-icon-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.app-content h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.app-content p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.app-meta {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 9999px;
  white-space: nowrap;
}

.badge-blue { background: #eff6ff; color: #3b82f6; }
.badge-green { background: #ecfdf5; color: #10b981; }
.badge-purple { background: #f5f3ff; color: #7c3aed; }

/* DASHBOARD & TABLES */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  width: 100%;
  align-items: start;
}

@media (min-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 260px 1fr;
  }
}

.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.table-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: #f8fafc;
  padding: 12px 14px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 14px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

.contact-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 40px;
  height: 40px;
  background: #e2e8f0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #475569;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
}

.avatar::after {
  content: "👁️";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  color: #fff;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.avatar:hover::after {
  opacity: 1;
}

.contact-info .name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-info .name.date-cell {
  white-space: normal;
  line-height: 1.3;
}

.contact-info .phone {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-outline {
  background: white;
  border-color: var(--border);
  color: var(--text-main);
}

.btn-outline:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

/* DAY SELECTOR */
.day-btn {
  width: 38px !important;
  height: 38px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  font-size: 0.85rem !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  user-select: none;
}

.day-btn.active {
  background: var(--primary) !important;
  color: white !important;
  border-color: var(--primary) !important;
  box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3), 0 2px 4px -2px rgba(99, 102, 241, 0.3);
  transform: translateY(-1px) scale(1.05);
}

.day-btn.active:hover {
  background: var(--primary-hover) !important;
  border-color: var(--primary-hover) !important;
}

/* PILLS */
.pill {
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pill-success { background: #dcfce7; color: #15803d; }
.pill-info { background: #dbeafe; color: #1d4ed8; }
.pill-warning { background: #fef3c7; color: #b45309; }
.pill-danger { background: #fee2e2; color: #b91c1c; }

/* RECURRENCE BLOCKS */
.freq-block {
  display: none;
}

.freq-block.active {
  display: block !important;
}

/* FORM ELEMENTS */
.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--text-main);
  font-size: 0.9rem;
  transition: all 0.2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* BANNER */
.store-banner {
  width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 32px;
  border: 1px solid var(--border);
  background: transparent;
  aspect-ratio: 16 / 4;
  position: relative;
}

.store-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02); /* Zoom suave de 2% para remover a borda transparente do PNG original sem cortar a frase */
  transform-origin: center;
}

/* BACK ARROW */
.back-btn {
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
  transition: color 0.2s;
  align-self: flex-start; /* Mantém à esquerda mesmo em containers centralizados */
}

.back-btn:hover {
  color: var(--primary);
}

@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* FOLDERS SIDEBAR & ITEMS */
.folder-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  user-select: none;
}

.folder-item:hover {
  background-color: #f1f5f9;
}

.folder-item.active {
  background-color: #eff6ff;
  border-color: rgba(99, 102, 241, 0.2);
}

.folder-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-main);
  min-width: 0;
}

.folder-name-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.folder-actions {
  display: none;
  gap: 4px;
}

.folder-item:hover .folder-actions {
  display: flex;
}

.folder-btn-action {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  font-size: 0.8rem;
  border-radius: 4px;
  transition: background 0.15s;
  color: var(--text-muted);
}

.folder-btn-action:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: var(--text-main);
}

/* FOLDER MODAL SELECTORS */
.color-select-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  padding: 0;
}

.color-select-btn:hover {
  transform: scale(1.1);
}

.color-select-btn.active {
  border-color: #0f172a;
  transform: scale(1.1);
}

.icon-select-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: white;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-muted);
}

.icon-select-btn:hover {
  background-color: #f8fafc;
  color: var(--text-main);
}

.icon-select-btn.active {
  border-color: var(--primary);
  background-color: #eff6ff;
  color: var(--primary);
}

/* FOLDER PILL IN TABLE */
.folder-table-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  background: #f1f5f9;
  border: 1px solid var(--border);
}

/* ESTILIZAÇÃO DE MODAIS (GERAL) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.2s ease-out;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: modalScaleIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalScaleIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}

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

.modal-close:hover {
  color: var(--text-main);
}

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

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* MOCKUP IPHONE & PREVIEW DE MENSAGEM */
.iphone-mockup {
  position: relative;
  width: 440px;
  height: 810px;
  user-select: none;
  background: transparent;
  filter: drop-shadow(0 15px 30px rgba(0,0,0,0.3));
}

.iphone-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  z-index: 10 !important; /* Força ficar na camada da frente de qualquer outro elemento */
}

.iphone-screen {
  position: absolute;
  top: 22px;
  left: 47px;
  width: 346px;
  height: 766px;
  background-color: #efeae2;
  border-radius: 38px;
  overflow: hidden;
  z-index: 3 !important;
  display: flex;
  flex-direction: column;
}

/* WHATSAPP CONTAINER STYLE */
.whatsapp-header {
  background: #075e54;
  color: #fff;
  padding: 30px 12px 10px 14px; /* Espaço aumentado para o notch do iPhone 12 Pro */
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  flex-shrink: 0;
}

.wa-back {
  font-size: 0.75rem;
  opacity: 0.9;
  cursor: pointer;
}

.wa-avatar {
  width: 30px;
  height: 30px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.wa-user-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.wa-username {
  font-weight: 600;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-status {
  font-size: 0.6rem;
  color: #a3e635; /* Cor online verde limão */
}

.wa-actions {
  font-size: 0.9rem;
  opacity: 0.8;
  letter-spacing: 3px;
}

.whatsapp-chat-body {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
  background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
  background-repeat: repeat;
  background-size: 150px;
  display: flex;
  flex-direction: column;
}

.wa-message {
  max-width: 90%;
  padding: 8px 10px 6px 10px;
  border-radius: 7.5px;
  font-size: 0.75rem;
  line-height: 1.35;
  position: relative;
  margin-top: 10px;
  box-shadow: 0 1px 0.5px rgba(0,0,0,0.13);
  word-break: break-word;
}

.wa-message.wa-received {
  background: #fff;
  align-self: flex-start;
  border-top-left-radius: 0;
}

/* WhatsApp balão cauda */
.wa-message.wa-received::after {
  content: "";
  position: absolute;
  top: 0;
  left: -6px;
  width: 0;
  height: 0;
  border-top: 0px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 6px solid #fff;
}

.wa-message-text {
  white-space: pre-wrap;
  color: #303030;
  font-family: inherit;
}

.wa-message-text strong {
  font-weight: 700;
}

.wa-message-time {
  display: block;
  text-align: right;
  font-size: 0.6rem;
  color: #8c8c8c;
  margin-top: 4px;
}

/* MINDMAPS INTERFACE */
.mindmaps-workspace {
  position: relative;
  width: 100%;
  height: calc(100vh - 120px);
  min-height: 500px;
  background-color: #f8fafc;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  user-select: none;
}

#mindmaps-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, #cbd5e1 1px, transparent 1px);
  background-size: 20px 20px;
  cursor: crosshair;
}

.mindmaps-toolbar {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 6px;
  display: flex;
  gap: 6px;
  z-index: 10;
}

.mindmaps-tool-btn {
  background: transparent;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.mindmaps-tool-btn:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.mindmaps-tool-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.mindmaps-sidebar {
  position: absolute;
  top: 16px;
  left: 16px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 16px;
  width: 220px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 10;
  max-height: calc(100% - 32px);
  overflow-y: auto;
}

.mindmaps-sidebar h4 {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}

.mindmaps-sidebar-group {
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.mindmaps-sidebar-group:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.mindmaps-color-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.mindmaps-color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.1s;
}

.mindmaps-color-swatch:hover {
  transform: scale(1.1);
}

.mindmaps-color-swatch.active {
  border-color: #0f172a;
  transform: scale(1.1);
}

.mindmaps-style-row {
  display: flex;
  gap: 6px;
}

.mindmaps-style-btn {
  flex: 1;
  background: white;
  border: 1px solid var(--border);
  padding: 6px 0;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-muted);
  text-align: center;
}

.mindmaps-style-btn:hover {
  background: #f8fafc;
}

.mindmaps-style-btn.active {
  border-color: var(--primary);
  background: #eff6ff;
  color: var(--primary);
}

.mindmaps-input-text {
  position: absolute;
  background: white;
  border: 1px solid var(--primary);
  border-radius: 4px;
  padding: 4px 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  color: var(--text-main);
  outline: none;
  min-width: 100px;
  box-shadow: var(--shadow-md);
  z-index: 100;
}

.mindmaps-bottom-bar {
  position: absolute;
  bottom: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 6px 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  z-index: 10;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* ESTILO PREMIUM CONTATOS DA AGENDA */
.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.contact-item:hover {
  background: #f8fafc;
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.contact-avatar {
  width: 36px;
  height: 36px;
  background: #eef2ff;
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  border: 1px solid rgba(79, 70, 229, 0.1);
}

.contact-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.contact-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-phone {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 1px;
}

