/* ==========================================================================
   General Body & Typography
   ========================================================================== */

body {
  font-family: Arial, sans-serif;
  margin: 0;
  background-color: #f4f4f4;
  /* Adjust for fixed header/footer */
  padding-top: 100px;
  padding-bottom: 60px;
}

.container {
  width: 90%;
  max-width: 1100px; /* A standard max-width for content */
  margin: 20px auto; /* Adds space at the top/bottom and centers the container */
  padding: 0 20px;   /* Adds space on the left and right */
  box-sizing: border-box;
}

h1,
h2 {
  color: #333;
}

/* ==========================================================================  
   Header & Navigation (Updated for visual polish and consistency)  
   ========================================================================== */

header {
  background-color: #1e2e3e; /* Dark blue to match your logo theme */
  color: white;
  padding: 12px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  
}
header nav a {
  color: white;
  text-decoration: none;
  padding: 6px 12px;
  font-weight: 500;
  border-radius: 4px;
  transition: background-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

header nav a:hover {
  background-color: #3fcf8e1a; /* Soft hover green overlay */
  color: #3fcf8e;
}

/* Right-aligned actions (Login, Logout, etc.) */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

/* Separator and Welcome Text */
header nav .nav-separator {
  margin-left: 16px;
  margin-right: 6px;
  color: #aaa;
}

header nav .welcome-text-group {
  margin-right: 16px;
  font-style: italic;
  color: #ccc;
  white-space: nowrap;
}

/* Button Styles */
.btn-outline-white {
  border: 1px solid white;
  color: white;
  padding: 6px 14px;
  background: transparent;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.btn-outline-white:hover {
  background-color: white;
  color: #1e2e3e;
}

.btn-primary-solid {
  background-color: #3fcf8e;
  color: #1e2e3e;
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  transition: background-color 0.3s ease;
}

.btn-primary-solid:hover {
  background-color: #34b17a;
}

/* Responsive Behavior (basic mobile view handling) */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 20px;
  }

  header nav {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 10px;
    margin-top: 10px;
  }

  .header-actions {
    flex-direction: column;
    align-items: flex-start;
    margin-left: 0;
    margin-top: 10px;
  }

  header nav .nav-separator,
  header nav .welcome-text-group {
    display: none;
  }
}
footer {
  background-color: #2c3e50;
  color: white;
  text-align: center;
  padding: 15px 0;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  box-sizing: border-box;
}

.logo-img {
  height: 80px; /* Adjust height as needed */
  width: auto; /* Maintain aspect ratio */
}
/* ==========================================================================  
   Admin Header Styling  
   ========================================================================== */

.admin-header {
  background-color: #1e2e3e;
  color: white;
  padding: 12px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.admin-header .logo-img {
  height: 50px;
  width: auto;
}

/* Navigation */
.admin-header nav {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.admin-header nav a {
  color: white;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 4px;
  transition: background-color 0.2s ease, color 0.2s ease;
  font-weight: 500;
}

.admin-header nav a:hover {
  background-color: #3fcf8e1a;
  color: #3fcf8e;
}

/* Separator and welcome */
.admin-header .nav-separator {
  color: #888;
  margin: 0 8px;
}

.admin-header .welcome-text-group {
  color: #ccc;
  font-style: italic;
  white-space: nowrap;
}

/* Logout Button */
.admin-header .btn-outline-white {
  border: 1px solid white;
  color: white;
  background: transparent;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.admin-header .btn-outline-white:hover {
  background-color: white;
  color: #1e2e3e;
}

/* Responsive (optional) */
@media (max-width: 768px) {
  .admin-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 20px;
  }

  .admin-header nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    margin-top: 10px;
  }
}

/* ==========================================================================  
   Site Footer  
   ========================================================================== */

.site-footer {
  background-color: #1e2e3e;
  color: #ccc;
  text-align: center;
  padding: 16px 20px;
  font-size: 0.9rem;
  border-top: 1px solid #2f4154;
  position: fixed;
  bottom: 0;
  width: 100%;
  box-sizing: border-box;
  z-index: 900;
}

.site-footer a {
  color: #3fcf8e;
  text-decoration: none;
  margin: 0 8px;
  transition: color 0.2s ease;
}

.site-footer a:hover {
  color: #5fe4a6; /* Lighter accent on hover */
}

@media (max-width: 600px) {
  .site-footer {
    font-size: 0.8rem;
    padding: 12px 10px;
  }

  .site-footer a {
    display: inline-block;
    margin: 4px;
  }
}


/* ==========================================================================
   Forms & Buttons
   ========================================================================== */

/* Base button styling for all buttons with .btn class or standard <button> tags */
.btn,
button {
  padding: 10px 15px; /* Default padding for buttons */
  border-radius: 4px; /* Rounded corners */
  cursor: pointer; /* Indicates interactivity */
  font-size: 0.95em; /* Default font size */
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease; /* Smooth transitions for hover effects */
  display: inline-flex; /* Allows content to be centered and for icon usage */
  align-items: center; /* Vertically center content */
  justify-content: center; /* Horizontally center content */
  text-decoration: none; /* Remove underline for anchor tags acting as buttons */
  box-sizing: border-box; /* Include padding and border in the element's total width and height */
  border: 1px solid transparent; /* Default transparent border to prevent "jumping" on hover */
  -webkit-appearance: none; /* Reset default button styles for cross-browser consistency */
  -moz-appearance: none;
  appearance: none;
  font-family: Arial, sans-serif; /* Explicitly set font-family to inherit from body or a common web-safe font */
  vertical-align: middle; /* Helps align with text/other inline elements */
}

/* Primary Button Style (e.g., "Create New Notification", "Configure Connections") */
.btn-primary {
  background-color: #4CAF50; /* Green background */
  color: white; /* White text */
  border-color: #4CAF50; /* Matching border color */
}

.btn-primary:hover {
  background-color: #45a049; /* Darker green on hover */
  border-color: #45a049;
}

/* Info Button Style (e.g., "Test") - Adjusted color */
.btn-info {
  background-color: #007bff; /* A more standard blue, like Bootstrap's info blue */
  color: white; /* White text */
  border-color: #007bff; /* Matching border color */
}

.btn-info:hover {
  background-color: #0056b3; /* Darker blue on hover */
  border-color: #0056b3;
}

/* Secondary Button Style (e.g., "Edit") */
.btn-secondary {
  background-color: #1e2e3e; 
  color: white; /* White text */
  border-color: #1e2e3e; /* Matching border color */
}

.btn-secondary:hover {
  background-color: #5a6268; /* Darker gray on hover */
  border-color: #5a6268;
}

/* Danger Button Style (e.g., "Delete") */
.btn-danger {
  background-color: #e74c3c; /* Red background */
  color: white; /* White text */
  border-color: #e74c3c; /* Matching border color */
}

.btn-danger:hover {
  background-color: #c0392b; /* Darker red on hover */
  border-color: #c0392b;
}

/* Warning Button Style (e.g., "Reassign" - if used) */
.btn-warning {
  background-color: #ffc107; /* Yellow background */
  color: #212529; /* Dark text for contrast */
  border-color: #ffc107; /* Matching border color */
}

.btn-warning:hover {
  background-color: #e0a800; /* Darker yellow on hover */
  border-color: #e0a800;
}

/* Modifier for small buttons (e.g., in tables) */
.btn-sm {
  padding: 6px 12px;
  font-size: 0.85em;
  min-width: 70px;
}

.action-buttons .btn {
  min-width: 70px;
}

/* Progress bar styles for usage indicators */
.usage-row {
  margin-top: 8px;
}
.usage-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  color: #333;
  margin-bottom: 6px;
}
.progress {
  background: #e9ecef;
  border-radius: 8px;
  height: 12px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #3fcf8e 0%, #34b17a 100%);
  width: 0%;
  transition: width 0.6s ease;
}
.progress-bar.warn {
  background: linear-gradient(90deg, #ffc107 0%, #ffb020 100%);
}
.progress-bar.danger {
  background: linear-gradient(90deg, #ff6b6b 0%, #ff3b3b 100%);
}

/* Admin usage-specific styles moved to public/admin.css */

/* Utility classes */
.hidden { display: none !important; }
.mt-0 { margin-top: 0; }
/* Spacing scale: increment (approx): 1 = 4px, 2 = 8px, 3 = 12px, 4 = 16px, 5 = 20px */
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }
.mt-20 { margin-top: 20px; } /* kept for legacy larger spacing */
.mt-30 { margin-top: 30px; }
.mt-40 { margin-top: 40px; }
.mb-4 { margin-bottom: 1rem; }
.ml-10 { margin-left: 10px; }

/* Onboarding page styles moved from inline */
.onboarding-container { max-width: 700px; margin: 40px auto; }
.option-card { background: #fff; padding: 25px; border-radius: 5px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); margin-bottom: 20px; }
.tier-selection { display: flex; gap: 15px; margin-top: 15px; }
.tier-option { border: 2px solid #ddd; padding: 15px; border-radius: 5px; cursor: pointer; text-align: center; flex-grow: 1; }
.tier-option:hover { border-color: #4caf50; }
.tier-option.selected { border-color: #4caf50; background-color: #e8f5e9; }
.tier-option h4 { margin: 0 0 10px 0; }

/* Add-connection page styles moved from inline */
.status-pill { display: inline-block; padding: 0.35rem 0.75rem; font-weight: bold; border-radius: 1rem; border: 1px solid; font-size: 0.95rem; }
.status-pill.connected { color: #198754; background-color: #e6f4ea; border-color: #198754; }
.status-pill.disconnected { color: #dc3545; background-color: #fbeaea; border-color: #dc3545; }
.note { font-size: 0.9rem; color: #6c757d; }

/* Profile page styles moved from inline */
.tier-card { background: #fff; padding: 20px; border-radius: 5px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.tier-name { font-size: 1.5em; font-weight: bold; color: #4caf50; }
.tier-features { list-style: '✓'; padding-left: 20px; }
.tier-features li { margin-bottom: 8px; }

/* ==========================================================================
   Profile Page Enhancements
   - Make profile content visually match other site cards and spacing
  ========================================================================== */
.content-card { background: #fff; padding: 22px; border-radius: 8px; box-shadow: 0 6px 18px rgba(17,24,39,0.06); }
.content-card h3 { margin-top: 0; color: #1e2e3e; font-size: 1.1rem; }
.page-title { font-size: 2rem; color: #1e2e3e; margin-bottom: 8px; }
.profile-row { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.profile-row p { margin: 0; }
.profile-label { min-width: 160px; color: #555; font-weight: 600; }
.status-pill { display: inline-block; padding: 6px 10px; border-radius: 999px; font-weight: 600; }
.status-pill.connected { background: #e6f4ea; color: #198754; border: 1px solid #198754; }
.status-pill.disconnected { background: #fbeaea; color: #dc3545; border: 1px solid #dc3545; }

/* Danger panel for destructive actions */
.danger-panel { background: #fff6f6; border-left: 4px solid #e74c3c; padding: 16px; border-radius: 6px; }
.danger-panel p { margin: 0 0 10px 0; }

/* Make inputs responsive and consistent across pages */
input, select, textarea { width: 100%; max-width: 420px; }
@media (max-width: 640px) {
  .profile-label { min-width: 120px; }
  .content-card { padding: 16px; }
}

/* Small utilities */
.text-danger { color: #dc3545; }
.text-muted { color: #6c757d; }
.my-20 { margin: 20px 0; }
.pt-20 { padding-top: 20px; }
.border-top { border-top: 1px solid #eee; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.mr-10 { margin-right: 10px; }
.list-unstyled { list-style: none; padding: 0; }
.invite-item { display: flex; justify-content: space-between; align-items: center; padding: 10px; border-bottom: 1px solid #eee; }
.mb-20 { margin-bottom: 20px; }
.mt-20 { margin-top: 20px; }
.mt-40 { margin-top: 40px; }
.mt-30 { margin-top: 30px; }
.mt-0 { margin-top: 0; }
.btn-close-notice { background: transparent; border: none; font-weight: bold; }
.mt-15 { margin-top: 15px; }
.mr-10 { margin-left: 10px; }
.d-flex { display: flex; }
.mt-8 { margin-top: 8px; }
.text-success { color: #0a0; }
.fw-bold { font-weight: bold; }
.gap-10 { gap: 10px; }
.flex-grow-1 { flex-grow: 1; }
.align-items-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.small-text { font-size: 0.9em; }

/* Configure integration small helper styles */
.public-id-box { margin:10px 0; padding:10px; background:#f7f7f7; border:1px solid #eee; border-radius:6px; display:flex; gap:20px; flex-wrap:wrap; }
.mb-20 { margin-bottom: 20px; }


/* Styles for disabled buttons */
.btn[disabled] {
  background-color: #e9ecef; /* Light gray background */
  color: #6c757d; /* Darker gray text */
  cursor: not-allowed; /* Indicates non-interactivity */
  border-color: #ced4da; /* Light gray border */
}

/* Specific styles for Google button */
.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  padding: 0 25px;
  height: 50px;
  border-radius: 8px;
  border: 1px solid #c2c2c2;
  background-color: #ffffff;
  color: #333333;
  font-size: 16px;
  font-weight: 500;
  font-family: 'Roboto', sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.btn-google:hover {
  background-color: #f7f7f7;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.btn-google .google-logo {
  width: 20px;
  height: 20px;
}

/* Specific styles for header action buttons (Login, Start for Free) */
.btn-outline-white {
    background-color: transparent;
    color: white;
    border: 1px solid white;
    padding: 8px 15px;
    border-radius: 4px;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.btn-outline-white:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-primary-solid {
    background-color: #4CAF50; /* Your primary color */
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.btn-primary-solid:hover {
    background-color: #45a049; /* Darker shade of your primary color */
}


/* Input fields */
input {
  padding: 8px;
  width: 300px;
  border: 1px solid #ccc; /* Added border for definition */
  border-radius: 4px; /* Added border-radius */
  box-sizing: border-box; /* Ensures consistent sizing */
}

/* Select dropdowns */
select {
  width: 320px;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box; /* fixed typo */
  background-color: white; /* Ensure background is white */
}

/* Textareas */
textarea {
    width: 100%;
    box-sizing: border-box;
    margin-top: 5px;
    padding: 8px; /* Added padding for better input feel */
    border: 1px solid #ccc; /* Added border for definition */
    border-radius: 4px; /* Added border-radius */
}

input.value-field-input:disabled,
input.value-field-input.disabled-input {
    background: #f5f5f5 !important;
    color: #888 !important;
    opacity: 1 !important; /* Prevent default faded look */
    vertical-align: middle !important;
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    padding-top: 6px !important;
    padding-bottom: 6px !important;
    height: 36px !important; /* Match enabled input height */
    margin: 0 !important;
}

/* Help note to the right of fields (small, muted) */
.help-note {
  margin-left: 12px;
  color: #6c757d;
  font-size: 0.9rem;
  align-self: center;
}

/* Make disabled inputs look clickable for hover explanation */
input[disabled] {
  cursor: not-allowed;
}

/* Info icon style (if later used) */
.info-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e9f7ef;
  color: #198754;
  text-align: center;
  line-height: 18px;
  font-size: 12px;
  margin-left: 8px;
}

/* Readonly inputs: still focusable and clearly not editable */
input[readonly], textarea[readonly] {
  background: #fbfbfb;
  color: #333;
  border: 1px solid #dcdcdc;
}

/* Tooltip for info-icon */
.info-icon { position: relative; cursor: pointer; user-select: none; }
.info-icon .tooltip {
  display: none;
  position: absolute;
  top: 26px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e2e3e;
  color: white;
  padding: 8px 10px;
  border-radius: 6px;
  white-space: nowrap;
  font-size: 0.85rem;
  z-index: 1500;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}
.info-icon:hover .tooltip,
.info-icon:focus .tooltip,
.info-icon:focus-within .tooltip { display: block; }

/* Small arrow under tooltip */
.info-icon .tooltip::after {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid #1e2e3e;
}

/* Form group alignment */
.form-group-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* Large button modifier */
.btn-large {
  padding: 15px 30px;
  font-size: 1.2em;
}

.action-buttons {
  display: flex;
  flex-wrap: nowrap; /* Keep all action buttons on a single line */
  gap: 6px;
  align-items: center;
  overflow-x: visible; /* visible because on small screens we show dropdown instead */
}

/* Ensure the table cell containing actions doesn't force wrapping */
.actions-cell {
  min-width: 160px; /* provide some room by default */
  padding-right: 8px; /* allow a small buffer so buttons don't touch cell edge */
  overflow: visible; /* ensure buttons are visible if slightly larger */
}

/* Dropdown for compact actions (mobile) */
.action-dropdown {
  position: relative;
  display: block; /* show the Actions dropdown on all screens */
}
.action-dropdown-button {
  background: #1e2e3e;
  color: white;
  border: none;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
}
.action-dropdown-menu {
  position: absolute;
  right: 0;
  top: 110%;
  background: white;
  border: 1px solid #ddd;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  border-radius: 6px;
  min-width: 180px;
  z-index: 1200;
  display: none;
}
.action-dropdown-menu.show { display: block; }
.action-dropdown-menu .menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  color: #333;
  text-decoration: none;
}
.action-dropdown-menu .menu-item:hover { background: #f7f7f7; }
.action-dropdown-menu form { margin: 0; }

/* Responsive: hide inline actions and show dropdown on small screens */
@media (max-width: 640px) {
  .action-inline { display: none !important; }
  .action-dropdown { display: block !important; }
}

/* Ensure inline actions are visible by default on larger screens */
.action-inline { display: inline-flex; }

/* Ensure buttons and forms play nicely in flex layout */
.action-buttons > form,
.action-buttons > button,
.action-buttons > span {
  margin: 0;
  padding: 0;
  flex-shrink: 1; /* Allow children to shrink slightly to avoid overflow */
  display: inline-flex;
  align-items: center;
}

/* Use inline-flex for forms to avoid line breaks inside flex container */
.action-buttons form {
  display: inline-flex;
  gap: 6px; /* maintain spacing inside form if multiple elements */
  align-items: center;
}

/* Scope button sizing adjustments to action area only so site-wide buttons aren't affected */
.action-buttons .btn-table {
  min-width: 0; /* allow button to shrink below its content width if necessary */
  padding: 6px 8px; /* slightly tighter to prevent overflow */
}

/* Keep small buttons still readable but compact on narrow screens */
@media (max-width: 640px) {
  .action-buttons .btn-table { padding: 6px 10px; }
}

/* Table-styled buttons with consistent theme look */
.btn-table {
  background-color: transparent;
  border: 1px solid #4CAF50;
  color: #4CAF50;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.85em;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.btn-table:hover {
  background-color: #4CAF50;
  color: white;
}

/* Variants based on action */
.btn-table.info {
  border-color: #007bff;
  color: #007bff;
}
.btn-table.info:hover {
  background-color: #007bff;
  color: white;
}

.btn-table.danger {
  background-color: #e74c3c;
  color: white;
  border: none;
  padding: 6px 12px;
  font-size: 0.85em;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease
}
.btn-table.danger:hover {
  background-color: #bb4336;
  color: white;
}

.btn-table.secondary {
  background-color: #1e2e3e;
  color: white;
  border: none;
  padding: 6px 12px;
  font-size: 0.85em;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease
}
.btn-table.secondary:hover {
  background-color: #6c757d;
  color: white;
}

.btn-table.warning {
  border-color: #ffc107;
  color: #ffc107;
}
.btn-table.warning:hover {
  background-color: #ffc107;
  color: #212529;
}

.btn-table.success {
  background-color: #4CAF50;  /* Matches header button */
  color: white;
  border: none;
  padding: 6px 12px;
  font-size: 0.85em;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-table.success:hover {
  background-color: #45a049;  /* Matches header hover */
}

/* Reassign dropdown styles moved from inline attributes in templates */
.reassign-wrapper { position: relative; }
.reassign-dropdown { display: none; position: absolute; right: 0; top: 36px; background: #fff; border: 1px solid #ddd; box-shadow: 0 6px 18px rgba(0,0,0,0.12); border-radius: 6px; z-index: 1000; min-width: 220px; }
.reassign-header { padding: 8px 12px; font-weight: 600; border-bottom: 1px solid #eee; }
.reassign-list { max-height: 260px; overflow: auto; }
.reassign-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid #fafafa; }
.reassign-item .name { font-size: 14px; }
.reassign-item .email { font-size: 12px; color: #666; }

/* Menu item button used inside dropdown forms */
.menu-item-button { background: none; border: none; width: 100%; text-align: left; padding: 8px 12px; cursor: pointer; }
.menu-item-button:hover { background: #f7f7f7; }

/* Small utility classes used by JS-generated content */
.placeholder-warning { margin-top: 6px; color: #b33; }
.error-text { color: red; padding: 10px; }
.option-error { color: red; }
.enabled-label { margin-right: 10px; }
.d-block { display: block; }

/* Toast notification styles previously set inline in JS */
.toast { position: fixed; right: 20px; top: 20px; z-index: 10000; padding: 12px 18px; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,0.12); }
.toast-success { background: #e6ffed; color: #0f5132; }
.toast-error { background: #ffe6e6; color: #6b0f0f; }

/* Operator hint styling */
.operator-hint { margin-left: 6px; cursor: help; }

/* Invite link/button used in emails */
.email-invite-btn { font-size: 16px; font-weight: bold; padding: 10px; background-color: #007bff; color: white; text-decoration: none; border-radius: 5px; display: inline-block; }

/* ==========================================================================
   Table Styles
   ========================================================================== */

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

/* Use fixed table layout only for admin integrations so dashboard layout is not affected */
.admin-integration-table table { table-layout: fixed; }

/* Column width rules (percentages to distribute space consistently) - scoped to admin integration tables */
.admin-integration-table .col-db-id { width: 6%; }
.admin-integration-table .col-public-id { width: 14%; }
.admin-integration-table .col-name { width: 16%; }
.admin-integration-table .col-creator { width: 12%; }
.admin-integration-table .col-sheet-id { width: 14%; }
.admin-integration-table .col-sheet-name { width: 12%; }
.td-sheet-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-integration-table .col-channel { width: 12%; }
.admin-integration-table .col-created-at { width: 8%; }
.admin-integration-table .col-status { width: 6%; }
.admin-integration-table .col-actions { width: 8%; }

table th,
table td {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: left;
}

table th {
  background-color: #f2f2f2;
  color: #333;
}

/* Prevent wrapping for important short columns and give them a min-width */
.nowrap { white-space: nowrap; }
.db-id-col { min-width: 80px; }
.db-id-col { min-width: 40px; }
.creator-col { min-width: 95px; }
.sheet-id-col { min-width: 140px; }
.created-at-col { min-width: 110px; }

/* Hide the visual scrollbar only in compact mode; keep normal scrollbar visible for large view */
.table-responsive.compact {
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}
.table-responsive.compact::-webkit-scrollbar { display: none; } /* Chrome, Safari */

/* Make table horizontally scrollable on small screens to prevent header overflow */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

/* Compact table mode: smaller font, reduced padding and tighter columns */
.table-responsive.compact table th,
.table-responsive.compact table td {
  font-size: 11px;
  padding: 6px 6px;
}
.table-responsive.compact .db-id-col { min-width: 36px; }
.table-responsive.compact .creator-col { min-width: 72px; }
.table-responsive.compact .sheet-id-col { min-width: 110px; }
.table-responsive.compact .actions-cell { min-width: 110px; }
.table-responsive.compact .created-at-col { min-width: 80px; }
/* Compact percentage adjustments */
.table-responsive.compact .col-db-id { width: 4%; }
.table-responsive.compact .col-public-id { width: 12%; }
.table-responsive.compact .col-name { width: 18%; }
.table-responsive.compact .col-creator { width: 10%; }

/* Normalize font sizes inside admin integration tables for consistent appearance */
.admin-integration-table table th,
.admin-integration-table table td {
  font-size: 13px; /* consistent small-but-readable size for admin tables */
  line-height: 1.35;
}

/* Allow header cells to wrap instead of overflowing their container */
table th {
  white-space: normal; /* allow wrapping */
  word-break: break-word;
  vertical-align: middle;
  padding: 10px 8px; /* slightly more padding for readability */
}

/* Constrain long inline code blocks so they don't push the layout */
table td code,
table th code {
  display: inline-block;
  max-width: 12ch; /* limit by characters and allow truncation */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

/* Ensure inline code in tables uses the same readable font-size and doesn't stack */
table td code, table th code {
  font-family: monospace;
  font-size: inherit; /* inherit the table cell font-size */
}

/* Copyable elements should indicate interactivity */
.copyable { cursor: pointer; display: inline-block; }
.copyable code { text-decoration: underline dotted; }

/* Masked IDs (channel/user) use a monospaced ID display but show full on hover via title */
.masked-id { font-family: monospace; font-weight: 600; letter-spacing: 0.5px; }

/* Small transient copy confirmation shown near clicked copyable element */
.copy-toast {
  position: absolute;
  padding: 6px 8px;
  background: rgba(0,0,0,0.8);
  color: #fff;
  font-size: 12px;
  border-radius: 4px;
  pointer-events: none;
  transform: translate(-50%, -120%);
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 2000;
}
.copy-toast.show { opacity: 1; }

/* For very small screens reduce font a bit and keep scrollability */
@media (max-width: 520px) {
  table th, table td { font-size: 12px; }
}

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

table tr:hover {
  background-color: #f1f1f1;
}
table td.actions-cell {
  white-space: nowrap;
  min-width: 160px; /* provide room but allow expansion */
  max-width: none; /* allow cell to grow as needed */
}

/* ==========================================================================
   Component: Flash Messages & Banners
   ========================================================================== */

.flash {
  padding: 10px;
  margin: 15px 0;
  border-radius: 4px;
  font-weight: bold;
  display: block;
}

.flash-error {
  background-color: #fdd;
  border: 1px solid #d00;
  color: #900;
}

.flash-success {
  background-color: #dfd;
  border: 1px solid #0a0;
  color: #060;
}

.inline-banner {
  margin-left: 10px;
  margin-top: 5px;
  display: inline-block;
  font-weight: 500;
}

/* ==========================================================================
   Component: Toggle Switch
   ========================================================================== */

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  -webkit-transition: .4s;
  transition: .4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
  border-radius: 50%;
}

input:checked+.slider {
  background-color: #3fcf8e;
}

input:focus+.slider {
  box-shadow: 0 0 1px #3fcf8e;
}

input:checked+.slider:before {
  -webkit-transform: translateX(16px);
  -ms-transform: translateX(16px);
  transform: translateX(16px);
}

.status-text {
  margin-left: 10px;
  font-weight: bold;
  color: #555;
}

/* ==========================================================================
   Component: Searchable Dropdown
   ========================================================================== */

.search-container {
  position: relative;
  width: 320px;
}

#sheet-search {
  width: 100%;
  padding: 8px;
  box-sizing: border-box;
}

.search-results {
  display: none;
  position: absolute;
  border: 1px solid #ddd;
  background-color: white;
  max-height: 200px;
  overflow-y: auto;
  width: 100%;
  z-index: 100;
  box-sizing: border-box;
}

.search-results div {
  padding: 10px;
  cursor: pointer;
}

.search-results div:hover {
  background-color: #f1f1f1;
}

.search-container::after {
  content: '▼';
  font-size: 12px;
  color: #555;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

/* ==========================================================================
   Component: Rule Builder
   ========================================================================== */

.rule-block {
  background-color: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 15px;
  margin-bottom: 15px;
}

.rule-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

.btn-delete-rule {
  background: none;
  border: none;
  color: #d9534f;
  cursor: pointer;
  font-size: 0.9em;
  text-decoration: underline;
}

.rule-block .rule-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.rule-block select,
.rule-block input[type="text"] {
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.rule-block .rule-line .operator {
  flex-grow: 1;
}

.rule-block .rule-line .value {
  flex-grow: 2;
}

.rule-block textarea {
  width: 100%;
  box-sizing: border-box;
  margin-top: 5px;
}

/* ==========================================================================
   Component: Placeholders & Previews
   ========================================================================== */

.available-placeholders-box {
  font-size: 0.9em;
  background-color: #f0f0f0;
  padding: 10px;
  margin-top: 5px;
  border-radius: 4px;
  line-height: 1.8;
}

.available-placeholders-box code {
  background-color: #e0e0f0;
  padding: 3px 6px;
  border-radius: 3px;
  font-weight: bold;
  font-size: 0.95em;
  white-space: nowrap;
  margin-right: 5px;
}

.available-placeholders-box code:hover {
  background-color: #d0d0e0;
  color: #000;
}

.message-preview-box {
  background-color: #f8f8f8;
  border: 1px solid #ddd;
  padding: 15px;
  min-height: 80px;
  white-space: pre-wrap;
  font-family: 'Courier New', Courier, monospace;
  color: #333;
  border-radius: 4px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow-x: auto;
}

.preview-img {
  height: 300px; /* Adjust height as needed */
  width: auto; /* Maintain aspect ratio */
}

/* ==========================================================================
   Component: Log Styles
   ========================================================================== */

.log-entry {
  padding: 8px;
  margin-bottom: 5px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9em;
  word-break: break-word;
}

.log-level-INFO {
  background-color: #e6ffe6;
  border: 1px solid #c6ffc6;
}

.log-level-WARN {
  background-color: #fffacd;
  border: 1px solid #ffe87c;
}

.log-level-ERROR {
  background-color: #ffe6e6;
  border: 1px solid #ffc6c6;
}

.log-context {
  font-size: 0.8em;
  color: #666;
  margin-top: 5px;
  white-space: pre-wrap;
}

/* ==========================================================================
   Component: Modal
   ========================================================================== */

.modal-overlay {
  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);
}

.modal-content {
  background-color: #fefefe;
  margin: 15% auto;
  padding: 20px;
  border: 1px solid #888;
  width: 80%;
  max-width: 500px;
  border-radius: 5px;
  position: relative;
}

.modal-close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
}

.modal-close:hover,
.modal-close:focus {
  color: black;
  text-decoration: none;
  cursor: pointer;
}

/* ==========================================================================
   Component: Loading Spinner
   ========================================================================== */

.spinner {
  display: none; /* Hidden by default */
  border: 4px solid #f3f3f3; /* Light grey */
  border-top: 4px solid #3498db; /* Blue */
  border-radius: 50%;
  width: 16px;
  height: 16px;
  animation: spin 1s linear infinite;
  margin-left: 10px;
  vertical-align: middle; /* Aligns it nicely with text */
}

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

/* ==========================================================================
   Component: Collapsible Content
   ========================================================================== */

.collapsible-header {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.collapsible-header:hover {
  background-color: #f9f9f9;
}

.collapsible-content {
  /* Starts collapsed */
  display: none;
  padding-top: 15px;
}

.indicator {
  font-weight: bold;
  font-family: monospace;
  font-size: 1.2em;
}

/* ==========================================================================
   Section: How It Works
   ========================================================================== */

.how-it-works-section {
  text-align: center;
  padding: 4rem 1rem;
  background-color: #f9f9f9; /* A light background to separate it */
}

.steps-container {
  display: flex;
  justify-content: space-around;
  gap: 2rem;
  margin-top: 2rem;
}

.step .step-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: #007bff; /* Your primary color */
  color: white;
  font-size: 1.5rem;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

/* ==========================================================================
   Section: Intelligent Rules
   ========================================================================== */

.intelligent-rules-section {
  padding: 4rem 1rem;
  background-color: #f9f9fa; /* A light background to stand out */
}

.rules-showcase-grid {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 3rem;
}

@media (min-width: 768px) {
  .rules-showcase-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.rules-benefits ul {
  list-style: none;
  padding: 0;
}

.rules-benefits li {
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
  padding-left: 2rem;
  position: relative;
}

.rules-benefits li::before {
  content: '✓'; /* Checkmark */
  color: #28a745; /* A success green color */
  position: absolute;
  left: 0;
  font-weight: bold;
}

.visual-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background-color: #e9ecef;
  border: 2px dashed #ced4da;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-style: italic;
  color: #6c757d;
}

/* ==========================================================================
   Section: Use Cases
   ========================================================================== */

.use-cases-section {
  padding: 4rem 1rem;
}

.use-cases-grid,
.features-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .use-cases-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.use-case-card {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1.5rem;
  background-color: #fff;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.use-case-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.use-case-card h4 {
  margin-top: 0;
  border-bottom: 1px solid #eee;
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
}

.use-case-card p {
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.use-case-card code {
  background-color: #f1f3f5;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  color: #343a40;
}

/* ==========================================================================
   Section: Features & Tiers
   ========================================================================== */

.features-section {
    padding: 4rem 1rem;
    background-color: #f9f9fa;
}

.tier-card {
    background: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tier-name {
    font-size: 1.5em;
    font-weight: bold;
    color: #4caf50;
}

.tier-features {
    list-style: '✓';
    padding-left: 20px;
}

.tier-features li {
    margin-bottom: 8px;
}

        /* Styles for the new rule builder UI */
        .rule-block, .default-rule-block { border: 1px solid #ddd; padding: 15px; border-radius: 5px; margin-bottom: 20px; background: #f9f9f9; }
        .rule-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #eee; padding-bottom: 10px; margin-bottom: 15px; }
        .rule-header h4 { margin: 0; }
        .condition-block { border-left: 3px solid #ccc; padding-left: 15px; margin-top: 15px; }
  .condition-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr)) auto; /* 4 field groups + delete button */
    gap: 10px;
    align-items: start; /* Keep labels at the top of each column */
    margin-bottom: 10px;
  }
  .btn-delete { background: #e74c3c; color: white; border: none; padding: 6px 10px; font-size: 12px; cursor: pointer; border-radius: 4px; height: 36px; display: inline-flex; align-items: center; justify-content: center; justify-self: center; align-self: center; }
        /* Added for the new toggle visibility */
        .hidden-section { display: none; }
        /* Modified for reduced space and new lines */
        .radio-option {
            display: block; /* Make label take full width */
            margin-bottom: 10px; /* Add space between options */
        }
        .radio-option input {
            margin-right: 5px; /* Space between radio button and text */
        }


/* Base: hide toggle and show nav on desktop */
.menu-toggle {
  display: none;
  font-size: 28px;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
}

/* Mobile layout */
@media (max-width: 768px) {
  .menu-toggle {
    display: block;
    margin-left: auto;
  }

  .nav-menu {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    margin-top: 10px;
    gap: 10px;
  }

  .nav-menu.show {
    display: flex;
  }

  .header-actions {
    flex-direction: column;
    align-items: flex-start;
    margin-left: 0;
    margin-top: 10px;
  }

  .nav-separator,
  .welcome-text-group {
    display: none;
  }

  .btn-outline-white,
  .btn-primary-solid {
    width: 100%;
    text-align: center;
  }
}


/* Re-add relevant styles that were in onboarding.html's style block */
        .pricing-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 20px;
            margin-top: 30px;
        }
        .pricing-card {
            background: #fff;
            padding: 30px;
            border-radius: 8px;
            box-shadow: 0 4px 10px rgba(0,0,0,0.1);
            text-align: center;
            display: flex;
            flex-direction: column;
            justify-content: space-between; /* Pushes button to bottom */
            border: 1px solid #eee; /* Light border */
        }
        .pricing-card h2 {
            font-size: 1.8em;
            margin-bottom: 15px;
            color: #333;
        }
        .pricing-card .price {
            font-size: 2.5em;
            font-weight: bold;
            color: #4caf50; /* Green for pricing */
            margin-bottom: 20px;
        }
        .pricing-card .price span {
            font-size: 0.5em;
            font-weight: normal;
            color: #777;
        }
        .pricing-card ul.features {
            list-style: none;
            padding: 0;
            margin-bottom: 30px;
            text-align: left;
            flex-grow: 1; /* Makes features take up available space */
        }
        .pricing-card ul.features li {
            padding: 8px 0;
            border-bottom: 1px dashed #eee;
            color: #555;
        }
        .pricing-card ul.features li:last-child {
            border-bottom: none;
        }
        .btn-primary {
            background-color: #4CAF50;
            color: white;
            padding: 10px 20px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 1em;
            text-decoration: none;
            display: inline-block;
        }
        .btn-primary:hover {
            background-color: #45a049;
        }
        .btn-secondary {
            background-color: #f0f0f0;
            color: #333;
            padding: 10px 20px;
            border: 1px solid #ccc;
            border-radius: 5px;
            cursor: pointer;
            font-size: 1em;
            text-decoration: none;
            display: inline-block;
        }
        .btn-secondary:hover {
            background-color: #e0e0e0;
        }
        .btn-disabled {
            opacity: 0.5;
            pointer-events: auto;
            cursor: not-allowed;
}
/* ==========================================================================
    Install page images
    ========================================================================== */

/* Slack install steps: text + image side by side */
.slack-steps {
    list-style: none; /* Hide default numbers */
    margin: 0;
    padding: 0; /* Remove default padding as numbers will be inside boxes */
    counter-reset: step-counter; /* Initialize a counter named 'step-counter' */
}

.slack-steps .step-item {
    display: grid;
    /* Default: Two columns for text and image.
       This will be overridden for specific steps below. */
    grid-template-columns: 2fr 3fr;
    gap: 1rem 2rem;
    align-items: start;
    margin-bottom: 2rem;

    /* Styles for the box/card effect for each step */
    border: 1px solid #e0e0e0; /* Light gray border */
    border-radius: 8px; /* Slightly rounded corners */
    padding: 20px; /* Internal space within the box */
    background-color: #ffffff; /* White background */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05); /* Soft, subtle shadow */

    position: relative; /* Needed for absolute positioning of the custom number */
    counter-increment: step-counter; /* Increment the counter for each step item */
}

/* For the first three items (which are text-only steps), make them span full width */
.slack-steps .step-item:nth-child(-n + 3) {
    grid-template-columns: 1fr;
}

/* Style and position the custom step number (e.g., "Step 1:") */
.slack-steps .step-item::before {
    content: "Step " counter(step-counter) ":"; /* Display "Step X:" */
    position: absolute; /* Position relative to the .step-item box */
    top: 10px; /* Adjust vertical position from top of the box */
    left: 15px; /* Adjust horizontal position from left of the box */
    font-size: 0.9em; /* Smaller font size for the step label */
    font-weight: bold;
    color: #555; /* A bit darker for good contrast */
    background-color: #f0f0f0; /* Light background for the number tag */
    padding: 4px 8px;
    border-radius: 5px;
    z-index: 1; /* Ensure it's above other content if needed */
}

/* Adjust padding for the content when a custom number is present */
.slack-steps .step-item .step-text {
    /* Push the actual text content down to make space for the "Step X:" label */
    padding-top: 25px;
    font-size: 1rem;
    line-height: 1.5;
}

/* Style for the image container within each step */
.slack-steps .step-image {
    display: flex; /* Use flexbox to center the image within its grid cell */
    justify-content: center; /* Horizontally center the image */
    align-items: flex-start; /* Align image to the top of its container */
}

/* Default styling for images within steps */
.slack-steps .step-image img {
    width: 100%;
    height: auto;
    max-width: 350px; /* Keep max-width for most images */
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* Make “wide” items span the full width and center content */
.slack-steps .step-item.step-wide {
    grid-template-columns: 1fr; /* Full width for the wide step (overrides default 2-col) */
    text-align: center; /* Center the text within this step */
    justify-items: center; /* Center items within the grid for this specific step */
}

/* Add some vertical space between text and image for wide steps */
.slack-steps .step-item.step-wide .step-image {
    margin-top: 1rem;
}

/* Allow the image in wide steps to be larger */
.slack-steps .step-item.step-wide .step-image img {
    max-width: 600px; /* Increased max-width for the wide image */
    width: 90%; /* Let it take up a good percentage of the available width */
}

/* Media query for smaller viewports (e.g., mobile) */
@media (max-width: 768px) {
    .slack-steps .step-item {
        grid-template-columns: 1fr; /* Stack all content into a single column */
        padding: 15px; /* Slightly less padding on smaller screens */
    }

    /* Adjust position and size of custom number for smaller screens */
    .slack-steps .step-item::before {
        top: 8px;
        left: 10px;
        font-size: 0.8em;
        padding: 3px 6px; /* Slightly smaller padding for the tag */
    }

    /* Adjust padding for step text on smaller screens */
    .slack-steps .step-item .step-text {
        padding-top: 20px; /* Ensure space for the number on small screens */
    }

    /* Adjust image margin for smaller screens */
    .slack-steps .step-item .step-image {
        margin-top: 0.5rem;
    }
}

/* ==========================================================================
   Component: drag and drop
   ========================================================================== */

   /* In your style.css */
.rule-block {
    cursor: grab; /* Indicate it's draggable */
}

.rule-block.sortable-chosen {
    opacity: 0.7; /* Make the dragged item slightly transparent */
    background-color: #f0f0f0;
}

.rule-block.sortable-ghost {
    opacity: 0.1; /* Ghost element indicating drop position */
    background-color: #c0e0ff;
    border: 1px dashed #007bff;
}

.rule-header {
    cursor: grab; /* Explicitly set cursor for the handle area */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 10px;
    background-color: #f8f9fa; /* Light background for header */
    border-bottom: 1px solid #eee;
    margin-bottom: 15px;
}

/* ===========================================================================
   Component: CONFIGURE INTEGRATIONS
   ========================================================================== */

  /* Basic styling for the toggle switch (you might already have this or need to adjust) */
        .toggle-switch {
            position: relative;
            display: inline-block;
            width: 40px;
            height: 20px;
            margin-right: 8px; /* Space between toggle and text */
            vertical-align: middle;
        }

        .toggle-switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }

        .slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #ccc;
            -webkit-transition: .4s;
            transition: .4s;
            border-radius: 20px;
        }

        .slider:before {
            position: absolute;
            content: "";
            height: 16px;
            width: 16px;
            left: 2px;
            bottom: 2px;
            background-color: white;
            -webkit-transition: .4s;
            transition: .4s;
            border-radius: 50%;
        }

        input:checked + .slider {
            background-color: #3fcf8e;
        }

        input:focus + .slider {
            box-shadow: 0 0 1px #3fcf8e;
        }

        input:checked + .slider:before {
            -webkit-transform: translateX(20px);
            -ms-transform: translateX(20px);
            transform: translateX(20px);
        }
        /* End toggle switch styling */

        /* Rule header display adjustments */
        .rule-header {
            display: flex;
            align-items: center;
            justify-content: space-between; /* Space out items */
            flex-wrap: wrap; /* Allow wrapping on smaller screens */
            padding: 10px;
            background-color: #f0f0f0;
            border-bottom: 1px solid #ddd;
            margin-bottom: 15px;
            cursor: grab; /* Indicate draggable */
        }

        .rule-header h4 {
            margin: 0;
            flex-grow: 1; /* Allow rule name to take space */
        }

        .rule-header .rule-name-input {
            flex-grow: 1;
            margin-right: 15px;
            border: 1px solid #ccc;
            padding: 5px 8px;
            border-radius: 4px;
        }

        .rule-header .rule-controls {
            display: flex;
            align-items: center;
            gap: 10px; /* Space between controls */
        }

        .rule-header .btn-delete,
        .rule-header .btn-secondary.btn-sm {
            flex-shrink: 0; /* Prevent buttons from shrinking */
        }

        /* Basic styling for the rule blocks themselves */
        .rule-block {
            border: 1px solid #ddd;
            padding: 15px;
            margin-bottom: 20px;
            border-radius: 8px;
            background-color: #fff;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        }

        .rule-block.sortable-chosen {
            opacity: 0.7;
            background-color: #f0f8ff; /* Light blue on drag */
        }

        .rule-block.sortable-ghost {
            opacity: 0.1;
            background-color: #c0e0ff;
            border: 1px dashed #007bff;
        }

        .message-preview {
            border: 1px solid #e0e0e0;
            background-color: #f9f9f9;
            padding: 10px;
            margin-top: 10px;
            border-radius: 4px;
            font-family: monospace;
            white-space: pre-wrap; /* Preserve whitespace and break lines */
            font-size: 0.9em;
            color: #555;
            min-height: 40px; /* NEW: Give it a minimum height so it's always visible */
            overflow-wrap: break-word; /* NEW: Ensure long words break */
        }

        /* --- NEW: Validation styles --- */
        .is-invalid {
            border-color: red !important;
            box-shadow: 0 0 0 0.2rem rgba(255, 0, 0, 0.25);
        }
        .validation-error-message {
            display: block;
            min-height: 18px; /* Reserve space for 1 line of error text */
            font-size: 0.8em;
            color: red;
            margin-top: 4px;
            transition: opacity 0.2s ease;
        }
        .help-icon {
            position: relative;
            display: inline-block;
            margin-left: 5px;
            cursor: pointer;
            font-size: 0.9em;
            color: #888;
        }
        .help-icon::after {
            content: "i"; /* Simple info icon */
            display: inline-block;
            width: 1em;
            height: 1em;
            line-height: 1em;
            text-align: center;
            border-radius: 50%;
            border: 1px solid #888;
            font-style: normal;
        }
        .help-icon .tooltiptext {
            visibility: hidden;
            width: 200px;
            background-color: #555;
            color: #fff;
            text-align: center;
            border-radius: 6px;
            padding: 5px 0;
            position: absolute;
            z-index: 1;
            bottom: 125%; /* Position above */
            left: 50%;
            margin-left: -100px; /* Center the tooltip */
            opacity: 0;
            transition: opacity 0.3s;
            font-size: 0.8em;
            line-height: 1.2;
            white-space: normal; /* Allow text wrapping */
        }
        .help-icon .tooltiptext::after {
            content: "";
            position: absolute;
            top: 100%; /* At the bottom of the tooltip */
            left: 50%;
            margin-left: -5px;
            border-width: 5px;
            border-style: solid;
            border-color: #555 transparent transparent transparent;
        }
        .help-icon:hover .tooltiptext {
            visibility: visible;
            opacity: 1;
        }
        .disabled-input {
            background-color: #f5f5f5;
            color: #888;
            cursor: not-allowed;
        }
        /* --- END NEW: Tooltip styles --- */

    /* --- Condition field group styling ---
       Consolidated rules to ensure the delete "X" button is vertically
       centered with the other fields and to remove previously conflicting
       declarations. */
    .condition-row {
      display: grid;
      grid-template-columns: repeat(4, minmax(120px, 1fr)) auto; /* 4 field groups + delete button */
      gap: 10px;
      align-items: start; /* Keep labels at the top of each column */
      margin-bottom: 15px;
    }

    .condition-row .btn-delete {
      justify-self: center; /* Place delete button in the auto column and center it vertically relative to inputs */
      align-self: center;
      margin: 0;
      padding: 6px 10px;
      min-width: 36px;
      height: 36px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 4px;
    }

    /* Responsive fallback: use flexbox on narrow screens where grid would wrap poorly */
    @media (max-width: 768px) {
      .condition-row {
        display: flex;
        flex-direction: column;
        gap: 8px;
      }
      .condition-row .btn-delete { justify-self: auto; align-self: center; }
    }

    .condition-field-group {
      display: flex;
      flex-direction: column; /* Stack label above input */
      align-items: flex-start; /* Align label to the left */
      flex-grow: 1; /* Allow groups to grow */
      min-width: 120px; /* Ensure enough width for each group */
      min-height: 72px; /* Ensure label + input + error area share consistent height so labels align */
      justify-content: flex-start;
    }

    .condition-field-group label {
      font-weight: bold;
      margin-bottom: 5px; /* Space between label and input */
      font-size: 0.9em;
      color: #333;
    }

    .condition-row select,
    .condition-row input[type="text"],
    .condition-row input[type="number"],
    .condition-row input[type="date"], /* NEW */
    .condition-row input[type="time"] { /* NEW */
      width: 100%; /* Make inputs/selects fill their group */
      padding: 8px;
      border: 1px solid #ccc;
      border-radius: 4px;
      box-sizing: border-box;
    }


/* --- Fix vertical alignment of input/select boxes --- */
.condition-field-group input,
.condition-field-group select {
  height: 36px;
  padding: 6px 10px;
  font-size: 0.95em;
  box-sizing: border-box;
  line-height: 1.2;
  vertical-align: middle;
}

/* --- Consistent spacing between fields --- */
.rule-block .rule-line {
  display: flex;
  align-items: flex-start;  /* Ensures top alignment across fields */
  gap: 10px;
}

.rule-block .rule-line > .condition-field-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

/* --- Disabled state for value input --- */
.disabled-input {
  background-color: #f5f5f5;
  color: #888;
  cursor: not-allowed;
  border: 1px solid #ccc;
}

/* --- Reserve space for validation messages to prevent layout shift --- */
.validation-error-message {
  display: block;
  min-height: 18px;  /* 1 line of text space */
  font-size: 0.8em;
  color: red;
  margin-top: 4px;
  visibility: visible;
  transition: opacity 0.2s ease;
}
