/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
}

.modal.show,
.modal[style*="display: block"] {
  display: flex !important;
}

.modal-content {
  background-color: #fff;
  margin: auto;
  padding: 0;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-content.modal-lg,
.modal-lg .modal-content {
  max-width: 800px;
}

.modal-content[style*="max-width: 1200px"] {
  max-width: 1200px;
}

.modal-content[style*="max-width: 900px"] {
  max-width: 900px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #ddd;
  background-color: var(--primary-color, #00a149);
  color: var(--white, #fff);
  border-radius: 8px 8px 0 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.modal-header .close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--white, #fff);
  padding: 0;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.modal-header .close-btn:hover {
  opacity: 1;
}

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

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 15px 20px;
  border-top: 1px solid #ddd;
  background-color: #f8f9fa;
  border-radius: 0 0 8px 8px;
}

.mass-send-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}


.mass-send-composer {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 30px;
  margin-top: 20px;
}

.composer-left {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.composer-right {
  position: sticky;
  top: 20px;
  height: fit-content;
}

.whatsapp-preview {
  background: #e5ddd5;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.preview-header {
  background: #075e54;
  color: white;
  padding: 15px;
  font-weight: 600;
  text-align: center;
}

.preview-body {
  padding: 20px;
  min-height: 400px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect fill="%23e5ddd5" width="100" height="100"/><path fill="%23d1d7db" opacity="0.1" d="M0 0h100v100H0z"/></svg>');
}

.whatsapp-message {
  display: flex;
  justify-content: flex-end;
}

.message-bubble {
  background: #dcf8c6;
  border-radius: 8px;
  padding: 10px 15px;
  max-width: 80%;
  word-wrap: break-word;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  position: relative;
  white-space: pre-wrap;
}

.message-bubble::after {
  content: '';
  position: absolute;
  right: -8px;
  top: 0;
  width: 0;
  height: 0;
  border-left: 8px solid #dcf8c6;
  border-top: 8px solid transparent;
}

.placeholder-hints {
  margin-top: 8px;
  padding: 8px;
  background: #f8f9fa;
  border-radius: 4px;
  font-size: 12px;
}

.placeholder-hints strong {
  color: var(--primary);
}

.placeholder-hints .placeholder-tag {
  cursor: pointer;
  color: #007bff;
  text-decoration: underline;
  padding: 2px 4px;
  border-radius: 3px;
  transition: background-color 0.2s;
}

.placeholder-hints .placeholder-tag:hover {
  background-color: #e7f3ff;
  color: #0056b3;
}

.contact-list {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 10px;
  margin-top: 15px;
}

.modal-lg .modal-content {
  max-width: 800px;
  width: 90%;
}

.selected-count {
  padding: 10px;
  background-color: #f8f9fa;
  border-radius: 4px;
  text-align: center;
  color: var(--primary-color);
  font-weight: 600;
}

.text-muted {
  color: #6c757d;
  font-size: 0.875rem;
}

/* Modal header styling */
#contactSelectionModal .modal-header h3 {
  color: var(--primary-color);
  margin: 0;
}

/* Modal tabs inside contact selection */
#contactSelectionModal .tabs {
  margin-bottom: 20px;
  border-bottom: 2px solid #ddd;
  background-color: #f8f9fa;
  padding: 10px 10px 0 10px;
  border-radius: 4px 4px 0 0;
}

#contactSelectionModal .tab-btn {
  padding: 10px 20px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-weight: 500;
  color: var(--text-color, #333);
  transition: all 0.3s;
  margin-bottom: -2px;
  border-radius: 4px 4px 0 0;
}

#contactSelectionModal .tab-btn:hover {
  background: var(--menu-hover, rgba(0, 161, 73, 0.1));
  color: var(--primary-color, #00a149);
}

#contactSelectionModal .tab-btn.active {
  background: var(--white, #fff);
  color: var(--primary-color, #00a149);
  border-bottom-color: var(--primary-color, #00a149);
  font-weight: 600;
}

.contact-item {
  display: flex;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  transition: background 0.2s;
}

.contact-item:hover {
  background: #f5f5f5;
}

.contact-item input[type="checkbox"] {
  margin-right: 10px;
  cursor: pointer;
}

.contact-item:last-child {
  border-bottom: none;
}

.reminder-date-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.reminder-date-item .reminder-days {
  flex: 0 0 100px;
}

.reminder-date-item .reminder-time {
  flex: 0 0 120px;
}

.reminder-date-item span {
  flex: 0 0 auto;
  white-space: nowrap;
}

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-success {
  background: #d4edda;
  color: #155724;
}

.status-info {
  background: #d1ecf1;
  color: #0c5460;
}

.status-warning {
  background: #fff3cd;
  color: #856404;
}

.status-danger {
  background: #f8d7da;
  color: #721c24;
}

.status-secondary {
  background: #e2e3e5;
  color: #383d41;
}

.action-buttons {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
  min-width: 32px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #666;
}

.empty-state p {
  font-size: 18px;
  margin-bottom: 20px;
}

.logs-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 400px;
  max-height: 300px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  z-index: 1000;
}

.logs-header {
  background: var(--primary);
  color: white;
  padding: 12px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.logs-body {
  max-height: 250px;
  overflow-y: auto;
  padding: 10px;
}

.log-item {
  padding: 8px;
  border-bottom: 1px solid #eee;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.log-item:last-child {
  border-bottom: none;
}

.log-item.success {
  background: #d4edda;
}

.log-item.error {
  background: #f8d7da;
}

.log-item.sending {
  background: #d1ecf1;
}

.progress-bar-container {
  background: #e9ecef;
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
  margin: 10px 0;
}

.progress-bar {
  background: var(--primary);
  height: 100%;
  transition: width 0.3s ease;
}

.send-controls {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

@media (max-width: 992px) {
  .mass-send-composer {
    grid-template-columns: 1fr;
  }
  
  .composer-right {
    position: static;
  }
  
  .logs-container {
    width: calc(100% - 40px);
    left: 20px;
  }
}

@media (max-width: 768px) {
  .mass-send-controls {
    flex-direction: column;
  }
  
  .mass-send-controls button {
    width: 100%;
  }
  
  .action-buttons {
    justify-content: center;
  }
  
  .table-container {
    overflow-x: auto;
  }
  
  .table-container table {
    min-width: 600px;
  }
}

.tabs {
  display: flex;
  gap: 5px;
  margin-bottom: 20px;
  border-bottom: 2px solid #ddd;
  background-color: #f8f9fa;
  padding: 10px 10px 0 10px;
  border-radius: 8px 8px 0 0;
}

.tab-btn {
  padding: 12px 24px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-weight: 500;
  color: var(--text-color, #333);
  transition: all 0.3s;
  margin-bottom: -2px;
  border-radius: 4px 4px 0 0;
}

.tab-btn:hover {
  background: var(--menu-hover, rgba(0, 161, 73, 0.1));
  color: var(--primary-color, #00a149);
}

.tab-btn.active {
  background: var(--white, #fff);
  color: var(--primary-color, #00a149);
  border-bottom-color: var(--primary-color, #00a149);
  font-weight: 600;
}

/* Table Styles */
.table-container {
  overflow-x: auto;
  margin-top: 15px;
}

.table-container table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white, #fff);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.table-container th {
  background-color: var(--primary-color, #00a149);
  color: var(--white, #fff);
  padding: 12px 15px;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
}

.table-container td {
  padding: 12px 15px;
  border-bottom: 1px solid #eee;
  font-size: 14px;
}

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

.table-container tr:hover {
  background-color: #f8f9fa;
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #eee;
}

.page-header h1,
.page-header h2 {
  margin: 0;
  color: var(--primary-color, #00a149);
  font-size: 24px;
}

.tab-content {
  animation: fadeIn 0.3s;
  padding: 20px;
  background: var(--white, #fff);
  border-radius: 0 0 8px 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--primary-color);
}

/* Button styles using system colors */
.btn {
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s;
  border: none;
}

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

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

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

.btn-secondary:hover {
  opacity: 0.9;
}

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

.btn-success:hover {
  opacity: 0.9;
}

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

.btn-danger:hover {
  opacity: 0.9;
}

.btn-warning {
  background-color: var(--warning);
  color: var(--dark);
}

.btn-warning:hover {
  opacity: 0.9;
}

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

.btn-info:hover {
  opacity: 0.9;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 14px;
}

.form-control {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.3s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 161, 73, 0.1);
}

/* Empty state button */
.empty-state .btn-primary {
  background-color: var(--primary-color);
  color: var(--white);
  padding: 12px 24px;
  font-size: 16px;
}

/* Table headers */
.table-container th {
  color: var(--white);
  background-color: var(--primary-color);
}

/* Status badges with system colors */
.status-badge.status-success {
  background-color: var(--success);
  color: var(--white);
}

.status-badge.status-danger {
  background-color: var(--danger);
  color: var(--white);
}

.status-badge.status-warning {
  background-color: var(--warning);
  color: var(--dark);
}

.status-badge.status-info {
  background-color: var(--info);
  color: var(--white);
}

textarea.form-control {
  resize: vertical;
  font-family: inherit;
}

.mt-2 {
  margin-top: 8px;
}

small {
  display: block;
  margin-top: 4px;
  color: #666;
  font-size: 12px;
}


/* Card Styles */
.card {
  background: var(--white, #fff);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.card-header {
  padding: 15px 20px;
  border-bottom: 1px solid #eee;
  background-color: #f8f9fa;
  border-radius: 8px 8px 0 0;
}

.card-header h3 {
  margin: 0;
  color: var(--primary-color, #00a149);
  font-size: 16px;
  font-weight: 600;
}

.card-body {
  padding: 20px;
}

/* Mass Send Page Container */
#mass-send-page {
  padding: 20px;
}

#mass-send-page .tabs {
  margin-bottom: 0;
}

/* Fix for tab content visibility */
#mass-send-page .tab-content {
  display: none;
}

#mass-send-page .tab-content.active {
  display: block;
}

/* Ensure first tab is visible by default */
#history-tab {
  display: block;
}

/* Loading state */
.loading-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
  color: var(--primary-color, #00a149);
}

.loading-spinner::before {
  content: '';
  width: 30px;
  height: 30px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid var(--primary-color, #00a149);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 10px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  #mass-send-page {
    padding: 10px;
  }
  
  .tabs {
    flex-wrap: wrap;
  }
  
  .tab-btn {
    flex: 1;
    min-width: 100px;
    text-align: center;
    padding: 10px 15px;
    font-size: 13px;
  }
  
  .modal-content {
    width: 95%;
    margin: 10px;
  }
  
  .mass-send-composer {
    grid-template-columns: 1fr;
  }
}
