:root {
  --bg-color: #1e1f21;
  --card-bg: #ffffff;
  --primary-blue: #0052cc;
  --text-main: #8a8a8a;
  --text-sub: #626262;
  --text-danger: #b44747;
  --border-radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
  --shadow-hover: 0 4px 6px rgba(0, 0, 0, 0.15);
  --border-color: #dfe1e6;
  --sidebar-bg: #2b2b2b;
  --sidebar-hover: #3d3d3d;
  --sidebar-text: #b1a6a6;
  font-size: clamp(14px, 1.2vw + 10px, 18px);
}







/* ===========================
   GLOBAL RESETS & BASE STYLES
   =========================== */

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  overflow: hidden;
  overscroll-behavior-y: contain;
  background-color: var(--bg-color);
}

button {
  align-items: center;
  gap: 12px;
  border: none;
  background-color: var(--sidebar-bg);
}

h1 {
    font-size: clamp(1.5rem, 5vw, 3rem);
}

p {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
}


/* 1. The Scrollbar Track (The "Gutter") */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    /* Match your background color so it doesn't stand out */
    background: var(--bg-color); 
}

/* 2. The Scrollbar Thumb (The "Handle") */
::-webkit-scrollbar-thumb {
    /* Using a shade between your sidebar text and hover color */
    background: #4a4a4a; 
    border-radius: 20px;
    border: 1px solid var(--bg-color); /* Creates a "floating" effect */
}

/* 3. Interaction State */
::-webkit-scrollbar-thumb:hover {
    background: var(--sidebar-text); /* Brightens when active */
}

/* 4. Firefox Support */
* {
    scrollbar-width: thin;
    scrollbar-color: #4a4a4a var(--bg-color);
}






/* ===========================
   APP LAYOUT
   =========================== */

.app-layout {
  display: flex;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
}

.not-owner {
  display: none !important;
}

/* ===========================
   MAIN CONTENT AREA
   =========================== */



.main-content {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
}

.view-section { display: none; }
.main-content[data-state="guest"] #guest-view-content { display: block; }
.main-content[data-state="no-project"] #empty-state { display: none; }
.main-content[data-state="active"] #kanban-container { display: grid; }

/* Desktop: Adjust when sidebar is visible */
@media (min-width: 768px) {
  .main-content {
    transition: margin-left 0.3s ease;
    width: calc(100vw - 290px);
  }

  .main-content.sidebar-collapsed {
    margin-left: 0;
    width: 100vw;
  }
}

/* Mobile: Sidebar is always an overlay */
@media (max-width: 767px) {
  .main-content {
    margin-left: 0 !important;
    width: 100vw;
  }
}

/* ===========================
   BOARD HEADER
   =========================== */

.board-header {
  background-color: var(--bg-color);
  border-bottom: 1px solid #30363d;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.board-header h1 {
  color: #f0f6fc;
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.02em;
}

.header-left-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

#active-project-name {
  display: flex;
  align-items: center;
  gap: 12px;
}

.project-header-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: #f0f6fc;
}

.project-header-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.project-header-icon:empty {
  display: none;
}

/* ===========================
   BOARD CONTAINER
   =========================== */

.board-container {
  flex-grow: 1;
  display: flex;
  flex-direction: row;
  background-color: var(--bg-color);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  padding-bottom: env(safe-area-inset-bottom);
}


#kanban-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0; /* Critical for flex child scrolling */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* Ensure the injected board fills the container */
.kanban-board {
    display: flex;
    flex: 1;
    flex-grow: 1;
    padding: 1rem;
    overflow-x: auto; /* Horizontal scroll for columns */
    align-items: flex-start;
    height: 100%;
    align-items: stretch;
}
/* ===========================
   EMPTY STATE
   =========================== */

.board-empty-state {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  min-height: 400px;
  text-align: center;
  color: #64748b;
  padding: 2rem;
}

.main-content.no-project .board-empty-state {
  display: flex;
}

.board-empty-state svg {
  margin-bottom: 16px;
  opacity: 0.5;
}

.hidden-element {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    position: absolute; /* Keeps it from taking up 'active' space */
}

.visible-element {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    position: relative;
}

/* ===========================
   KANBAN BOARD
   =========================== */

.kanban-board {
  display: flex;
  flex-grow: 1;
  overflow-x: auto;
  gap: 10px;
  padding: 5px;
  align-items: stretch;
}

.main-content.no-project .kanban-board {
  display: none;
}

#kanban-board {
  display: none;
}

body.authenticated #kanban-board {
  display: flex;
}

/* ===========================
   COLUMNS
   =========================== */

.column {
  flex: 0 0 auto;
  width: 85vw;
  background-color: #f9fafb;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  max-height: 100%;
  border: 1px solid #f3f4f6;
  scroll-snap-align: center;
}

@media (min-width: 768px) {
  .column {
    flex: 1;
    width: auto;
    min-width: 280px;
  }
}

.column.drag-over {
  background-color: color-mix(in srgb, var(--status-color), white 80%) !important;
  outline: 3px dashed var(--status-color);
  outline-offset: -2px;
}

/* Status Colors */
.column[data-status="icebox"] {
  --status-color: #3b3b3b;
  border-top: 5px solid var(--status-color);
  background-color: #e6e6e6;
}

.column[data-status="todo"] {
  --status-color: #0052cc;
  border-top: 5px solid var(--status-color);
  background-color: #e0ebff;
}

.column[data-status="doing"] {
  --status-color: #f97316;
  border-top: 5px solid var(--status-color);
  background-color: #fff2e6;
}

.column[data-status="done"] {
  --status-color: #22c55e;
  border-top: 5px solid var(--status-color);
  background-color: #dcfce7;
}

.column-header {
  padding: 16px;
  background-color: #ffffff;
  border-radius: 12px 12px 0 0;
  border-bottom: 1px solid #e5e7eb;
}

.column-header h3,
.column h3 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: #4b5563;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.column h3 {
  text-align: left;
  padding-left: 10px;
  margin-bottom: 15px;
}

.task-list {
  flex-grow: 1;
  overflow-y: auto;
  padding: 12px;
  min-height: 150px;
}

/* ===========================
   TASK CARDS
   =========================== */

.task-card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 15px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  position: relative;
  border: 1px solid transparent;
  cursor: grab;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
}

.task-card:hover {
  box-shadow: var(--shadow-hover);
}

.task-card:active {
  cursor: grabbing;
}

.task-card.dragging {
  opacity: 0.4;
  transform: scale(0.95);
}

.task-card.read-only {
  cursor: not-allowed;
  filter: grayscale(0.5);
  pointer-events: none;
}



.author-name {
  font-weight: 600;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===========================
   CARD METADATA & SUMMARY
   =========================== */

.card-metadata {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  width: 100%;
}

.time-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  white-space: nowrap;
}

.edited-meta {
  color: var(--text-sub);
  text-align: right;
}

.card-summary {
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-sub);
  margin-top: 10px;
}

.subtask-progress {
  background: #ebecf0;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
}
.created-ago, .last-changed-ago {
    min-width: 10px;
}
.subtask-progress:not(:empty) {
  background: #ebecf0;
  padding: 2px 6px;
  color: #444;
  display: inline-block;
}

.subtask-progress:empty {
  display: none;
}

.subtask-progress[data-complete="true"] {
  background: #27ae60 !important;
  color: white !important;
}

/* ===========================
   TAGS
   =========================== */



/* ===========================
   GHOST CARD / QUICK ADD
   =========================== */

#ghost-card-container {
  background: rgba(255, 255, 255, 0.03);
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 16px;
  margin: 10px 0;
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
}

.project-active.is-observer #ghost-card-container {
  display: none !important;
}

.ghost-card-trigger {
  width: 100%;
  background: transparent;
  border: none;
  padding: 8px 12px;
  border-radius: var(--border-radius);
  cursor: pointer;
  text-align: left;
  color: var(--text-sub);
  font-size: 0.9rem;
}

.ghost-card-trigger:hover {
  background-color: rgba(9, 30, 66, 0.08);
  color: var(--text-main);
}

#ghost-input-group {
  padding: 0 !important;
  margin-top: 5px;
  animation: slideDown 0.2s ease-out;
}

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

#ghost-task-title {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-sub);
  padding: 4px 0;
  margin-bottom: 8px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.2);
  transition: all 0.2s ease;
}

#ghost-task-title:focus {
  border-bottom: 1px solid rgba(255, 255, 255, 0.8);
}

#ghost-task-title::placeholder {
  color: rgba(80, 80, 80, 0.25);
  font-weight: 400;
}

.kanban-board.is-observer #show-ghost-input {
  display: none !important;
}

.kanban-board.is-observer .task-card {
  cursor: default;
}


.subtask-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 3px;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.subtask-check {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all 0.2s;
}

.subtask-check:checked {
  background-color: var(--bg-color);
  border-color: var(--text-sub);
}

.subtask-check:checked::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 4px;
  height: 9px;
  border: solid #475569;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.subtask-text {
  flex-grow: 1;
  font-size: 0.95rem;
  color: var(--text-main);
  transition: color 0.2s;
}

.subtask-check:checked + .subtask-text {
  color: var(--text-sub);
  text-decoration: line-through;
  opacity: 0.6;
}

.delete-subtask-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px;
  border-radius: 4px;
  opacity: 0;
  transition: all 0.2s;
  line-height: 1;
}

.subtask-row:hover .delete-subtask-btn {
  opacity: 1;
}

.delete-subtask-btn:hover {
  color: #ef4444;
  background: #fee2e2;
}

/* ===========================
   INPUTS
   =========================== */

.new-subtask-input,
.new-tag-input {
  width: 100%;
  background-color: #ffffff !important;
  border: 1px solid #dfe1e6 !important;
  border-radius: 10px !important;
  padding: 10px 14px !important;
  font-size: 0.9rem;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.input-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: #8b949e;
  margin-bottom: 8px;
}

#new-project-name {
  width: 100%;
  background-color: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 10px 12px;
  color: #c9d1d9;
  font-size: 0.95rem;
  line-height: 1.5;
  outline: none;
  transition: all 0.2s ease-in-out;
  box-sizing: border-box;
}

#new-project-name:hover {
  border-color: #8b949e;
}

#new-project-name:focus {
  border-color: #58a6ff;
  background-color: #0d1117;
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

#new-project-name::placeholder {
  color: #484f58;
  font-style: italic;
}

/* ===========================
   BUTTONS
   =========================== */

.primary-btn {
  background-color: #238636;
  color: #ffffff;
  font-weight: 600;
  padding: 10px 20px;
  border: 1px solid rgba(240, 246, 252, 0.1);
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.primary-btn:hover {
  background-color: #2ea043;
}

.primary-btn:active {
  background-color: #238636;
  transform: translateY(1px);
}

#save-project-btn {
  background-color: transparent;
  color: #58a6ff;
  border: 1px solid #30363d;
  padding: 10px 24px;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

#save-project-btn:hover {
  background-color: rgba(88, 166, 255, 0.1);
  border-color: #58a6ff;
  color: #79c0ff;
}

#save-project-btn:active {
  background-color: rgba(88, 166, 255, 0.2);
  transform: scale(0.98);
}

.danger-btn {
  color: var(--text-danger) !important;
}

.danger-btn:hover {
  color: #f00 !important;
  background: #3d2b2b !important;
}

.danger-btn .icon {
  font-size: 1.1rem;
}

.text-btn.danger {
  background: none;
  border: none;
  color: #f85149;
  font-size: 0.8rem;
  cursor: pointer;
  margin-top: 8px;
  padding: 0;
}

.text-btn.danger:hover {
  text-decoration: underline;
}

.close-modal-text {
  background: none;
  border: none;
  color: #666;
  font-size: 0.85rem;
  margin-top: 20px;
  width: 100%;
  cursor: pointer;
  text-align: left;
}

.close-modal-text:hover {
  color: #888;
}

/* ===========================
   MEMBERS & ROLES
   =========================== */

.member-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #30363d;
}

.members-list-wrapper h4 {
  font-size: 0.8rem;
  color: #888;
  text-transform: uppercase;
  margin: 20px 0 10px 0;
}

.member-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.role-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
}

.role-badge.editor {
  background: #238636;
  color: white;
}

.role-badge.observer {
  background: #1f6feb;
  color: white;
}

.role-badge.owner {
  background: rgba(255, 215, 0, 0.1);
  color: #ffd700;
}

.toggle-container {
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

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

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

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

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.role-label-text {
  font-size: 1.2rem;
  min-width: 25px;
  text-align: center;
}

.remove-member-btn {
  background: none;
  border: none;
  color: #555;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: color 0.2s ease, transform 0.2s ease;
}

.remove-member-btn:hover {
  color: #ff4d4d;
  transform: scale(1.2);
}

/* ===========================
   FILE UPLOAD
   =========================== */

.label-with-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.label-with-link a {
  font-size: 0.75rem;
  color: #58a6ff;
  text-decoration: none;
  transition: opacity 0.2s;
}

.label-with-link a:hover {
  text-decoration: underline;
}

.svg-upload-zone {
  border: 2px dashed #30363d;
  border-radius: 12px;
  background: #0d1117;
  transition: all 0.2s ease;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.svg-upload-zone:hover {
  border-color: #58a6ff;
  background: #161b22;
}

.svg-upload-zone.drag-over {
  border-color: #238636;
  background: rgba(35, 134, 54, 0.05);
}

.upload-placeholder {
  text-align: center;
  color: #8b949e;
}

.upload-icon {
  margin-bottom: 10px;
  color: #484f58;
}

.upload-placeholder p span {
  color: #58a6ff;
  font-weight: 500;
}

.upload-placeholder small {
  display: block;
  margin-top: 4px;
  font-size: 0.7rem;
}

.svg-preview {
  padding: 20px;
}

.svg-preview svg {
  width: 64px;
  height: 64px;
  fill: #f0f6fc;
}

/* ===========================
   STATUS BAR
   =========================== */

#status-bar {
  margin-top: auto;
  padding: 15px 20px;
  border-top: 1px solid #334155;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #94a3b8;
}

/* ===========================
   AUTHENTICATION
   =========================== */

.auth-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-color);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.auth-overlay.hidden {
  display: none !important;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}

.login-card {
  color: var(--text-main);
  background: var(--bg-color);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.google-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  margin: 20px auto 0;
  transition: background 0.2s;
  
}

.google-btn:hover {
  background: #f9f9f9;
}

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

.tldr-box {
  background-color: #fff9c4;
  border-left: 5px solid #fbc02d;
  padding: 15px 20px;
  margin: 20px 0;
  border-radius: 4px;
  font-size: 0.95rem;
  color: #444;
  line-height: 1.5;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tldr-box strong {
  color: #000;
}

.legal-links a {
  color: #8a8d91;
  text-decoration: none;
  margin: 0 4px;
}

.legal-links a:hover {
  color: #fff;
}

.separator {
  color: #444;
}

.app-info {
  margin-top: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #444;
}

/* Target the guest section container */
#guest-view-content {
    color: var(--text-main);
}

/* Ensure all headings inside the guest view are also white */
#guest-view-content h1, 
#guest-view-content h2, 
#guest-view-content h3 {
    color: var(--text-main);
}

/* If you want that specific 'highlight' span to stay visible, 
   you might want to give it a bright color like gold or neon green */
#guest-view-content .highlight {
    color: #ff7300; /* Gold */
    font-weight: bold;
}

/* Sidebar Guest View Text (White) */
#sidebar-guest-view, 
#guest-view-content {
    color: white !important;
}

/* Ensure the Member View is a flex column when active */
#sidebar-member-view:not([hidden]) {
    display: flex;
    flex-direction: column;
    flex: 1;
}


/* Layout-safe visibility toggles */
.view-hidden {
    visibility: hidden !important;
    pointer-events: none !important;
}

.view-visible {
    visibility: visible !important;
    pointer-events: auto !important;
}




/* Layout-safe state toggles */
.state-hidden {
    visibility: hidden !important;
    pointer-events: none !important;
    /* We use absolute only on the hidden state to let the visible one 
       claim the space naturally without breaking the flex container */
    position: absolute; 
    width: 100%;
}

.state-visible {
    visibility: visible !important;
    pointer-events: auto !important;
    position: relative;
}

/* Force Guest text to be white */


/* Ensure the sidebar itself is the master flex container */
.sidebar {
    display: flex;
    flex-direction: column;
    height: 100vh;
}


.google-btn-dark {
    display: inline-flex;
    align-items: center;
    background-color: #131314;
    color: #e3e3e3;
    border: 1px solid #8e918f;
    border-radius: 4px; /* Official spec is 4px or 'fully rounded' */
    padding: 0 12px;
    height: 40px;
    font-family: 'Roboto', arial, sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.google-btn-dark:hover {
    background-color: #202124;
}

.google-btn-dark:active {
    background-color: #303134;
}

.google-btn-dark img {
    width: 18px;
    height: 18px;
    margin-right: 10px;
}

.guest-content{
  padding: 0 5rem;
}