/* Accounts CRM Spreadsheet Styles */

.crm-table {
  font-size: 0.875rem;
}

.crm-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: rgb(249 250 251);
  border-bottom: 1px solid rgb(229 231 235);
}

.crm-table td {
  border-right: 1px solid rgb(243 244 246);
  vertical-align: middle;
}

.crm-table tr:hover {
  background-color: rgb(249 250 251);
}

/* Sticky first two columns - selection and first data column */
.crm-table th:first-child,
.crm-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 5;
  background-color: white;
  border-right: 2px solid rgb(229 231 235);
  width: 5rem; /* Fixed width for consistent calculations */
}

.crm-table th:first-child {
  background-color: rgb(249 250 251);
  z-index: 15;
}

.crm-table tr:hover td:first-child {
  background-color: rgb(249 250 251);
}

/* Sticky second column (first data column) */
.crm-table th:nth-child(2),
.crm-table td:nth-child(2) {
  position: sticky;
  left: 5rem; /* Position right after the first column */
  z-index: 4;
  background-color: white;
  border-right: 2px solid rgb(229 231 235);
  min-width: 200px;
  white-space: normal;
}

.crm-table th:nth-child(2) {
  background-color: rgb(249 250 251);
  z-index: 14;
}

.crm-table tr:hover td:nth-child(2) {
  background-color: rgb(249 250 251);
}

/* Editable field styles */
.editable-field {
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: background-color 0.15s ease-in-out;
  min-height: 32px;
  display: flex;
  align-items: center;
}

.editable-field:hover {
  background-color: rgb(243 244 246);
  box-shadow: inset 0 0 0 1px rgb(209 213 219);
}

.editable-field.editing {
  background-color: white;
  box-shadow: inset 0 0 0 2px rgb(99 102 241);
  padding: 4px;
}

.editable-field.editing:hover {
  background-color: white;
}

/* Input styling within editable fields */
.editable-field input,
.editable-field select,
.editable-field textarea {
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
  background: transparent;
  font-size: 0.875rem;
  padding: 4px 6px;
  width: 100%;
}

.editable-field textarea {
  resize: vertical;
  min-height: 60px;
}

/* Column minimum widths for better layout */
.crm-table th,
.crm-table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Note: Second column sticky positioning and styling is handled above */

.crm-table th:nth-child(3),
.crm-table td:nth-child(3),
.crm-table th:nth-child(4),
.crm-table td:nth-child(4) {
  min-width: 120px;
}

.crm-table th:nth-child(5),
.crm-table td:nth-child(5),
.crm-table th:nth-child(6),
.crm-table td:nth-child(6) {
  min-width: 100px;
}

.crm-table th:nth-child(7),
.crm-table td:nth-child(7),
.crm-table th:nth-child(8),
.crm-table td:nth-child(8) {
  min-width: 120px;
}

/* Custom field and tag columns */
.crm-table th:nth-child(n+9),
.crm-table td:nth-child(n+9) {
  min-width: 150px;
  max-width: 200px;
}

/* Bulk actions bar styling */
#bulk-actions {
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(100%) translateX(-50%);
    opacity: 0;
  }
  to {
    transform: translateY(0) translateX(-50%);
    opacity: 1;
  }
}

/* Loading overlay */
#loading-overlay {
  backdrop-filter: blur(2px);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .crm-table {
    font-size: 0.8125rem;
  }

  .crm-table th,
  .crm-table td {
    padding: 0.5rem 0.75rem;
  }

  .editable-field {
    padding: 6px;
    min-height: 28px;
  }
}

@media (max-width: 768px) {
  .crm-table th:nth-child(n+6),
  .crm-table td:nth-child(n+6) {
    display: none;
  }

  .crm-table th:nth-child(2),
  .crm-table td:nth-child(2) {
    min-width: 150px;
  }
}

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-active {
  background-color: rgb(220 252 231);
  color: rgb(22 101 52);
}

.status-suspended {
  background-color: rgb(254 226 226);
  color: rgb(153 27 27);
}

.status-expired {
  background-color: rgb(254 243 199);
  color: rgb(146 64 14);
}

/* User level badges */
.level-paid {
  background-color: rgb(224 231 255);
  color: rgb(55 48 163);
}

.level-free {
  background-color: rgb(243 244 246);
  color: rgb(55 65 81);
}

/* Scrollbar styling for webkit browsers */
.overflow-x-auto::-webkit-scrollbar {
  height: 8px;
}

.overflow-x-auto::-webkit-scrollbar-track {
  background: rgb(243 244 246);
  border-radius: 4px;
}

.overflow-x-auto::-webkit-scrollbar-thumb {
  background: rgb(209 213 219);
  border-radius: 4px;
}

.overflow-x-auto::-webkit-scrollbar-thumb:hover {
  background: rgb(156 163 175);
}

/* Focus styles for accessibility */
.account-checkbox:focus,
#select-all:focus {
  outline: 2px solid rgb(99 102 241);
  outline-offset: 2px;
}

/* Toast notification styles */
.toast-notification {
  animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Inline Add Column Form Styling */
#add-column-form {
  animation: slideDown 0.2s ease-out;
}

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

/* Column Type Buttons */
.column-type-btn {
  transition: all 0.2s ease-in-out;
}

.column-type-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Field List Styling */
#fields-list, #tags-list {
  max-height: 200px;
}

#fields-list:empty::after,
#tags-list:empty::after {
  content: "No fields available";
  display: block;
  text-align: center;
  color: #9CA3AF;
  font-style: italic;
  padding: 1rem;
}

/* Add Column Header Hover Effect */
#add-column-header:hover {
  transform: scale(1.02);
}

/* Tag Form Styling */
#quick-tag-form {
  animation: slideDown 0.2s ease-out;
}

/* Button Styling for Lists */
.add-field-btn, .edit-existing-tag-btn, .delete-existing-tag-btn {
  transition: all 0.15s ease-in-out;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}

.add-field-btn:hover {
  background-color: rgb(239 246 255);
}

.edit-existing-tag-btn:hover {
  background-color: rgb(239 246 255);
}

.delete-existing-tag-btn:hover {
  background-color: rgb(254 242 242);
}

/* Header Edit/Remove Button Styling */
.edit-tag-btn, .remove-column-btn {
  transition: opacity 0.2s ease-in-out, color 0.15s ease-in-out;
  padding: 0.25rem;
  border-radius: 0.25rem;
}

.edit-tag-btn:hover, .remove-column-btn:hover {
  background-color: rgba(255, 255, 255, 0.8);
}

/* Column Drag and Drop Styling */
.column-header {
  transition: all 0.2s ease-in-out;
}

.column-header.draggable {
  cursor: grab;
}

.column-header.dragging {
  opacity: 0.6;
  cursor: grabbing;
  transform: rotate(3deg);
  z-index: 1000;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.column-header.drag-over {
  background-color: rgb(233 243 255) !important;
  border-left: 3px solid rgb(59 130 246);
  transform: scale(1.02);
}

.column-header.drag-over-right {
  border-right: 3px solid rgb(59 130 246);
  border-left: none;
}

.column-header .drag-handle {
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
  cursor: grab;
  margin-right: 0.5rem;
  color: rgb(156 163 175);
}

.column-header:hover .drag-handle {
  opacity: 1;
}

.column-header .drag-handle:hover {
  color: rgb(99 102 241);
}

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

/* Table adjustments for dragging */
.crm-table thead {
  position: relative;
}

.crm-table .column-header {
  user-select: none;
}

/* Admin Sidebar Collapsible Styles */
.admin-sidebar {
  width: 16rem; /* Default expanded width (w-64) */
  min-width: 4rem; /* Minimum collapsed width (w-16) */
}

.admin-sidebar[data-collapsed="true"] {
  width: 4rem;
}

.admin-sidebar[data-collapsed="true"] .sidebar-text {
  display: none;
}

.admin-sidebar[data-collapsed="true"] .sidebar-submenu {
  display: none;
}

.admin-sidebar[data-collapsed="true"] .sidebar-footer-section {
  display: none;
}

/* Ensure icons remain visible and centered when collapsed */
.admin-sidebar[data-collapsed="true"] .group {
  justify-content: center;
}

.admin-sidebar[data-collapsed="true"] svg {
  margin-right: 0;
}

/* Smooth transitions */
.admin-sidebar,
.admin-sidebar .sidebar-text,
.admin-sidebar [data-admin-sidebar-target="toggleIcon"] {
  transition: all 0.3s ease-in-out;
}

/* Account Drawer Styles */
#account-drawer {
  height: 100vh;
  position: fixed;
  top: 0;
  right: 0;
  z-index: 50;
  background: white;
  box-shadow: -4px 0 15px rgba(0, 0, 0, 0.1);
  border-left: 1px solid rgb(229 231 235);
}

#account-drawer.translate-x-full {
  transform: translateX(100%);
}

#drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 40;
  backdrop-filter: blur(2px);
}

/* Drawer header styling */
#account-drawer .drawer-header {
  border-bottom: 1px solid rgb(229 231 235);
  background: rgb(249 250 251);
}

/* Content scrolling */
#drawer-content {
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}

/* Smooth scrollbar for drawer content */
#drawer-content::-webkit-scrollbar {
  width: 6px;
}

#drawer-content::-webkit-scrollbar-track {
  background: rgb(243 244 246);
}

#drawer-content::-webkit-scrollbar-thumb {
  background: rgb(209 213 219);
  border-radius: 3px;
}

#drawer-content::-webkit-scrollbar-thumb:hover {
  background: rgb(156 163 175);
}

/* Section headers in drawer */
#drawer-details h3 {
  color: rgb(55 65 81);
  font-weight: 600;
}

/* Drawer field labels */
#drawer-details label {
  color: rgb(107 114 128);
  font-size: 0.875rem;
  font-weight: 500;
}

/* Drawer field values */
#drawer-details p {
  color: rgb(17 24 39);
  font-size: 0.875rem;
}

/* Status and level badges in drawer */
#drawer-details .status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* Custom field and tag sections */
#custom-fields-section,
#crm-tags-section {
  background: rgb(249 250 251);
}

/* Empty state styling */
#drawer-details .italic {
  font-style: italic;
  color: rgb(107 114 128);
}

/* Loading animation in drawer */
#drawer-loading .animate-spin {
  animation: spin 1s linear infinite;
}

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

/* Responsive drawer */
@media (max-width: 1024px) {
  #account-drawer {
    width: 80vw;
    max-width: none;
  }
}

@media (max-width: 768px) {
  #account-drawer {
    width: 100vw;
    max-width: none;
  }

  #drawer-content {
    padding: 1rem;
  }

  #drawer-details .grid-cols-2 {
    grid-template-columns: 1fr;
  }
}

/* Email field hover effect enhancement */
[data-action="open-account-drawer"] {
  position: relative;
}

[data-action="open-account-drawer"]:hover {
  text-decoration: underline;
}

[data-action="open-account-drawer"]::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 2px;
  background: rgb(37 99 235);
  transform: scaleX(0);
  transition: transform 0.2s ease-in-out;
}

[data-action="open-account-drawer"]:hover::after {
  transform: scaleX(1);
}

/* Drawer close button hover effect */
#close-drawer:hover {
  background: rgb(229 231 235);
  border-radius: 0.5rem;
}

/* Drawer animation improvements */
#account-drawer {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#drawer-overlay {
  transition: opacity 0.3s ease-in-out;
}

#drawer-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Drawer Editable Fields */
.drawer-editable-field {
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s ease-in-out;
  min-height: 32px;
  display: flex;
  align-items: center;
}

.drawer-editable-field:hover {
  background-color: rgb(249 250 251) !important;
  border-color: rgb(209 213 219) !important;
}

.drawer-editable-field.editing {
  background-color: white !important;
  border-color: rgb(99 102 241) !important;
  padding: 4px;
}

.drawer-editable-field.editing:hover {
  background-color: white !important;
}

/* Input styling within drawer editable fields */
.drawer-editable-field input,
.drawer-editable-field select,
.drawer-editable-field textarea {
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
  background: transparent;
  font-size: 0.875rem;
  padding: 4px 6px;
  width: 100%;
}

.drawer-editable-field textarea {
  resize: vertical;
  min-height: 60px;
}

/* Creation form animations */
#drawer-custom-field-form,
#drawer-tag-form {
  animation: slideDown 0.2s ease-out;
}

/* Button hover effects in drawer */
#drawer-add-custom-field:hover,
#drawer-add-tag:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Form styling in drawer */
#drawer-custom-field-form input,
#drawer-custom-field-form select,
#drawer-custom-field-form textarea,
#drawer-tag-form input,
#drawer-tag-form select,
#drawer-tag-form textarea {
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

#drawer-custom-field-form input:focus,
#drawer-custom-field-form select:focus,
#drawer-custom-field-form textarea:focus,
#drawer-tag-form input:focus,
#drawer-tag-form select:focus,
#drawer-tag-form textarea:focus {
  border-color: rgb(99 102 241);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
/* Marketing page specific styles */

.glass-effect {
  background: rgba(255, 255, 255, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.gradient-text {
  background-image: linear-gradient(90deg, #4f46e5, #2563eb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.montserrat {
  font-family: 'Montserrat', sans-serif;
}

.inter {
  font-family: 'Inter', sans-serif;
}

/* Add any other custom styles needed by the marketing frontpage */
/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS 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/SCSS
 * 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.
 *



 */

/* Custom styles for the Airtable-like CRM interface */
.crm-table-container {
  max-height: 80vh;
  overflow: auto;
}

.crm-table {
  font-size: 0.875rem;
  min-width: 100%;
}

.crm-table th {
  font-weight: 500;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 10;
  background: #f9fafb;
  border-bottom: 2px solid #e5e7eb;
}

.crm-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 20;
}

.crm-table td:first-child {
  position: sticky;
  left: 0;
  background: white;
  z-index: 5;
}

.crm-table tr:hover td:first-child {
  background: #f9fafb;
}

.editable-field {
  cursor: pointer;
  border-radius: 4px;
  padding: 4px 8px;
  transition: all 0.2s ease;
  min-height: 24px;
  display: flex;
  align-items: center;
}

.editable-field:hover {
  background-color: #f3f4f6;
  box-shadow: 0 0 0 1px #d1d5db;
}

.editable-field.editing {
  background-color: #dbeafe;
  box-shadow: 0 0 0 2px #3b82f6;
}

.editable-field input,
.editable-field select,
.editable-field textarea {
  border: none;
  background: transparent;
  width: 100%;
  padding: 2px 4px;
  font-size: inherit;
  color: inherit;
  border-radius: 4px;
}

.editable-field input:focus,
.editable-field select:focus,
.editable-field textarea:focus {
  outline: none;
  background-color: white;
  border: 2px solid #3b82f6;
  border-radius: 4px;
  padding: 4px;
}

/* Loading states */
.table-loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading-cell {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Custom pagination styles */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
}



.pagination a:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.pagination .current {
  background: #3b82f6;
  border-color: #3b82f6;
  color: white;
}

.pagination .disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Responsive pagination */
@media (max-width: 640px) {
  .pagination {
    gap: 0.25rem;
    flex-wrap: wrap;
  }

  .pagination a,
  .pagination span {
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
    min-width: 2rem;
  }

  /* Hide some page numbers on very small screens */
  .pagination .ellipsis {
    display: none;
  }
}

/* Pagination container responsive layout */
@media (max-width: 768px) {
  .pagination-container {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }

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

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-active {
  background-color: #dcfce7;
  color: #166534;
}

.status-suspended {
  background-color: #fecaca;
  color: #991b1b;
}

.status-expired {
  background-color: #fef3c7;
  color: #92400e;
}

/* Responsive improvements */
@media (max-width: 1024px) {
  .crm-table {
    font-size: 0.8rem;
  }

  .crm-table th,
  .crm-table td {
    padding: 0.5rem 0.75rem;
  }
}
