/* ==========================================================================
   Base CSS & Custom Properties
   ========================================================================== */

:root {
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --secondary-color: rgba(255, 255, 255, 0.12);
  --secondary-hover: rgba(255, 255, 255, 0.22);
  --danger-color: #ef4444;
  --danger-hover: #dc2626;
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.45);
  
  --glass-bg: rgba(20, 20, 20, 0.55);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-glow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --glass-blur: blur(16px);

  --card-bg: rgba(255, 255, 255, 0.07);
  --card-border: rgba(255, 255, 255, 0.06);
  --card-hover-bg: rgba(255, 255, 255, 0.12);
  
  --font-family: 'Outfit', 'Noto Sans TC', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --transition-speed: 0.25s;
  --border-radius-lg: 16px;
  --border-radius-md: 12px;
  --border-radius-sm: 8px;
}

/* Base resets */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  color: var(--text-primary);
  background-color: #0f172a;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Background wall */
.app-background {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -2;
  background-image: url('https://images.unsplash.com/photo-1552832230-c0197dd311b5?q=80&w=1200'); /* Rome Colosseum by default */
  background-size: cover;
  background-position: center;
  transition: background-image 0.8s cubic-bezier(0.25, 1, 0.5, 1), background-color 0.5s ease;
}

.app-background-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  background: radial-gradient(circle at center, rgba(15, 23, 42, 0.4) 0%, rgba(15, 23, 42, 0.8) 100%);
  pointer-events: none;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* ==========================================================================
   Layout Containers
   ========================================================================== */

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

/* Header Area styling */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: var(--glass-glow);
  z-index: 10;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-grow: 1;
  min-width: 0; /* allows flex item to shrink below content width */
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #a5b4fc 0%, #6366f1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  flex-shrink: 0;
}

.logo-icon {
  stroke: url(#logo-grad); /* Fallback to styled stroke */
  color: #818cf8;
}

.board-title-container {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.board-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  border-radius: var(--border-radius-sm);
  padding: 2px 6px;
  outline: none;
  transition: background-color var(--transition-speed);
  word-break: break-word;
}

.board-title:focus {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 2px var(--primary-color);
}

.board-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  outline: none;
  border-radius: var(--border-radius-sm);
  padding: 2px 6px;
  transition: background-color var(--transition-speed);
  margin-top: 2px;
  word-break: break-word;
}

.board-description:focus {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 2px var(--primary-color);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

/* Search bar styling */
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-md);
  padding: 6px 12px;
  width: 240px;
  transition: all var(--transition-speed);
}

.search-wrapper:focus-within {
  width: 280px;
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.search-icon {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
  margin-right: 8px;
  flex-shrink: 0;
}

.search-wrapper input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.85rem;
  width: 100%;
}

.search-wrapper input::placeholder {
  color: var(--text-muted);
}

.clear-search-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border-radius: 50%;
  margin-left: 4px;
}

.clear-search-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* Button & Dropdown styles */
.action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--border-radius-md);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-speed);
  outline: none;
  height: 38px;
  border: 1px solid transparent;
}

.btn i {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background-color: var(--primary-color);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--secondary-color);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
  background-color: var(--secondary-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-danger {
  background-color: var(--danger-color);
  color: #ffffff;
}

.btn-danger:hover {
  background-color: var(--danger-hover);
}

/* Dropdown Menu */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: rgba(23, 23, 23, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  min-width: 190px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  border-radius: var(--border-radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 100;
  overflow: hidden;
  padding: 6px;
}

.dropdown-content.show {
  display: block;
  animation: slideDown 0.15s ease-out;
}

.dropdown-content button,
.dropdown-content a {
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  text-align: left;
  font-family: var(--font-family);
  font-size: 0.85rem;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color var(--transition-speed);
  text-decoration: none;
}

.dropdown-content button:hover,
.dropdown-content a:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.dropdown-content button.btn-danger:hover {
  background-color: var(--danger-color);
}

/* ==========================================================================
   Board Canvas & Columns
   ========================================================================== */

.board-canvas {
  flex-grow: 1;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 24px;
  display: flex;
}

.columns-wrapper {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  height: 100%;
  width: max-content;
}

/* Single Column styling */
.board-column {
  width: 320px;
  max-height: 100%;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--glass-glow);
  display: flex;
  flex-direction: column;
  padding: 16px;
  flex-shrink: 0;
  animation: fadeIn 0.3s ease-out;
  transition: transform 0.2s, box-shadow 0.2s;
}

.board-column:hover {
  box-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.45);
}

.column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
}

.column-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  outline: none;
  border-radius: var(--border-radius-sm);
  padding: 2px 6px;
  flex-grow: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background-color var(--transition-speed);
}

.column-title:focus {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 2px var(--primary-color);
}

.column-options-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 50%;
  transition: all var(--transition-speed);
}

.column-options-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.column-options-btn i {
  width: 18px;
  height: 18px;
}

/* Column Inline Addition Card Button */
.add-card-inline-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-weight: 500;
  font-size: 0.85rem;
  padding: 10px;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
  transition: all var(--transition-speed);
  width: 100%;
}

.add-card-inline-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary-color);
  color: var(--text-primary);
}

.add-card-inline-btn i {
  width: 16px;
  height: 16px;
}

/* Cards scrollable area inside column */
.cards-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  flex-grow: 1;
  padding-right: 2px;
}

/* ==========================================================================
   Card Styling
   ========================================================================== */

.board-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius-md);
  padding: 14px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  transition: all var(--transition-speed) cubic-bezier(0.25, 1, 0.5, 1);
  cursor: default;
  animation: fadeIn 0.25s ease-out;
}

.board-card:hover {
  background: var(--card-hover-bg);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

/* Card Header metadata */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.card-meta {
  display: flex;
  flex-direction: column;
}

.card-author {
  font-size: 0.78rem;
  font-weight: 700;
  color: #a5b4fc;
}

.card-time {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.card-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition-speed);
}

.board-card:hover .card-actions {
  opacity: 1;
}

.card-act-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-speed);
}

.card-act-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.card-act-btn.edit-btn:hover {
  color: #60a5fa;
}

.card-act-btn.delete-btn:hover {
  color: var(--danger-color);
}

.card-act-btn i {
  width: 14px;
  height: 14px;
}

/* Card Content details */
.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-primary);
}

.card-content {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Attachments */
.card-image-attachment {
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  margin-top: 4px;
  max-height: 180px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.card-image-attachment img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
  transition: transform 0.5s;
}

.card-image-attachment img:hover {
  transform: scale(1.05);
}

.card-link-attachment {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--border-radius-sm);
  padding: 8px 10px;
  margin-top: 4px;
  text-decoration: none;
  color: inherit;
  transition: background var(--transition-speed);
}

.card-link-attachment:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
}

.link-thumb {
  width: 36px;
  height: 36px;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.link-thumb i {
  width: 18px;
  height: 18px;
}

.link-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.link-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-url {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Card Footer Toolbar */
.card-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 8px;
}

.footer-action-item {
  display: flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  transition: all var(--transition-speed);
  padding: 4px 6px;
  border-radius: 4px;
}

.footer-action-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.footer-action-item i {
  width: 14px;
  height: 14px;
}

.footer-action-item.liked {
  color: #f43f5e;
}

.footer-action-item.liked i {
  fill: #f43f5e;
  stroke: #f43f5e;
}

.footer-action-item.liked:hover {
  color: #fda4af;
}

/* Card Comments Section */
.card-comments-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: var(--border-radius-sm);
  padding: 10px;
  margin-top: 4px;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 150px;
  overflow-y: auto;
}

.comment-item {
  font-size: 0.75rem;
  line-height: 1.4;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 4px;
}

.comment-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.comment-author {
  font-weight: 700;
  color: #a5b4fc;
  margin-right: 4px;
}

.comment-body {
  color: var(--text-secondary);
  word-break: break-word;
}

.comment-input-area {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.comment-input {
  flex-grow: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius-sm);
  padding: 6px 8px;
  font-family: var(--font-family);
  font-size: 0.75rem;
  color: var(--text-primary);
  outline: none;
}

.comment-input:focus {
  border-color: var(--primary-color);
  background: rgba(255, 255, 255, 0.08);
}

.comment-send-btn {
  background: var(--primary-color);
  border: none;
  color: white;
  border-radius: var(--border-radius-sm);
  padding: 0 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-speed);
}

.comment-send-btn:hover {
  background: var(--primary-hover);
}

.comment-send-btn i {
  width: 12px;
  height: 12px;
}

/* ==========================================================================
   Modals & Popups
   ========================================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-speed) ease;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.glass-card {
  background: rgba(30, 41, 59, 0.75);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--glass-glow), 0 20px 50px rgba(0, 0, 0, 0.6);
}

.modal-content {
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  transform: scale(0.92);
  transition: transform var(--transition-speed) cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.show .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 14px;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.close-modal-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-speed);
}

.close-modal-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.close-modal-btn i {
  width: 20px;
  height: 20px;
}

/* Forms styling */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input,
.form-group textarea {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.88rem;
  outline: none;
  transition: all var(--transition-speed);
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--primary-color);
  background: rgba(15, 23, 42, 0.7);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon i {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.input-with-icon input {
  padding-left: 36px;
  width: 100%;
}

.image-upload-control {
  display: flex;
  gap: 8px;
  align-items: center;
}

.image-upload-control .upload-btn {
  white-space: nowrap;
  flex-shrink: 0;
  height: 38px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-radius: var(--border-radius-md);
  transition: all var(--transition-speed);
}

.image-upload-control .upload-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--primary-color);
  transform: translateY(-1px);
}

.upload-progress-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--primary-color);
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--border-radius-md);
  padding: 8px 12px;
}

.upload-progress-container i {
  color: var(--primary-color);
}

.img-preview-container {
  position: relative;
  border-radius: var(--border-radius-md);
  overflow: hidden;
  max-height: 150px;
  margin-top: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.img-preview-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.remove-preview-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(239, 68, 68, 0.9);
  border: none;
  border-radius: var(--border-radius-sm);
  padding: 6px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-speed);
}

.remove-preview-btn:hover {
  background: var(--danger-color);
}

.remove-preview-btn i {
  width: 14px;
  height: 14px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 16px;
}

/* Background Settings specific style */
.bg-settings-modal {
  max-width: 480px;
}

.bg-settings-modal h4 {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 10px;
}

.bg-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.bg-option-item {
  height: 70px;
  border-radius: var(--border-radius-md);
  background-size: cover;
  background-position: center;
  position: relative;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition-speed);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 6px;
}

.bg-option-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.bg-option-item.active {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.4);
}

.bg-name {
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 2px 6px;
  border-radius: 4px;
  color: white;
  width: 100%;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.color-gallery {
  grid-template-columns: repeat(4, 1fr);
}

.color-item {
  height: 50px;
  justify-content: center;
  align-items: center;
}

.custom-bg-group {
  display: flex;
  flex-direction: row;
  gap: 10px;
}

.custom-bg-group .input-with-icon {
  flex-grow: 1;
}

.custom-bg-group button {
  flex-shrink: 0;
  height: 38px;
}

/* ==========================================================================
   Columns Menu Dropdown & Toasts
   ========================================================================== */

.col-menu-dropdown {
  position: absolute;
  background: rgba(23, 23, 23, 0.95);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--border-radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  padding: 6px;
  z-index: 100;
  min-width: 140px;
}

.col-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.8rem;
  text-align: left;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: background-color var(--transition-speed);
}

.col-menu-item:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

.col-menu-danger {
  color: var(--danger-color);
}

.col-menu-danger:hover {
  background-color: rgba(239, 68, 68, 0.1) !important;
}

.col-menu-item i {
  width: 14px;
  height: 14px;
}

/* Toast Notifications */
.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--primary-color);
  border-radius: var(--border-radius-md);
  padding: 12px 20px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast-notification.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-icon {
  color: var(--primary-color);
  width: 18px;
  height: 18px;
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive UI adjustments */
@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 16px;
  }
  .header-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    width: 100%;
  }
  .logo-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    font-size: 1.25rem;
  }
  .board-title-container {
    width: 100%;
  }
  .board-title {
    font-size: 1.15rem;
    padding: 0;
    line-height: 1.3;
  }
  .board-description {
    font-size: 0.78rem;
    margin-top: 4px;
    padding: 0;
    line-height: 1.4;
  }
  .date-picker-wrapper {
    padding: 3px 8px;
    font-size: 0.75rem;
    margin-top: 4px;
  }
  .board-date-input {
    width: 95px;
  }
  .header-right {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 12px;
    margin-top: 4px;
  }
  .search-wrapper {
    flex-grow: 1;
    min-width: 110px;
    width: auto;
    padding: 6px 10px;
  }
  .search-wrapper input {
    font-size: 0.8rem;
  }
  .search-wrapper:focus-within {
    width: auto;
  }
  .action-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    flex-shrink: 0;
    max-width: calc(100% - 120px);
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
    padding: 2px 0;
  }
  .action-buttons::-webkit-scrollbar {
    display: none; /* Hide scrollbar for Chrome, Safari and Opera */
  }
  .action-buttons .btn {
    padding: 8px;
    height: 34px;
    width: 34px;
    border-radius: var(--border-radius-sm);
  }
  .action-buttons span {
    display: none; /* Hide text on small screens, keep icons */
  }
  .board-canvas {
    padding: 12px 8px;
  }
  .columns-wrapper {
    gap: 12px;
  }
  .board-column {
    width: 82vw;
    max-width: 310px;
    padding: 12px;
  }
  .column-title {
    font-size: 0.95rem;
  }
  .add-card-inline-btn {
    padding: 8px;
    font-size: 0.8rem;
    margin-bottom: 10px;
  }
  .board-card {
    padding: 10px;
    gap: 6px;
  }
  .card-title {
    font-size: 0.9rem;
  }
  .card-content {
    font-size: 0.8rem;
  }
}

/* Spinner Animation for loader */
.animate-spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   Date Picker & Test Badge Styles
   ========================================================================== */

.date-picker-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 4px 10px;
  border-radius: 16px;
  color: var(--text-primary);
  font-size: 0.8rem;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.date-picker-wrapper:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.2);
}

.board-date-input {
  background: transparent;
  border: none;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  width: 110px;
}

.board-date-input::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.board-date-input::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

.local-test-badge {
  display: inline-flex;
  align-items: center;
}

/* ==========================================================================
   Slideshow Mode Overlay & Content Styles
   ========================================================================== */

.slideshow-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(10, 15, 30, 0.92);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease forwards;
}

.slideshow-close-btn {
  position: absolute;
  top: 24px;
  right: 24px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 2010;
}

.slideshow-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.08);
}

.slideshow-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 900px;
  padding: 24px;
  box-sizing: border-box;
}

.slide-card {
  width: 100%;
  max-height: 72vh;
  padding: 40px;
  border-radius: var(--border-radius-lg);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  animation: slideCardIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideCardIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.slide-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
}

.slide-column-badge {
  background: var(--primary-color);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.slide-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.slide-title {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: white;
  margin: 0;
  line-height: 1.3;
}

.slide-text {
  font-size: 1.15rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.85);
  white-space: pre-wrap;
  word-break: break-word;
}

.slide-image-container {
  width: 100%;
  max-height: 300px;
  overflow: hidden;
  border-radius: var(--border-radius-md);
  margin-top: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.slide-image-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: rgba(0,0,0,0.2);
}

.slide-link-container {
  margin-top: 10px;
}

.slideshow-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 24px;
  width: 100%;
  box-sizing: border-box;
  z-index: 2010;
}

.slideshow-nav-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.slideshow-nav-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.25);
  transform: scale(1.06);
}

.slideshow-nav-btn i {
  width: 24px;
  height: 24px;
}

.slideshow-progress-info {
  display: flex;
  align-items: center;
  gap: 16px;
  color: white;
  font-weight: 500;
  font-size: 0.95rem;
  background: rgba(0, 0, 0, 0.4);
  padding: 8px 18px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-play-pause:hover {
  background: rgba(255, 255, 255, 0.25) !important;
  transform: scale(1.08);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ==========================================================================
   AI Assistant Sidebar & Chat Elements
   ========================================================================== */

.ai-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  height: 100vh;
  background: rgba(15, 15, 25, 0.75);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-left: 1px solid rgba(167, 139, 250, 0.15);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-sidebar.show {
  transform: translateX(0);
}

.ai-sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  z-index: 999;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ai-sidebar-overlay.show {
  display: block;
  opacity: 1;
}

.ai-sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.ai-header-btn:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: white !important;
}

.ai-sidebar-body {
  flex-grow: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.ai-welcome-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: auto 0;
}

.ai-quick-btn:hover {
  background: rgba(167, 139, 250, 0.1) !important;
  border-color: rgba(167, 139, 250, 0.3) !important;
  color: #c084fc !important;
  transform: translateY(-1px);
}

.ai-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.ai-message {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: messageIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.ai-message.user {
  align-self: flex-end;
}

.ai-message.assistant {
  align-self: flex-start;
}

.ai-message-meta {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  padding: 0 4px;
}

.ai-message.user .ai-message-meta {
  text-align: right;
}

.ai-message-bubble {
  padding: 12px 14px;
  border-radius: var(--border-radius-md);
  font-size: 0.82rem;
  line-height: 1.5;
  word-break: break-word;
}

.ai-message.user .ai-message-bubble {
  background: linear-gradient(135deg, #4f46e5 0%, #6d28d9 100%);
  color: white;
  border-bottom-right-radius: 2px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.ai-message.assistant .ai-message-bubble {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(167, 139, 250, 0.15);
  color: rgba(255, 255, 255, 0.95);
  border-bottom-left-radius: 2px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Markdown formatting inside assistant bubble */
.ai-message-bubble p {
  margin-bottom: 8px;
}
.ai-message-bubble p:last-child {
  margin-bottom: 0;
}
.ai-message-bubble ul, .ai-message-bubble ol {
  margin-left: 20px;
  margin-bottom: 8px;
}
.ai-message-bubble li {
  margin-bottom: 4px;
}
.ai-message-bubble strong {
  color: #c084fc;
  font-weight: 600;
}
.ai-message-bubble blockquote {
  border-left: 3px solid #818cf8;
  background: rgba(99, 102, 241, 0.1);
  padding: 6px 10px;
  margin: 8px 0;
  border-radius: 2px;
  font-size: 0.78rem;
}
.ai-message-bubble code {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 4px;
  border-radius: 4px;
  font-family: monospace;
  color: #fda4af;
  font-size: 0.78rem;
}

.ai-sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.ai-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 6px 14px;
  transition: border-color 0.2s;
}

.ai-input-wrapper:focus-within {
  border-color: #a78bfa;
  box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.2);
}

#aiChatInput {
  flex-grow: 1;
  background: transparent;
  border: none;
  outline: none;
  color: white;
  font-family: var(--font-family);
  font-size: 0.82rem;
  resize: none;
  max-height: 100px;
  padding: 4px 0;
  line-height: 1.4;
}

#sendAiMessageBtn {
  background: none;
  border: none;
  color: #a78bfa;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, color 0.2s;
}

#sendAiMessageBtn:hover {
  color: #c084fc;
  transform: scale(1.1);
}

#sendAiMessageBtn i {
  width: 16px;
  height: 16px;
}

/* Typing Indicator Animation */
.ai-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
}

.ai-typing-dot {
  width: 6px;
  height: 6px;
  background-color: rgba(255,255,255,0.5);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.ai-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.ai-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}

@keyframes pulse-glow {
  from {
    box-shadow: 0 0 5px rgba(167, 139, 250, 0.2);
  }
  to {
    box-shadow: 0 0 18px rgba(167, 139, 250, 0.5);
  }
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* AI Sparkles icon spin/glow */
.ai-icon-sparkle {
  animation: sparkles-spin 8s linear infinite;
}

@keyframes sparkles-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Card AI Diagnose Button */
.btn-card-diagnose {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(167, 139, 250, 0.08);
  border: 1px solid rgba(167, 139, 250, 0.25);
  color: #c084fc;
  font-family: var(--font-family);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 3px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  height: auto;
  line-height: 1;
  margin-left: auto; /* push to the right */
}

.btn-card-diagnose:hover {
  background: rgba(167, 139, 250, 0.18);
  border-color: rgba(167, 139, 250, 0.45);
  box-shadow: 0 0 8px rgba(167, 139, 250, 0.2);
}

.btn-card-diagnose i {
  width: 11px;
  height: 11px;
}

.ai-status-indicator {
  transition: color 0.3s;
}
.ai-status-indicator.active {
  animation: blink-status 1.5s infinite;
}

@keyframes blink-status {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* Floating AI Assistant Button */
.ai-floating-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 998;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 30px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.85) 0%, rgba(167, 139, 250, 0.85) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: white;
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.35);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  animation: floating-bounce 3s ease-in-out infinite;
}

.ai-floating-btn:hover {
  transform: translateY(-5px) scale(1.03);
  box-shadow: 0 12px 30px rgba(167, 139, 250, 0.45);
  border-color: rgba(255, 255, 255, 0.3);
}

.ai-floating-icon {
  width: 16px;
  height: 16px;
  color: white;
}

@keyframes floating-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* ==========================================================================
   Drag and Drop Styles
   ========================================================================== */

/* Cards dragging styles */
.board-card[draggable="true"] {
  cursor: grab;
}

.board-card[draggable="true"]:active {
  cursor: grabbing;
}

.board-card.dragging {
  opacity: 0.4;
  border: 1px dashed var(--primary-color) !important;
  box-shadow: none !important;
  transform: scale(0.98);
}

.board-card.dragging-placeholder {
  pointer-events: none;
}

.cards-container {
  min-height: 120px; /* Ensure drop zone is always reachable even when empty */
  transition: background-color 0.2s ease, border-color 0.2s ease;
  border: 2px dashed transparent;
  border-radius: var(--border-radius-md);
}

.cards-container.drag-over {
  background: rgba(99, 102, 241, 0.05) !important;
  border-color: rgba(99, 102, 241, 0.3) !important;
}

/* Columns dragging styles */
.board-column[draggable="true"] {
  cursor: grab;
}

.board-column[draggable="true"] .column-header {
  cursor: grab;
}

.board-column.dragging-column {
  opacity: 0.3;
  border: 2px dashed rgba(255, 255, 255, 0.2) !important;
  background: rgba(255, 255, 255, 0.02) !important;
  box-shadow: none !important;
}

.board-column.col-drag-over {
  border-left: 3px solid var(--primary-color) !important;
  background: rgba(255, 255, 255, 0.04);
}
