/* Fleck Theme - Current Blue/Slate Colors */

[data-theme="fleck"] {
  /* Custom Shadow (standard Tailwind shadow-lg equivalent) */
  --theme-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);

  /* Primary Colors (Current Blues) */
  --theme-primary: #2563eb;        /* blue-600 - darker normal state */
  --theme-primary-hover: #3b82f6;  /* blue-500 - lighter hover state */
  --theme-primary-soft: #dbeafe;   /* blue-100 */

  /* Accent Colors */
  --theme-accent: #fbbf24;         /* yellow-400 */
  --theme-accent-hover: #f59e0b;   /* yellow-500 */

  /* Surface Colors (Original Dark Theme) */
  --theme-surface: #0f172a;        /* slate-900 - original dark bg */
  --theme-surface-elevated: #1e293b; /* slate-800 - original cards */
  --theme-surface-sunken: #334155; /* slate-700 - original inputs */

  /* Sidebar Colors */
  --theme-sidebar: #0f172a;        /* slate-900 - same as main surface */
  --theme-sidebar-elevated: #1e293b; /* slate-800 - same as elevated surface */

  /* Editor Colors */
  --theme-editor-bg: #1f2937;      /* gray-800 - lighter for editor modal */

  /* Modal Overlay (scrim behind dialogs; alpha lives with the component) */
  --theme-overlay: #000000;        /* neutral scrim, as in the original editor */

  /* Text Colors (Original) */
  --theme-text-primary: #f1f5f9;   /* slate-100 - original light text */
  --theme-text-secondary: #94a3b8; /* slate-400 - original secondary */
  --theme-text-tertiary: #64748b;  /* slate-500 - original tertiary */
  --theme-text-on-dark: #f1f5f9;   /* slate-100 */
  --theme-text-on-dark-secondary: #94a3b8; /* slate-400 */
  --theme-content-search-muted: #cbd5e1; /* slate-300, legible on the slate-700 search fill */
  --theme-content-search-focus: #93c5fd; /* blue-300, visible on slate-700 */

  /* Border Colors (Dark Theme) */
  --theme-border: #334155;         /* slate-700 - original dark borders */
  --theme-border-subtle: #334155;  /* slate-700 - subtle dark borders */

  /* Button Background Colors */
  --theme-button-secondary: #475569; /* slate-600 - medium gray for secondary buttons */

  /* Status Colors */
  --theme-danger: #ef4444;         /* red-500 */
  --theme-danger-hover: #dc2626;   /* red-600 - darker red */
  --theme-success: #10b981;        /* green-500 */

  /* Action Button Colors */
  --theme-action-edit: #60a5fa;    /* blue-400 - more vibrant blue */
  --theme-action-delete: #f87171;  /* red-400 - more vibrant red */
  --theme-action-assign: #4ade80;  /* green-400 - more vibrant green */
  /* Filled surfaces for the content row's contact-share label, which carries
     white text and so cannot use the pale action-assign foreground colour. */
  --theme-action-assign-strong: #16a34a;        /* green-600 */
  --theme-action-assign-strong-hover: #15803d;  /* green-700 */

  /* Content-row privacy badge. `--theme-border` and `--theme-surface-sunken`
     are the same slate-700, so the outlined badge needs a border stepped off
     the row surfaces rather than the shared border colour, or it disappears
     into the hovered row. slate-500 reads 3.75:1 on the resting row and
     slate-300 reads 6.97:1 on the hovered one; the filled hover surface is
     the original app's slate-600 with slate-100 text at 6.92:1. */
  --theme-privacy-border: #64748b;         /* slate-500 - 3.75:1 on slate-900 */
  --theme-privacy-border-hover: #cbd5e1;   /* slate-300 - 6.97:1 on slate-700 */
  --theme-privacy-surface-hover: #475569;  /* slate-600 - original hover fill */
  --theme-privacy-text-hover: #f1f5f9;     /* slate-100 - 6.92:1 on slate-600 */
  --theme-privacy-focus-ring: #93c5fd;     /* blue-300 - 5.74:1 on slate-700 */

  /* Navigation Button Colors */
  --theme-nav-text: #60a5fa;      /* blue-400 - original blue for fleck */
}


/* Content item hover for fleck theme - match Tailwind slate-700 */
[data-theme="fleck"] .group:hover {
  background-color: #334155 !important;
}

/* Tweet item hover for fleck theme */
[data-theme="fleck"] .tweet-item:hover {
  background-color: #334155 !important;
}

/* Thinner borders for content containers in fleck theme */
[data-theme="fleck"] .divide-y.rounded-lg.overflow-hidden.border {
  border: 1px solid #334155 !important; /* Make container border thinner - slate-700 */
}

[data-theme="fleck"] div[style*="border-color: var(--color-border)"] {
  border-width: 1px !important; /* Override thick border from CSS variable */
  border-style: solid !important;
}

/* Remove thick border from content containers in fleck theme */
[data-theme="fleck"] .divide-y.rounded-lg.overflow-hidden.border {
  border: none !important;
}

/* Ensure divider lines are visible in fleck theme */
[data-theme="fleck"] .divide-y > * + * {
  border-top: 1px solid #334155 !important; /* slate-700 dividers */
}

/* Navigation button borders for fleck theme - match original, but not for selected buttons or tabs */
[data-theme="fleck"] button[style*="color: var(--color-nav-text)"]:not(.ring-2):not(.rounded-t-lg) {
  border: 1px solid #334155 !important; /* slate-700 like original */
}

[data-theme="fleck"] button[style*="color: var(--color-nav-text)"]:not(.ring-2):not(.rounded-t-lg):hover {
  border-color: #475569 !important; /* slate-600 on hover like original */
  color: #93c5fd !important; /* blue-300 - matches dark:hover:text-blue-300 */
}

/* Content item button styles (like Restricted button) */
[data-theme="fleck"] button.rounded-full.px-2.py-1 {
  border-color: #475569 !important; /* slate-600 - normal border */
}

[data-theme="fleck"] button.rounded-full.px-2.py-1:hover {
  background-color: #475569 !important; /* slate-600 background on hover */
  color: #e2e8f0 !important; /* slate-200 - lighter text on hover */
  border-color: #64748b !important; /* slate-500 border on hover */
}

/* ToastUI Editor styling - middle gray content area background */
[data-theme="fleck"] .toastui-editor-dark .toastui-editor-main {
  background-color: #2d3748 !important; /* gray-750 - middle between gray-700 and gray-800 */
}

[data-theme="fleck"] .toastui-editor-dark .ProseMirror {
  background-color: #2d3748 !important; /* gray-750 - where user types */
}

[data-theme="fleck"] .toastui-editor-dark .toastui-editor-md-preview {
  background-color: #2d3748 !important; /* gray-750 - preview area */
}

[data-theme="fleck"] .editor-modal [style*="border-bottom"] {
  border-color: #374151 !important; /* gray-700 borders */
}

[data-theme="fleck"] .editor-modal [style*="border-top"] {
  border-color: #374151 !important; /* gray-700 borders */
}

/* Remove left border from dropdown button to avoid double border */
[data-theme="fleck"] button.rounded-e-lg.px-2.py-2 {
  border-left: none !important;
  border-left-color: transparent !important;
  border-left-width: 0 !important;
}

/* Bold ring effect for selected buttons in fleck theme */
[data-theme="fleck"] .ring-2 {
  --tw-ring-opacity: 0.8 !important;
  --tw-ring-offset-width: 0px !important;
  box-shadow: 0 0 0 2px var(--tw-ring-color) !important;
  /* Let the border-color be set by the component for selected state */
}

/* Primary button hover effects for fleck theme */
[data-theme="fleck"] button[style*="background-color: var(--color-primary)"]:hover {
  background-color: var(--color-primary-hover) !important;
  transition: background-color 0.2s ease !important;
}

/* More specific selector for new content button */
[data-theme="fleck"] .px-4.py-2.text-white.rounded-lg[style*="background-color: var(--color-primary)"]:hover {
  background-color: var(--color-primary-hover) !important;
}

/* Active/pressed state for buttons - even lighter */
[data-theme="fleck"] button[style*="background-color: var(--color-primary)"]:active {
  background-color: #60a5fa !important; /* blue-400 - even lighter when pressed */
}

/* Hover effects for secondary gray buttons (like Publish) */
[data-theme="fleck"] button[style*="background-color: var(--color-button-secondary)"]:hover {
  background-color: #64748b !important; /* slate-500 - bg-slate-500 */
}

[data-theme="fleck"] button[style*="background-color: var(--color-button-secondary)"]:active {
  background-color: #94a3b8 !important; /* slate-400 - even lighter when pressed */
}

/* Remove tab borders in fleck theme */
[data-theme="fleck"] button.rounded-t-lg,
[data-theme="fleck"] .rounded-t-lg {
  border: none !important;
  border-bottom: none !important;
}

/* Sidebar and chat stretch to match heights (bottoms aligned) */
[data-theme="fleck"] .flex.flex-row:has(.chat-sidebar) {
  align-items: flex-start !important;
}

/* Sidebar wrapper - no forced height */
[data-theme="fleck"] .flex-row > .w-64:has(.chat-sidebar) {
  height: min(720px, calc(100vh - 2rem)) !important;
  align-self: flex-start !important;
  width: 18rem;
  min-width: 18rem;
}

/* Chat container - max height */
[data-theme="fleck"] .chat-main-container {
  height: min(720px, calc(100vh - 2rem));
  max-height: min(720px, calc(100vh - 2rem));
}

/* Sidebar - max height */
[data-theme="fleck"] .chat-sidebar {
  height: min(720px, calc(100vh - 2rem));
  max-height: min(720px, calc(100vh - 2rem));
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98) 0%, rgba(17, 24, 39, 0.98) 100%);
  border: 1px solid rgba(71, 85, 105, 0.75);
  border-right: 1px solid rgba(71, 85, 105, 0.75);
  border-radius: 18px;
  box-shadow: 0 20px 40px rgba(2, 6, 23, 0.34);
  overflow: hidden;
}

/* Sidebar content - scrollable area */
[data-theme="fleck"] .sidebar-content {
  flex: 1 !important;
  overflow-y: auto !important;
  padding: 0.75rem;
}

/* Content wrapper - force minimum height */
[data-theme="fleck"] .content-wrapper {
  min-height: 0;
}

/* Sidebar footer - sticky at bottom, always visible */
[data-theme="fleck"] .sidebar-footer {
  position: sticky;
  bottom: 0;
  flex-shrink: 0;
  padding: 0.875rem 0.75rem 0.75rem;
  border-top: 1px solid rgba(71, 85, 105, 0.55);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.15) 0%, rgba(15, 23, 42, 0.94) 35%);
  z-index: 10;
}

[data-theme="fleck"] .flex.flex-row:has(.chat-sidebar) {
  gap: 1rem;
}

[data-theme="fleck"] .flex-row:has(.chat-sidebar) .chat-main-container {
  border-left: 1px solid var(--theme-border) !important;
  border-radius: 18px !important;
}

[data-theme="fleck"] .sidebar-header {
  padding: 1.125rem 1rem 0.875rem;
  border-bottom: 1px solid rgba(71, 85, 105, 0.55);
}

[data-theme="fleck"] .sidebar-header h3 {
  margin: 0;
  color: var(--theme-text-primary);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-transform: none;
}

[data-theme="fleck"] .session-list {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

[data-theme="fleck"] .session-item + .session-item {
  margin-top: 0;
}

[data-theme="fleck"] .session-item {
  padding: 0.9rem 0.95rem;
  background: rgba(30, 41, 59, 0.96);
  border: 1px solid rgba(71, 85, 105, 0.6);
  border-radius: 14px;
  box-shadow: 0 8px 18px rgba(2, 6, 23, 0.18);
}

[data-theme="fleck"] .session-item:hover {
  background: rgba(37, 51, 72, 0.98);
  border-color: rgba(96, 165, 250, 0.45);
}

[data-theme="fleck"] .session-item.active {
  background: rgba(37, 99, 235, 0.14);
  border-left: 1px solid rgba(96, 165, 250, 0.55);
  border-color: rgba(96, 165, 250, 0.55);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.16);
}

[data-theme="fleck"] .session-meta {
  gap: 0.35rem;
}

[data-theme="fleck"] .session-text {
  color: var(--theme-text-primary);
  font-size: 0.98rem;
  font-weight: 600;
}

[data-theme="fleck"] .session-time {
  color: var(--theme-text-secondary);
  font-size: 0.8rem;
}

[data-theme="fleck"] .session-menu-btn {
  color: var(--theme-text-secondary);
}

[data-theme="fleck"] .session-menu-btn:hover {
  background-color: rgba(51, 65, 85, 0.75);
  color: var(--theme-text-primary);
}

[data-theme="fleck"] .session-menu {
  border-color: rgba(71, 85, 105, 0.75);
  background-color: rgba(15, 23, 42, 0.98);
  box-shadow: 0 18px 36px rgba(2, 6, 23, 0.34);
}

[data-theme="fleck"] .sidebar-empty,
[data-theme="fleck"] .sidebar-loading {
  padding: 1.25rem 1rem;
  color: var(--theme-text-secondary);
}

[data-theme="fleck"] .new-chat-button {
  width: 100%;
  border-radius: 12px;
  padding: 0.8rem 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.26);
}

[data-theme="fleck"] .new-chat-button:hover {
  box-shadow: 0 14px 28px rgba(59, 130, 246, 0.3);
}

@media (max-width: 768px) {
  [data-theme="fleck"] .flex.flex-row:has(.chat-sidebar) {
    gap: 0;
  }

  [data-theme="fleck"] .chat-sidebar {
    max-height: 100%;
    border-radius: 0;
    border-right: 1px solid rgba(71, 85, 105, 0.7);
    box-shadow: 0 24px 48px rgba(2, 6, 23, 0.45);
  }
}
