/* =====================================================
   TresorAI Bulk Mail Sender - React-Matched Dark Theme
   Exact Port from React App.css
   ===================================================== */

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

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

:root {
  /* Colors - Exact match from React */
  --bg-primary: #0a0e1a;
  --bg-secondary: #121827;
  --bg-tertiary: #1a2332;
  --bg-hover: #1f2937;
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --border-color: #1f2937;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-green: #10b981;
  --accent-orange: #f59e0b;
  --accent-red: #ef4444;
  
  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  
  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ====== LOGIN/REGISTER PAGES ====== */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-tertiary) 100%);
  padding: var(--spacing-xl);
}

.login-box {
  width: 100%;
  max-width: 450px;
}

.login-header {
  text-align: center;
  margin-bottom: var(--spacing-xl);
}

.login-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--spacing-md);
  color: var(--accent-blue);
}

.login-logo svg {
  width: 100%;
  height: 100%;
}

.login-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: var(--spacing-sm);
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
}

.login-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: var(--spacing-xl);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.input-with-icon {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.input-with-icon input {
  padding-left: 40px;
}

input,
textarea,
select {
  width: 100%;
  padding: 0.75rem 1rem;
  min-height: 45px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9375rem;
  transition: all 0.2s;
}

textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}

input[type="checkbox"],
input[type="radio"] {
  min-height: auto;
  width: auto;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

button,
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-blue);
  color: white;
  width: 100%;
}

.btn-primary:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

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

.btn-icon {
  width: 18px;
  height: 18px;
}

.login-footer {
  text-align: center;
  margin-top: var(--spacing-lg);
  color: var(--text-secondary);
}

.login-footer a {
  color: var(--accent-blue);
  text-decoration: none;
  font-weight: 600;
}

.login-footer a:hover {
  text-decoration: underline;
}

.link-button {
  background: none;
  border: none;
  color: var(--accent-blue);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  padding: 0;
  font-size: inherit;
}

.link-button:hover {
  text-decoration: underline;
}

/* ====== DASHBOARD LAYOUT ====== */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-header {
  padding: var(--spacing-xl) var(--spacing-lg);
  border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.sidebar-logo svg {
  width: 32px;
  height: 32px;
  color: var(--accent-blue);
}

.sidebar-nav {
  flex: 1;
  padding: var(--spacing-lg) 0;
}

.nav-section {
  margin-bottom: var(--spacing-lg);
}

.nav-section-title {
  padding: 0 var(--spacing-lg);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: var(--spacing-sm);
}

.nav-section {
  margin-bottom: var(--spacing-lg);
}

.nav-section-title {
  padding: 0 var(--spacing-lg);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: var(--spacing-sm);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: 0.75rem var(--spacing-lg);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--bg-tertiary);
  color: var(--accent-blue);
  border-left-color: var(--accent-blue);
}

.nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  width: 100%;
  padding: 0.75rem var(--spacing-lg);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: var(--radius-md);
}

.logout-btn:hover {
  background: var(--bg-tertiary);
  color: var(--accent-red);
}

.logout-btn svg {
  width: 20px;
  height: 20px;
}

.sidebar-footer {
  padding: var(--spacing-lg);
  border-top: 1px solid var(--border-color);
}

/* Main Content */
.dashboard-main {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
}

.dashboard-topbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: var(--spacing-lg) var(--spacing-xl);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar-left {
  display: flex;
  gap: var(--spacing-lg);
}

.status-indicators {
  display: flex;
  gap: var(--spacing-lg);
}

.status-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-dot.online {
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.topbar-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.topbar-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.topbar-btn svg {
  width: 20px;
  height: 20px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

.user-icon {
  width: 32px;
  height: 32px;
  color: var(--text-secondary);
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.user-email {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.dashboard-content {
  flex: 1;
  padding: var(--spacing-xl);
  overflow-y: auto;
}

/* ====== PAGE LAYOUT ====== */
.page-container {
  max-width: 1400px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-xl);
}

.page-title {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text-primary);
}

.page-description {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-top: var(--spacing-xs);
}

/* ====== CARDS ====== */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: var(--spacing-xs);
}

.card-content {
  padding: var(--spacing-lg);
}

/* ====== STATS GRID ====== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  transition: all 0.2s;
}

.stat-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-content {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
  padding: 0;
}

.stat-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.stat-icon.blue {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-blue);
}

.stat-icon.green {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-green);
}

.stat-icon.purple {
  background: rgba(139, 92, 246, 0.1);
  color: var(--accent-purple);
}

.stat-icon.orange {
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent-orange);
}

.stat-icon svg {
  width: 24px;
  height: 24px;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-xs);
}

.stat-value {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ====== AI SECTION ====== */
.ai-section {
  margin-top: var(--spacing-xl);
}

.ai-chat-card {
  max-width: 900px;
}

.ai-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.ai-icon {
  width: 32px;
  height: 32px;
  color: var(--accent-purple);
}

.ai-chat {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.quick-actions h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-md);
}

.action-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.action-chip {
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.action-chip:hover {
  background: var(--bg-hover);
  border-color: var(--accent-blue);
  color: var(--text-primary);
}

.action-chip svg {
  width: 16px;
  height: 16px;
}

.ai-input-section {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.ai-input-section textarea {
  resize: vertical;
  min-height: 100px;
}

.ai-response {
  padding: var(--spacing-lg);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.response-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-weight: 600;
  color: var(--accent-purple);
  margin-bottom: var(--spacing-md);
}

.response-header svg {
  width: 20px;
  height: 20px;
}

.ai-response p {
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-wrap;
}

/* ====== VALIDATOR & CHECKER FORMS ====== */
.validator-form,
.smtp-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.validator-input {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.validator-input-field {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.validator-input .input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
}

.validator-input input {
  flex: 1;
  width: 100%;
  padding-left: 40px;
  min-height: 50px;
  font-size: 1rem;
}

.validator-input-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-lg);
}

.switch-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Results Display */
.validation-result,
.checker-result {
  margin-top: var(--spacing-lg);
  padding: var(--spacing-lg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.result-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--spacing-md);
}

.result-header.success {
  color: var(--accent-green);
}

.result-header.error {
  color: var(--accent-red);
}

.result-header svg {
  width: 24px;
  height: 24px;
}

.result-reason {
  color: var(--text-secondary);
  margin-bottom: var(--spacing-md);
}

.mx-records {
  margin-top: var(--spacing-md);
}

.mx-records h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-sm);
}

.mx-records ul {
  list-style: none;
  padding: 0;
}

.mx-records li {
  padding: var(--spacing-sm);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  margin-bottom: var(--spacing-xs);
}

.mx-records code {
  color: var(--accent-blue);
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
}

.checker-result {
  display: flex;
  align-items: start;
  gap: var(--spacing-md);
}

.checker-result.success {
  border-color: var(--accent-green);
  background: rgba(16, 185, 129, 0.05);
}

.checker-result.error {
  border-color: var(--accent-red);
  background: rgba(239, 68, 68, 0.05);
}

.checker-result svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.checker-result.success svg {
  color: var(--accent-green);
}

.checker-result.error svg {
  color: var(--accent-red);
}

.checker-result h4 {
  margin-bottom: var(--spacing-xs);
}

.checker-result p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

/* ====== BADGES ====== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--spacing-xs) var(--spacing-md);
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge.secondary {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.badge.primary {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-blue);
}

.badge.success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-green);
}

.badge.warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent-orange);
}

.badge.danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-red);
}

/* ====== ALERTS & TOASTS ====== */
.alert {
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-md);
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.alert.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--accent-green);
}

.alert.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
}

.alert.warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: var(--accent-orange);
}

.alert.info {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: var(--accent-blue);
}

/* ====== LOADING ====== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-xl);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ====== UTILITY CLASSES ====== */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.text-muted {
  color: var(--text-muted);
}

.mt-1 {
  margin-top: var(--spacing-sm);
}
.mt-2 {
  margin-top: var(--spacing-md);
}
.mt-3 {
  margin-top: var(--spacing-lg);
}
.mt-4 {
  margin-top: var(--spacing-xl);
}

.mb-1 {
  margin-bottom: var(--spacing-sm);
}
.mb-2 {
  margin-bottom: var(--spacing-md);
}
.mb-3 {
  margin-bottom: var(--spacing-lg);
}
.mb-4 {
  margin-bottom: var(--spacing-xl);
}

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .dashboard-main {
    margin-left: 0;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .dashboard-topbar {
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-md);
  }
}

/* ====== SCROLLBAR ====== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--bg-hover);
}

/* ====== SELECTION ====== */
::selection {
  background: var(--accent-blue);
  color: white;
}

/* ====== DOMAIN HEALTH & CHECK ITEMS ====== */
.domain-checks {
  margin-top: var(--spacing-lg);
}

.check-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--border-color);
}

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

.check-label {
  font-weight: 600;
  color: var(--text-primary);
}

/* ====== TABLE SPECIFIC STYLES ====== */
#proxies-tbody tr,
#recipients-tbody tr,
#campaigns-tbody tr,
#smtp-configs-tbody tr,
#sequences-tbody tr,
#ab-tests-tbody tr {
  transition: all 0.2s;
}

/* ====== FILE UPLOAD STYLING ====== */
.file-upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--spacing-xl);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.file-upload-zone:hover {
  border-color: var(--accent-blue);
  background: var(--bg-tertiary);
}

.file-upload-zone input[type="file"] {
  display: none;
}

/* File Upload Styles */
.file-upload {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.file-upload input[type="file"] {
    display: none;
}

/* Template Rotation List Styles */
.template-rotation-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.rotation-template-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.rotation-template-item:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.1);
}

.drag-handle {
    font-size: 1.25rem;
    cursor: grab;
    color: var(--text-muted);
    user-select: none;
}

.drag-handle:active {
    cursor: grabbing;
}

.template-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.template-info strong {
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.template-info .text-muted {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
}

.btn-danger {
    background: var(--accent-red);
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* ====== SWITCH/TOGGLE ====== */
input[type="checkbox"] {
  width: auto;
  height: auto;
}

/* ====== TINYMCE OVERRIDE ====== */
.tox-tinymce {
  border: 1px solid var(--border-color) !important;
}

.tox .tox-toolbar,
.tox .tox-toolbar__overflow,
.tox .tox-toolbar__primary {
  background: var(--bg-tertiary) !important;
}


/* ====== FLOATING QUICK SEND BUTTON ====== */
.floating-quick-send {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: white;
  border: none;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.floating-quick-send:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 24px rgba(59, 130, 246, 0.4);
}

.floating-quick-send:active {
  transform: scale(0.95);
}

.floating-quick-send svg {
  width: 24px;
  height: 24px;
}

.floating-quick-send-tooltip {
  position: absolute;
  right: 70px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  white-space: nowrap;
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

.floating-quick-send:hover .floating-quick-send-tooltip {
  opacity: 1;
}

/* Responsive - hide on small screens */
@media (max-width: 768px) {
  .floating-quick-send {
    bottom: 1rem;
    right: 1rem;
    width: 56px;
    height: 56px;
  }
  
  .floating-quick-send svg {
    width: 20px;
    height: 20px;
  }
}

/* ====== TEMPLATE LIBRARY MODAL ====== */
/* Base Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 2rem;
}

.modal.show {
  display: flex !important;
}

.modal-content {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color);
}

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

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}

.modal-close {
  cursor: pointer;
  font-size: 1.75rem;
  color: var(--text-muted);
  line-height: 1;
  padding: 0.25rem 0.5rem;
  border: none;
  background: transparent;
  transition: color 0.2s;
}

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

/* Template Library Specific */
.template-library-modal .modal-content {
  display: flex;
  flex-direction: column;
}

.template-library-filters {
  flex-shrink: 0;
}

.filter-btn {
  padding: 0.5rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent-blue);
}

.filter-btn.active {
  background: var(--accent-blue);
  color: white;
  border-color: var(--accent-blue);
}

.template-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  padding: 0.5rem;
}

.template-card {
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
}

.template-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.template-card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 0.75rem;
  gap: 0.5rem;
}

.template-card-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  flex: 1;
}

.template-category-badge {
  padding: 0.25rem 0.5rem;
  background: var(--accent-purple);
  color: white;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.template-card-body {
  flex: 1;
  margin-bottom: 0.75rem;
}

.template-card-subject {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.template-card-description {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.template-card-footer {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.template-card-stats {
  margin-top: 0.5rem;
  text-align: center;
}

.template-card-stats small {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* Loading Spinner */
.loading-spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 1rem;
  border: 4px solid var(--border-color);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
  .modal {
    padding: 1rem;
  }
  
  .modal-content {
    padding: 1.5rem;
    max-width: 100%;
  }
  
  .template-library-grid {
    grid-template-columns: 1fr;
  }
  
  .template-library-filters {
    overflow-x: auto;
  }
  
  .template-library-filters > div {
    white-space: nowrap;
  }
}

/* Preview Modal Specific Styles */
.preview-content {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  background: white;
  color: #000;
  min-height: 200px;
  max-height: 400px;
  overflow-y: auto;
  font-family: Arial, sans-serif;
  line-height: 1.6;
}

.preview-content h1, 
.preview-content h2,
.preview-content h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  color: #000;
}

.preview-content p {
  margin-bottom: 1rem;
}

.preview-content ul, 
.preview-content ol {
  margin-bottom: 1rem;
  padding-left: 2rem;
}

