@tailwind base;
@tailwind components;
@tailwind utilities;

@layer components {
  /* Dashboard Components */
  .dashboard-card {
    @apply bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700 p-6;
  }
  
  .dashboard-card-header {
    @apply flex items-center justify-between mb-4;
  }
  
  .dashboard-card-title {
    @apply text-lg font-semibold text-gray-900 dark:text-white;
  }
  
  .dashboard-card-subtitle {
    @apply text-sm text-gray-500 dark:text-gray-400;
  }
  
  .dashboard-stat-number {
    @apply text-3xl font-bold text-gray-900 dark:text-white;
  }
  
  .dashboard-stat-label {
    @apply text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wide;
  }
  
  .dashboard-sidebar {
    @apply bg-gray-900 text-white w-64 min-h-screen p-6;
  }
  
  .dashboard-sidebar-item {
    @apply flex items-center space-x-3 px-3 py-2 rounded-lg text-gray-300 hover:text-white hover:bg-gray-800 transition-colors duration-200;
  }
  
  .dashboard-sidebar-item.active {
    @apply bg-primary-600 text-white;
  }
  
  .dashboard-header {
    @apply bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 px-6 py-4;
  }
  
  .dashboard-main {
    @apply bg-gray-50 dark:bg-gray-900 min-h-screen p-6;
  }
  
  .dashboard-grid {
    @apply grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6;
  }
  
  .dashboard-chart-card {
    @apply dashboard-card col-span-1 md:col-span-2;
  }
  
  .dashboard-table {
    @apply w-full text-sm text-left text-gray-500 dark:text-gray-400;
  }
  
  .dashboard-table th {
    @apply px-6 py-3 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider;
  }
  
  .dashboard-table td {
    @apply px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-white;
  }
  
  .dashboard-table tbody tr {
    @apply bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700;
  }
  
  .btn-primary {
    @apply bg-primary-600 hover:bg-primary-700 text-white font-medium py-2 px-4 rounded-lg transition-colors duration-200;
  }
  
  .btn-secondary {
    @apply bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-900 dark:text-white font-medium py-2 px-4 rounded-lg transition-colors duration-200;
  }
  
  .progress-bar {
    @apply w-full bg-gray-200 dark:bg-gray-700 rounded-full h-2;
  }
  
  .progress-fill {
    @apply bg-primary-600 h-2 rounded-full transition-all duration-300;
  }
  
  .notification-dot {
    @apply absolute -top-1 -right-1 h-3 w-3 bg-red-500 rounded-full;
  }
  
  .avatar {
    @apply h-8 w-8 rounded-full bg-gray-300 dark:bg-gray-600 flex items-center justify-center text-sm font-medium text-gray-700 dark:text-gray-300;
  }

  /* Pagination Styles - Match existing app pagination */
  .activity-pagination {
    @apply mt-6 flex justify-center;
  }

  .activity-pagination .pagination {
    @apply flex flex-col items-center gap-4;
  }

  .activity-pagination .pagination-info {
    @apply text-sm text-gray-500 dark:text-gray-400;
  }

  .activity-pagination .pagination-links {
    @apply flex gap-2 items-center;
  }

  /* Target Kaminari-generated HTML structure */
  .activity-pagination .pagination a,
  .activity-pagination .pagination span {
    @apply inline-block px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-700 hover:text-gray-900 dark:hover:text-white transition-colors duration-200 text-center min-w-[44px];
  }

  .activity-pagination .pagination .current {
    @apply bg-blue-600 text-white border-blue-600 font-semibold;
  }

  .activity-pagination .pagination .disabled {
    @apply opacity-50 cursor-not-allowed hover:bg-white dark:hover:bg-gray-800 hover:text-gray-700 dark:hover:text-gray-300;
  }

  .activity-pagination .pagination .gap {
    @apply px-1 py-2 text-gray-500 dark:text-gray-400 text-sm;
  }

  .activity-pagination .pagination .prev,
  .activity-pagination .pagination .next {
    @apply font-medium;
  }

  /* Override Kaminari's default styling more aggressively */
  .activity-pagination .pagination {
    @apply !flex !flex-col !items-center !gap-4;
  }

  .activity-pagination .pagination a,
  .activity-pagination .pagination span {
    @apply !inline-block !px-4 !py-2 !text-sm !font-medium !text-gray-700 !bg-white !border !border-gray-300 !rounded-md hover:!bg-gray-50 hover:!text-gray-900 !transition-colors !duration-200 !text-center !min-w-[44px] !no-underline;
  }

  .activity-pagination .pagination .current {
    @apply !bg-blue-600 !text-white !border-blue-600 !font-semibold;
  }

  /* Error Alert Styles */
  .error-alert {
    @apply bg-red-50 border border-red-200 rounded-lg p-4 mb-6 !important;
  }

  .error-alert-header {
    @apply flex items-start space-x-3 !important;
  }

  .error-alert-icon {
    @apply flex-shrink-0 w-5 h-5 text-red-400 mt-0.5 !important;
  }

  .error-alert-content {
    @apply flex-1 min-w-0 !important;
  }

  .error-alert-title {
    @apply text-sm font-medium text-red-800 mb-2 !important;
  }

  .error-alert-list {
    @apply space-y-1 !important;
  }

  .error-alert-item {
    @apply flex items-start space-x-2 text-sm text-red-700 !important;
  }

  .error-alert-bullet {
    @apply flex-shrink-0 text-red-500 font-bold !important;
  }

  /* Override any existing error_explanation styles */
  #error_explanation {
    @apply bg-red-50 border border-red-200 rounded-lg p-4 mb-6 !important;
  }

  #error_explanation h2,
  #error_explanation h3 {
    @apply text-sm font-medium text-red-800 mb-2 !important;
  }

  #error_explanation ul {
    @apply space-y-1 !important;
  }

  #error_explanation li {
    @apply flex items-start space-x-2 text-sm text-red-700 !important;
  }

  /* Success Alert Styles (for consistency) */
  .success-alert {
    @apply bg-green-50 border border-green-200 rounded-lg p-4 mb-6;
  }

  .success-alert-header {
    @apply flex items-start space-x-3;
  }

  .success-alert-icon {
    @apply flex-shrink-0 w-5 h-5 text-green-400 mt-0.5;
  }

  .success-alert-content {
    @apply flex-1 min-w-0;
  }

  .success-alert-title {
    @apply text-sm font-medium text-green-800 mb-2;
  }

  .success-alert-message {
    @apply text-sm text-green-700;
  }

  /* Info Alert Styles (for consistency) */
  .info-alert {
    @apply bg-blue-50 border border-blue-200 rounded-lg p-4 mb-6;
  }

  .info-alert-header {
    @apply flex items-start space-x-3;
  }

  .info-alert-icon {
    @apply flex-shrink-0 w-5 h-5 text-blue-400 mt-0.5;
  }

  .info-alert-content {
    @apply flex-1 min-w-0;
  }

  .info-alert-title {
    @apply text-sm font-medium text-blue-800 mb-2;
  }

  .info-alert-message {
    @apply text-sm text-blue-700;
  }
}
/* Email Builder Page Styles */
/* Extracted from new_email.html.erb to reduce file size */

/* Material-UI Style Isolation */
/* Note: Global body/html styles removed to prevent affecting sidebar navigation spacing.
   Material-UI protection is handled by scoped rules below and admin layout styles. */

/* Protect dashboard container from Material-UI styles */
.dashboard-container[data-page="email-builder"] .sidebar,
.dashboard-container[data-page="email-builder"] .sidebar *:not(.nav-link):not(a.nav-link),
.dashboard-container[data-page="email-builder"] .main-content > *:not(#email-editor-root):not(#email-editor-root *),
.dashboard-container[data-page="email-builder"] .header,
.dashboard-container[data-page="email-builder"] .header *,
.dashboard-container[data-page="email-builder"] .wizard-progress,
.dashboard-container[data-page="email-builder"] .wizard-progress * {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  line-height: inherit !important;
}

/* Nav Links - Match admin layout exactly */
html body .dashboard-container[data-page="email-builder"] .sidebar .nav-link:not(.active),
html body .dashboard-container[data-page="email-builder"] aside.sidebar .nav-link:not(.active),
.dashboard-container[data-page="email-builder"] .sidebar .nav-link:not(.active),
.dashboard-container[data-page="email-builder"] aside.sidebar .nav-link:not(.active) {
  font-size: 16px !important;
  line-height: normal !important;
  font-weight: 500 !important;
  color: #64748b !important;
}

html body .dashboard-container[data-page="email-builder"] .sidebar .nav-link.active,
html body .dashboard-container[data-page="email-builder"] aside.sidebar .nav-link.active,
.dashboard-container[data-page="email-builder"] .sidebar .nav-link.active,
.dashboard-container[data-page="email-builder"] aside.sidebar .nav-link.active {
  color: #ffffff !important;
  background-color: #25a3d8 !important;
}

/* Nav Titles - Match admin layout exactly */
html body .dashboard-container[data-page="email-builder"] .sidebar .nav-title,
html body .dashboard-container[data-page="email-builder"] aside.sidebar .nav-title,
html body .dashboard-container[data-page="email-builder"] .sidebar .nav-section .nav-title,
html body .dashboard-container[data-page="email-builder"] aside.sidebar .nav-section .nav-title,
.dashboard-container[data-page="email-builder"] .sidebar .nav-title,
.dashboard-container[data-page="email-builder"] aside.sidebar .nav-title,
.dashboard-container[data-page="email-builder"] .sidebar .nav-section .nav-title,
.dashboard-container[data-page="email-builder"] aside.sidebar .nav-section .nav-title {
  font-size: 12px !important;
  font-weight: 600 !important;
  color: #64748b !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  margin-bottom: 16px !important;
  margin-top: 0 !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  line-height: normal !important;
}

/* Page Title - Match admin layout exactly */
html body .dashboard-container[data-page="email-builder"] .header .page-title,
.dashboard-container[data-page="email-builder"] .page-title {
  font-size: 28px !important;
  font-weight: 700 !important;
  color: #1e293b !important;
  margin: 0 !important;
  letter-spacing: -1px !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

/* Email Editor Container */
#email-editor-root {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  isolation: isolate;
}

/* Email Form Layout */
.email-form {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

.dashboard-container {
  overflow: visible !important;
}

.main-content {
  overflow: visible !important;
  position: relative;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
}

/* Subject Title Field */
.email-subject-title {
  padding: 16px 16px 8px 16px;
  background: white;
  border-bottom: 1px solid #e5e7eb;
  outline: none !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
  box-shadow: none !important;
}

.subject-title-input {
  width: 100%;
  background: transparent;
  border: none !important;
  outline: none !important;
  font-size: 1.5rem;
  font-weight: 600;
  color: #111827;
  padding: 0;
  margin: 0;
  font-family: inherit;
  box-sizing: border-box;
  box-shadow: none !important;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.subject-title-input::placeholder {
  color: #9ca3af;
  opacity: 1;
}

.subject-title-input:focus {
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
}

/* Email Editor Container */
.email-editor-container {
  width: 100%;
  max-width: 100%;
  height: calc(100vh - 300px);
  min-height: 600px;
  background: #f8fafc;
  overflow: hidden;
  position: relative;
  flex: 1;
  margin-bottom: 100px;
}

#email-editor-root {
  width: 100%;
  max-width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

#email-editor-root > * {
  width: 100%;
  max-width: 100%;
  flex: 1;
  overflow: hidden;
  min-width: 0;
  box-sizing: border-box;
}

/* Wizard Progress */
.wizard-progress {
  background: white;
  border-bottom: 1px solid #e5e7eb;
  padding: 20px 32px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  position: relative;
  outline: none !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
  box-shadow: none !important;
}

.wizard-progress *,
.wizard-progress *:focus,
.wizard-progress *:focus-visible,
.wizard-progress *:focus-within {
  outline: none !important;
}

.progress-steps {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 400px;
  margin: 0 auto;
  flex-shrink: 0;
}

.progress-actions {
  grid-column: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  min-width: 0;
  transition: none;
  transform: none;
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e5e7eb;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
}

.progress-step.active .step-number {
  background: #25a3d8;
  color: white;
}

.step-label {
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  transition: color 0.2s ease;
}

.progress-step.active .step-label {
  color: #25a3d8;
  font-weight: 600;
}

.progress-connector {
  width: 100px;
  height: 2px;
  background: #e5e7eb;
  margin: 0 16px;
  margin-top: -24px;
  transition: background 0.2s ease;
}

.progress-step.active ~ .progress-step .progress-connector,
.progress-step.active + .progress-connector {
  background: #25a3d8;
}

/* Wizard Steps */
.wizard-step {
  display: none;
}

.wizard-step.active {
  display: block;
}

#step-2.active {
  display: grid !important;
}

#step-1 {
  display: block;
}

/* Review Container */
.review-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 24px 32px;
  min-height: calc(100vh - 300px);
}

/* Preview Panel */
.preview-panel {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.preview-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
}

.preview-title {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 8px 0;
}

.preview-subject-display {
  font-size: 14px;
  color: #64748b;
  font-weight: 500;
}

.preview-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #ffffff;
}

/* Recipients Panel */
.recipients-panel {
  overflow-y: auto;
  max-height: calc(100vh - 200px);
  padding: 0;
}

.recipient-section-wrapper {
  background: white;
  border-top: 1px solid #e5e7eb;
  padding: 24px 32px;
  margin-bottom: 80px;
}

.recipient-section-header {
  margin-bottom: 24px;
}

.recipient-section-title {
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 4px 0;
}

.recipient-section-subtitle {
  font-size: 14px;
  color: #64748b;
  margin: 0;
}

.recipient-section {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 24px;
}

.recipient-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

.recipient-option {
  position: relative;
}

.recipient-option .recipient-radio {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.recipient-option label {
  display: block;
  padding: 18px 20px;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  height: 100%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.recipient-option .recipient-radio:checked + label {
  border-color: #25a3d8;
  background: #f0f9ff;
  box-shadow: 0 0 0 3px rgba(37, 163, 216, 0.1);
}

.recipient-option:hover label {
  border-color: #cbd5e1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transform: translateY(-1px);
}

.option-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.option-title {
  font-weight: 600;
  color: #1e293b;
  font-size: 15px;
  line-height: 1.4;
}

.option-description {
  color: #64748b;
  font-size: 13px;
  line-height: 1.4;
}

/* User/Contact Selection */
.user-selection,
.role-selection,
.contact-selection,
.combined-selection {
  display: none;
  margin-top: 28px;
}

.user-selection.active,
.role-selection.active {
  display: block;
}

.selection-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.user-actions,
.contact-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}

.btn-link {
  background: none;
  border: none;
  color: #25a3d8;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  font-size: 12px;
}

.btn-link:hover {
  color: #1e8bb8;
}

.selected-count {
  color: #6b7280;
  font-weight: 500;
}

.user-search-container,
.contact-search-container {
  margin-bottom: 16px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: #25a3d8;
  box-shadow: 0 0 0 3px rgba(37, 163, 216, 0.1);
}

.form-label {
  display: block;
  margin-bottom: 12px;
  font-weight: 600;
  color: #374151;
  font-size: 15px;
}

.user-list,
.contact-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: white;
  margin-bottom: 12px;
}

.user-item,
.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  transition: background-color 0.2s ease;
}

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

.user-item:hover,
.contact-item:hover {
  background-color: #f8fafc;
}

.user-item.hidden {
  display: none;
}

.user-item-label,
.contact-item-label {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  cursor: pointer;
}

.user-avatar,
.contact-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #25a3d8, #1e8bb8);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
  flex-shrink: 0;
}

.user-details,
.contact-details {
  flex: 1;
  min-width: 0;
}

.user-name,
.contact-email {
  font-weight: 600;
  color: #1e293b;
  font-size: 14px;
  margin-bottom: 2px;
}

.user-email {
  color: #64748b;
  font-size: 12px;
  margin-bottom: 2px;
}

.user-role {
  color: #64748b;
  font-size: 12px;
  margin-bottom: 2px;
}

.user-company {
  color: #9ca3af;
  font-size: 11px;
}

.contact-name {
  color: #64748b;
  font-size: 12px;
  margin-bottom: 2px;
}

.contact-source {
  margin-top: 4px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.badge-secondary {
  background-color: #e2e8f0;
  color: #475569;
}

.no-results {
  display: none;
  padding: 32px 16px;
  text-align: center;
  color: #6b7280;
  font-style: italic;
}

.help-text {
  font-size: 12px;
  color: #6b7280;
  margin-top: 6px;
}

/* Role Selection */
.role-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 4px;
  margin-bottom: 24px;
}

.role-item {
  display: flex;
  align-items: center;
}

.role-item input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
  pointer-events: none;
}

.role-item-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: white;
  border: 1.5px solid #d1d5db;
  border-radius: 10px;
  cursor: pointer;
  flex: 1;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.role-item input[type="checkbox"]:checked + .role-item-label {
  border-color: #25a3d8;
  background: #f0f9ff;
  box-shadow: 0 0 0 3px rgba(37, 163, 216, 0.1);
}

.role-item:hover .role-item-label {
  border-color: #cbd5e1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transform: translateY(-1px);
}

.role-info {
  flex: 1;
}

.role-name {
  font-weight: 600;
  color: #1e293b;
  font-size: 14px;
  margin-bottom: 4px;
  line-height: 1.3;
}

.role-count {
  color: #64748b;
  font-size: 12px;
  line-height: 1.3;
}

/* Filter Bar */
.filter-bar {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 24px;
}

.filter-bar-content {
  display: flex;
  gap: 24px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 200px;
}

.filter-label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin: 0;
}

.filter-select {
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: white;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  box-sizing: border-box;
}

.filter-select:focus {
  outline: none;
  border-color: #25a3d8;
  box-shadow: 0 0 0 3px rgba(37, 163, 216, 0.1);
}

/* Recipient Preview */
.recipient-preview {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 24px;
  margin-top: 32px;
  margin-bottom: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.recipient-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e5e7eb;
}

.recipient-preview-title {
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}

.recipient-count-badge {
  background: #25a3d8;
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.recipient-preview-content {
  max-height: 400px;
  overflow-y: auto;
}

.recipient-preview-loading {
  text-align: center;
  padding: 40px;
  color: #64748b;
  font-size: 14px;
}

.recipient-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.recipient-preview-item {
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.recipient-preview-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.recipient-preview-name {
  font-weight: 600;
  color: #1e293b;
  font-size: 14px;
  margin-bottom: 4px;
}

.recipient-preview-email {
  color: #64748b;
  font-size: 13px;
  margin-bottom: 6px;
}

.recipient-preview-role,
.recipient-preview-location {
  display: inline-block;
  background: #e0f2fe;
  color: #0369a1;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  margin-right: 6px;
  margin-top: 4px;
}

/* Schedule Send Options */
.send-options {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: 0;
  flex-shrink: 1;
}

.schedule-toggle-container {
  display: flex;
  align-items: center;
  padding: 0 16px;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  transition: all 0.2s ease;
  height: 44px;
}

.schedule-toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  user-select: none;
  margin: 0;
}

.schedule-toggle-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  margin: 0;
  flex-shrink: 0;
  position: relative;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: white;
  border: 2px solid #d1d5db;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.schedule-toggle-label input[type="checkbox"]:checked {
  background-color: #25a3d8;
  border-color: #25a3d8;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='white' d='M8.5 2.5L4 7L1.5 4.5L2.5 3.5L4 5L7.5 1.5Z'/%3E%3C/svg%3E");
  background-size: 10px 10px;
  background-position: center;
  background-repeat: no-repeat;
}

.schedule-options {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: #f8fafc;
  border: none;
  border-radius: 8px;
  flex-wrap: nowrap;
  flex-shrink: 0;
  height: 44px;
  box-sizing: border-box;
}

.schedule-input-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  white-space: nowrap;
}

.schedule-label {
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  white-space: nowrap;
  flex-shrink: 0;
}

.schedule-input {
  padding: 0 8px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 12px;
  font-family: inherit;
  background: white;
  height: 36px;
  min-width: 140px;
  width: auto;
  max-width: 140px;
  box-sizing: border-box;
  color: #1e293b;
  transition: all 0.2s ease;
  line-height: 1;
}

.schedule-input:focus {
  outline: none;
  border-color: #25a3d8;
  box-shadow: 0 0 0 2px rgba(37, 163, 216, 0.1);
}

/* Button Styles */
.btn-primary,
button.btn-primary,
#next-to-review {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: #25a3d8;
  color: white;
  text-decoration: none;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  transition-property: background-color, color, border-color, box-shadow;
  min-width: 150px;
  width: auto;
  height: 44px;
  box-sizing: border-box;
  transform: none;
  opacity: 1;
}

.btn-primary:hover,
button.btn-primary:hover {
  background: #1e8bb8;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-secondary,
a.btn-secondary,
button.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: #f8fafc;
  color: #374151;
  text-decoration: none;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  transition-property: background-color, color, border-color;
  min-width: 150px;
  width: auto;
  height: 44px;
  box-sizing: border-box;
  transform: none;
  opacity: 1;
}

.btn-secondary:hover,
a.btn-secondary:hover,
button.btn-secondary:hover {
  background: #e5e7eb;
  border-color: #9ca3af;
}

.template-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  transition: none;
  transform: none;
}

.template-action-btn {
  padding: 8px 12px;
  font-size: 13px;
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  transition-property: background-color, color, border-color;
  transform: none;
  opacity: 1;
  width: auto;
  box-sizing: border-box;
}

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

.template-modal-content {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  max-width: 900px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.template-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  border-bottom: 1px solid #e5e7eb;
}

.template-modal-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: #111827;
}

.template-modal-close {
  background: none;
  border: none;
  font-size: 32px;
  color: #6b7280;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.template-modal-close:hover {
  background-color: #f3f4f6;
  color: #111827;
}

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

.template-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.template-grid {
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  max-height: 500px;
  overflow-y: auto;
}

.template-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: #6b7280;
}

.template-card {
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  transition: all 0.2s;
  cursor: pointer;
}

.template-card:hover {
  border-color: #25a3d8;
  box-shadow: 0 4px 6px rgba(37, 163, 216, 0.1);
}

.template-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.template-card-title {
  font-weight: 600;
  color: #111827;
  font-size: 16px;
  margin: 0;
}

.template-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.template-card-btn {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  background: white;
  color: #374151;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.template-card-btn.primary {
  background: linear-gradient(135deg, #25a3d8, #1e8bb8);
  color: white;
  border: none;
}

.template-card-btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 163, 216, 0.3);
}

.template-card-btn:hover {
  background-color: #f9fafb;
  border-color: #9ca3af;
}

.template-card-btn:hover svg {
  transform: scale(1.1);
  transition: transform 0.2s ease;
}

.template-card-btn:not(.primary):not(.danger):hover svg {
  color: #25a3d8;
}

.template-card-btn.danger:hover {
  background-color: #fef2f2;
  border-color: #dc2626;
}

.template-card-btn.danger:hover svg {
  color: #dc2626;
  transform: scale(1.1) rotate(5deg);
  transition: transform 0.2s ease, color 0.2s ease;
}

.template-card-btn svg {
  transition: transform 0.2s ease, color 0.2s ease;
  display: inline-block;
}

.template-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: #6b7280;
}

.template-empty-state svg {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  opacity: 0.3;
}

/* Skeleton Loading */
.email-builder-skeleton {
  animation: fadeIn 0.3s ease-in;
  padding: 24px;
}

.email-builder-skeleton.hidden {
  display: none !important;
}

.email-builder-content {
  animation: fadeIn 0.5s ease-in;
}

.email-builder-content.hidden {
  display: none !important;
}

#email-builder-content {
  display: block;
}

#email-builder-skeleton {
  display: none;
}

#email-builder-skeleton.show-skeleton {
  display: block;
}

#email-builder-content.hide-content {
  display: none !important;
}

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

.skeleton-line {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
  margin-bottom: 12px;
}

@keyframes skeletonShimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.skeleton-email-subject {
  margin-bottom: 24px;
}

.skeleton-subject-input {
  width: 100%;
  height: 48px;
  border-radius: 8px;
}

.skeleton-email-editor {
  background: #ffffff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
  min-height: 500px;
}

.skeleton-editor-toolbar {
  width: 100%;
  height: 40px;
  margin-bottom: 24px;
}

.skeleton-editor-content {
  width: 100%;
  height: 24px;
  margin-bottom: 16px;
}

.skeleton-editor-content-short {
  width: 60%;
  height: 24px;
}

/* Responsive */
@media (max-width: 1024px) {
  .review-container {
    grid-template-columns: 1fr;
  }

  .recipients-panel {
    max-height: none;
  }
}

@media (max-width: 1200px) {
  .progress-actions {
    gap: 6px;
  }
  
  .progress-actions .btn-secondary,
  .progress-actions .btn-primary {
    padding: 8px 12px;
    font-size: 13px;
    white-space: nowrap;
  }
}

@media (max-width: 900px) {
  #next-to-review .btn-text-full {
    display: none;
  }
  
  #next-to-review .btn-text-short {
    display: inline;
  }
  
  .template-action-btn {
    padding: 8px 8px;
    font-size: 11px;
  }
}

@media (max-width: 768px) {
  .template-action-btn {
    padding: 6px 8px;
    font-size: 10px;
  }
}

/* Navbar styles */
.navbar {
  background: transparent;
  padding: 15px 0;
  transition: all 0.3s ease;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

.navbar-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.brand-text {
  font-size: 1.4rem;
  font-weight: 600;
  color: white;
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-logo {
  height: 40px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
}

.portal-button {
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  background: linear-gradient(135deg, #25A3D8, #1e90ff);
  color: white;
  border-radius: 20px;
  text-decoration: none;
  transition: all 0.3s ease;
  border: none;
  margin-left: 8px;
}

.portal-button:hover {
  background: linear-gradient(135deg, #1e90ff, #25A3D8);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 163, 216, 0.3);
}

/* Ensure nav-link hover effects take precedence for dropdown toggles */
.nav-link.dropdown-toggle.portal-button {
  background: linear-gradient(135deg, #25A3D8, #1e90ff) !important;
  border: none !important;
  border-radius: 6px !important;
  padding: 8px 16px !important;
  margin-left: 8px !important;
  color: white !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.3s ease !important;
}

.nav-link.dropdown-toggle.portal-button:hover {
  background: linear-gradient(135deg, #1e90ff, #25A3D8) !important;
  color: white !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(37, 163, 216, 0.3) !important;
}

/* Override inline styles from view files with maximum specificity */
.navbar-nav .nav-link.dropdown-toggle.portal-button:hover,
.navbar .nav-link.dropdown-toggle.portal-button:hover,
body .nav-link.dropdown-toggle.portal-button:hover {
  background: linear-gradient(135deg, #1e90ff, #25A3D8) !important;
  color: white !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(37, 163, 216, 0.3) !important;
  border: none !important;
  border-radius: 6px !important;
}

/* Ensure navbar has proper z-index */
.navbar {
  z-index: 1100;
}

/* Additional fixes for dropdown clickability */
.nav-item.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 1100;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  border: none;
  padding: 8px 0;
  min-width: 200px;
  margin-top: 8px;
}

.dropdown-item {
  padding: 12px 20px;
  color: #374151;
  text-decoration: none;
  display: block;
  transition: background-color 0.2s ease;
}

.dropdown-item:hover {
  background-color: #f3f4f6;
  color: #1f2937;
}

.dropdown-divider {
  height: 1px;
  background-color: #e5e7eb;
  margin: 8px 0;
}

/* Ensure no other elements block the dropdown */
.navbar-nav {
  position: relative;
  z-index: 1100;
}

.navbar-collapse {
  position: relative;
  z-index: 1100;
}

/* Completely isolate dropdown from Turbo interference */
.nav-item.dropdown[data-turbo="false"] {
  position: relative;
  z-index: 1100;
}

/* Navbar toggler styles */
.navbar-toggler {
  border: none;
  padding: 4px 8px; 
  background: rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  display: none;
}

.navbar-toggler:focus {
  box-shadow: none;
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
  width: 20px;
  height: 20px;
}

/* Navbar collapse styling */
.navbar-collapse {
  background: transparent;
}

/* Desktop: hide toggler, show nav items */
@media (min-width: 992px) {
  .navbar-toggler {
    display: none !important;
  }
  
  .navbar-collapse {
    display: block !important;
    margin-top: 0;
    background: transparent !important;
    border-radius: 0;
    padding: 0;
    backdrop-filter: none;
    box-shadow: none;
  }
  
  .navbar-nav {
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }
}

/* Mobile navbar styles */
@media (max-width: 991px) {
  /* Make navbar absolute on mobile */
  .navbar {
    position: absolute !important;
    background: transparent !important;
  }

  /* Show hamburger menu on mobile */
  .navbar-toggler {
    display: block !important;
  }

  /* Hide the navbar collapse by default on mobile */
  .navbar-collapse {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 15px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 12px;
    padding: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    min-width: 250px;
    display: none;
  }

  .navbar-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin: 0;
  }
  
  .portal-button {
    width: 100%;
    text-align: center;
    margin: 0;
    padding: 12px 20px;
  }
}
/* Shared Sidebar Navigation Styles */
.sidebar-nav {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
  position: static;
  margin-left: -24px;
}

.sidebar-section {
  margin-bottom: 32px;
}

.sidebar-section:last-child {
  margin-bottom: 0;
}

.sidebar-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  text-decoration: none;
  color: #64748b;
  font-weight: 500;
  transition: all 0.2s;
  margin-bottom: 4px;
}

.sidebar-nav-item:hover {
  background: #f1f5f9;
  color: #25a3d8;
}

.sidebar-nav-item.active {
  background: #25a3d8;
  color: white;
}

.sidebar-nav-item i {
  width: 20px;
  text-align: center;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
  .sidebar-nav {
    order: -1;
    background: #f8fafc;
    border-radius: 12px;
    padding: 16px;
    margin: 0 0 24px 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  }
  
  .sidebar-section {
    margin-bottom: 0;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
  }
  
  .sidebar-title {
    font-size: 0.875rem;
    margin-bottom: 12px;
    color: #64748b;
    text-align: center;
  }
  
  .sidebar-nav-item {
    padding: 12px 16px;
    font-size: 0.95rem;
    border-radius: 8px;
    margin-bottom: 4px;
    display: block;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
    max-width: fit-content;
  }
  
  .sidebar-nav-item i {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .sidebar-nav {
    padding: 12px;
  }
  
  .sidebar-nav-item {
    padding: 10px 14px;
    font-size: 0.9rem;
  }
}
/* Shared User Dashboard Sidebar Styles - Consistent across all pages */
.sidebar-nav {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
  position: static;
  margin-left: -24px;
}

.sidebar-section {
  margin-bottom: 32px;
}

.sidebar-section:last-child {
  margin-bottom: 0;
}

.sidebar-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  text-decoration: none;
  color: #64748b;
  font-weight: 500;
  transition: all 0.2s;
  margin-bottom: 4px;
}

.sidebar-nav-item:hover {
  background: #f1f5f9;
  color: #25a3d8;
}

.sidebar-nav-item.active {
  background: #25a3d8;
  color: white;
}

.sidebar-nav-item i {
  width: 20px;
  text-align: center;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
  .sidebar-nav {
    order: -1;
    background: #f8fafc;
    border-radius: 12px;
    padding: 16px;
    margin: 0 0 24px 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  }
  
  .sidebar-section {
    margin-bottom: 0;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
  }
  
  .sidebar-title {
    font-size: 0.875rem;
    margin-bottom: 12px;
    color: #64748b;
    text-align: center;
  }
  
  .sidebar-nav-item {
    padding: 12px 16px;
    font-size: 0.95rem;
    border-radius: 8px;
    margin-bottom: 4px;
    display: block;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
    max-width: fit-content;
  }
  
  .sidebar-nav-item i {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .sidebar-nav {
    padding: 12px;
  }
  
  .sidebar-nav-item {
    padding: 10px 14px;
    font-size: 0.9rem;
  }
}
/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *


 */
