/* ============================================
   Email Modal Styles
   ============================================ */

/* Rich Text Editor for Send All Modal */
#sendAllMessage:empty:before {
  content: attr(placeholder);
  color: #999;
  font-style: italic;
}

#sendAllMessage:focus {
  outline: none;
  border-color: #c9b25f;
  box-shadow: 0 0 0 3px rgba(201,178,95,0.1);
}

/* Editor Button Styles */
.editor-btn {
  padding: 6px 12px;
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.editor-btn:hover {
  background: #f0f0f0;
  border-color: #c9b25f;
  transform: translateY(-1px);
}

.editor-btn:active, .editor-btn.active {
  background: #c9b25f;
  color: #fff;
  border-color: #c9b25f;
}

/* Color Picker Options */
.color-option {
  width: 32px;
  height: 32px;
  border: 2px solid #fff;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.color-option:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Variable Menu Options */
.variable-option:hover {
  background: #f0f0f0;
}

/* Rich Text Editor Focus */
#emailMessage:focus {
  outline: none;
  border-color: #c9b25f;
  box-shadow: 0 0 0 3px rgba(201,178,95,0.1);
}

/* Placeholder */
#emailMessage:empty:before {
  content: attr(placeholder);
  color: #999;
  font-style: italic;
}

/* Focus styles for inputs */
#emailTo:focus,
#emailSubject:focus,
#emailTemplate:focus {
  outline: none;
  border-color: #c9b25f;
  box-shadow: 0 0 0 3px rgba(201,178,95,0.1);
}

/* Checkbox labels hover */
#emailRecipientsContainer label:has(input:checked) {
  border-color: #c9b25f;
  background: #f9f6ea;
}

/* Send button hover */
#sendEmailNow:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(60,68,76,0.4);
}

#sendEmailNow:active {
  transform: translateY(0);
}

#sendEmailNow:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Close button hover */
#closeEmailModal:hover {
  background: rgba(255,255,255,0.3);
  transform: rotate(90deg);
}

/* File list styling */
#fileList li {
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 6px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

#fileList li:before {
  content: "Ã°Å¸â€œâ€ž";
}

/* Responsive */
@media (max-width: 768px) {
  #emailToolbar {
    gap: 4px;
  }
  
  .editor-btn {
    min-width: 32px;
    height: 32px;
    padding: 4px 8px;
    font-size: 12px;
  }
}









/* Email Search Container */
.email-search-container {
    padding: 15px 20px;
    background: #f9f9f9;
    border-bottom: 2px solid #e0e0e0;
}

/* Search Row - Input + Button */
.email-search-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}

.email-search-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 14px;
    border: 2px solid #d0d0d0;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.email-search-input:focus {
    outline: none;
    border-color: #c9b25f;
    box-shadow: 0 0 0 3px rgba(201, 178, 95, 0.1);
}

/* Send Email Button */
.send-email-btn {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    background: linear-gradient(135deg, #3c444c, #c9b25f);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(60, 68, 76, 0.3);
}

.send-email-btn:hover {
    background: linear-gradient(135deg, #c9b25f, #3c444c);
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(60, 68, 76, 0.4);
}

.send-email-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(60, 68, 76, 0.3);
}

.email-search-stats {
    font-size: 12px;
    color: #666;
    text-align: right;
}

/* Highlight search matches */
.search-highlight {
    background-color: #fff3cd;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
}

/* Hide rows that don't match search */
.email-list-table tbody tr.search-hidden {
    display: none !important;
}

/* Email Modal Styles */
.email-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

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

.email-modal-content {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease;
}

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

.email-modal-header {
    background: linear-gradient(135deg, #3c444c, #c9b25f);
    color: #fff;
    padding: 18px 24px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.email-modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    color: #fff;
    border: none;
    padding: 0;
}

.email-modal-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

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

.email-modal-body {
    padding: 0;
    overflow-y: auto;
    max-height: 60vh;
}

/* Scrollable wrapper for table */
.email-list-wrapper {
    max-height: 55vh;
    overflow-y: auto;
}

.email-list-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.email-list-table thead {
    background: linear-gradient(135deg, #3c444c, #c9b25f);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.email-list-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

.email-list-table tbody tr {
    border-bottom: 1px solid #eee;
    transition: background 0.2s ease;
}

.email-list-table tbody tr:hover:not(.search-hidden) {
    background: #f9f6ea;
}

.email-list-table td {
    padding: 14px 16px;
    font-size: 13px;
    vertical-align: top;
}

.email-subject-link {
    color: #3c444c;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
}

.email-subject-link:hover {
    color: #c9b25f;
    text-decoration: underline;
}

.email-status-opened {
    color: #28a745;
    font-weight: 600;
}

.email-status-pending {
    color: #ffc107;
    font-weight: 600;
}

.email-status-failed {
    color: #dc3545;
    font-weight: 600;
}

.email-status-scheduled {
    color: #6f42c1;
    font-weight: 600;
}

.email-detail-info {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.email-detail-info p {
    margin: 8px 0;
    font-size: 14px;
}

.email-detail-info strong {
    color: #3c444c;
}

.email-detail-message {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    min-height: 200px;
    line-height: 1.6;
}

/* Improve scrollbar appearance */
.email-modal-body::-webkit-scrollbar,
.email-list-wrapper::-webkit-scrollbar {
    width: 10px;
}

.email-modal-body::-webkit-scrollbar-track,
.email-list-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0 0 16px 0;
}

.email-modal-body::-webkit-scrollbar-thumb,
.email-list-wrapper::-webkit-scrollbar-thumb {
    background: #c9b25f;
    border-radius: 5px;
}

.email-modal-body::-webkit-scrollbar-thumb:hover,
.email-list-wrapper::-webkit-scrollbar-thumb:hover {
    background: #a38e48;
}

/* Responsive */
@media (max-width: 768px) {
    .email-search-row {
        flex-direction: column;
    }
    
    .send-email-btn {
        width: 100%;
    }
}



/* =============================================
   Send to All Clients Modal - Enhanced Campaign System
   ============================================= */

.sendall-overlay {
  display: none;
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0, 0, 0, 0.6) !important;
  backdrop-filter: blur(4px) !important;
  z-index: 99999 !important;
  justify-content: center !important;
  align-items: center !important;
  padding: 20px !important;
  overflow-y: auto !important;
  animation: fadeIn 0.3s ease;
}

.sendall-overlay.active {
  display: flex !important;
}

.sendall-modal {
  background: #fff;
  border-radius: 16px;
  width: 95%;
  max-width: 1100px;
  max-height: 90vh;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  animation: zoomIn 0.3s ease;
  font-family: system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  margin: auto;
}

.sendall-header {
  background: linear-gradient(135deg, #3c444c, #c9b25f);
  color: #fff;
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.sendall-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #fff;
}

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

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

.sendall-body {
  padding: 25px 30px;
  overflow-y: auto;
  flex: 1;
  max-height: calc(90vh - 70px);
}

/* Campaign Stats Grid */
.campaign-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 15px 0;
}

.stat-box {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  padding: 15px;
  border-radius: 10px;
  text-align: center;
  border-left: 4px solid #c9b25f;
  transition: transform 0.2s;
}

.stat-box:hover {
  transform: translateY(-3px);
}

.stat-box.success { border-left-color: #28a745; }
.stat-box.warning { border-left-color: #ffc107; }
.stat-box.danger { border-left-color: #dc3545; }
.stat-box.info { border-left-color: #17a2b8; }
.stat-box.purple { border-left-color: #9c27b0; }

.stat-label {
  font-size: 11px;
  color: #666;
  text-transform: uppercase;
  margin-bottom: 8px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 32px;
  font-weight: bold;
  color: #3c444c;
  line-height: 1;
}

.stat-subtext {
  font-size: 10px;
  color: #999;
  margin-top: 5px;
}

/* Campaign Progress Bar */
.campaign-progress {
  background: #e9ecef;
  height: 35px;
  border-radius: 17px;
  overflow: hidden;
  margin: 15px 0;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.campaign-progress-bar {
  background: linear-gradient(90deg, #28a745 0%, #20c997 100%);
  height: 100%;
  transition: width 0.5s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: bold;
  font-size: 14px;
}

/* Campaign Status Badge */
.campaign-status-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.campaign-status-badge.active {
  background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
  color: #fff;
}

.campaign-status-badge.completed {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: #fff;
}

/* Client Type Selector */
.client-type-selector {
  display: flex;
  gap: 15px;
  margin: 20px 0;
}

.client-type-option {
  flex: 1;
  padding: 20px;
  border: 3px solid #e0e0e0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
  background: #fff;
}

.client-type-option:hover {
  border-color: #c9b25f;
  background: #f9f6ea;
  transform: translateY(-2px);
}

.client-type-option input[type="radio"] {
  display: none;
}

.client-type-option input[type="radio"]:checked + label {
  background: linear-gradient(135deg, #c9b25f 0%, #8b7a3e 100%);
  color: #fff;
  padding: 15px 25px;
  border-radius: 10px;
  display: block;
}

.client-type-option label {
  cursor: pointer;
  font-weight: 600;
  font-size: 16px;
  transition: all 0.3s;
}

/* Last Campaign Header */
.last-campaign-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  padding: 15px 20px;
  border-radius: 10px 10px 0 0;
  margin: -20px -20px 0 -20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.no-campaign-box {
  background: #f8f9fa;
  padding: 40px;
  border-radius: 10px;
  text-align: center;
  color: #666;
}

.details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 15px 0;
  font-size: 13px;
}

.details-item {
  background: #f8f9fa;
  padding: 10px 15px;
  border-radius: 6px;
}

.details-item strong {
  color: #3c444c;
}

/* Rich Text Editor */
.editor-btn {
  background: #f8f9fa;
  border: 1px solid #ddd;
  padding: 5px 10px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 13px;
  transition: all 0.2s;
}

.editor-btn:hover {
  background: #e9ecef;
}

.editor-btn.active {
  background: #c9b25f;
  color: #fff;
  border-color: #c9b25f;
}

.color-option {
  cursor: pointer;
  transition: transform 0.2s;
}

.color-option:hover {
  transform: scale(1.15);
}

.variable-option:hover {
  background: #f8f9fa;
}

/* Password Section */
.password-section {
  background: #fff3cd;
  border: 2px solid #ffc107;
  border-radius: 8px;
  padding: 15px;
  margin: 15px 0;
}

.password-input {
  width: 100%;
  padding: 10px;
  border: 2px solid #ffc107;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
}

.password-input:focus {
  outline: none;
  border-color: #ff9800;
  box-shadow: 0 0 0 3px rgba(255,193,7,0.2);
}

/* Action Button */
.action-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  color: #fff;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

.action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Excluded Emails Modal */
.excluded-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 20px;
}

.excluded-stat-box {
  padding: 20px;
  border-radius: 8px;
  text-align: center;
}

.excluded-stat-box.bounced {
  background: #fff3e0;
  border: 2px solid #ff9800;
}

.excluded-stat-box.unsubscribed {
  background: #f3e5f5;
  border: 2px solid #9c27b0;
}

.excluded-stat-number {
  font-size: 36px;
  font-weight: bold;
  margin-bottom: 5px;
}

.excluded-stat-label {
  font-size: 14px;
  color: #666;
}

.excluded-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
}

.excluded-table th {
  background: #3c444c;
  color: white;
  padding: 12px;
  text-align: left;
}

.excluded-table td {
  padding: 12px;
  border-bottom: 1px solid #ddd;
}

.excluded-table tr:nth-child(even) {
  background: #f9f9f9;
}

.excluded-table tr:hover {
  background: #f0f0f0;
}

.email-bounced {
  color: #ff9800;
  font-weight: bold;
  font-family: monospace;
}

.email-unsubscribed {
  color: #9c27b0;
  font-weight: bold;
  font-family: monospace;
}

.no-excluded-msg {
  text-align: center;
  padding: 40px;
  background: #e8f5e9;
  border-radius: 8px;
  border-left: 4px solid #4caf50;
}

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

@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* Responsive */
@media (max-width: 768px) {
  .sendall-modal {
    width: 98%;
    max-height: 95vh;
  }
  
  .campaign-stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  
  .client-type-selector {
    flex-direction: column;
  }
  
  .details-grid {
    grid-template-columns: 1fr;
  }
}