:root {
  --bg-main: #ffffff;
  --bg-sidebar: #fbfbfa;
  --text-primary: #37352f;
  --text-secondary: rgba(55, 53, 47, 0.65);
  --border-subtle: rgba(55, 53, 47, 0.09);
  --primary-color: #2383e2; /* Notion Blue */
  --pill-purple: #f5e0e9; /* Light purple */
  --pill-yellow: #fdecc8; /* Light yellow */
  --pill-blue: #d3e5ef; /* Light blue */
  --pill-green: #dbeddb; /* Light green */
  --pill-text-purple: #901e52;
  --pill-text-yellow: #8a6411;
  --pill-text-blue: #18445a;
  --pill-text-green: #1c4d19;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
}

body {
  height: 100vh;
  background: var(--bg-main);
  color: var(--text-primary);
  overflow: hidden;
  display: flex;
}

/* Notion Sidebar */
.sidebar {
  width: 240px;
  height: 100%;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  gap: 20px;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 4px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-title {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-group {
    margin-top: 12px;
}

.sidebar-group-title {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 4px 8px;
    text-transform: capitalize;
}

.nav-links {
  list-style: none;
}

.nav-item {
  margin-bottom: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  border-radius: 4px;
  transition: background 0.1s;
}

.nav-link:hover { background: rgba(55, 53, 47, 0.08); }
.nav-link.active { background: rgba(55, 53, 47, 0.06); }
.nav-link i { color: var(--text-secondary); width: 16px; height: 16px; }

/* Notion Buttons */
.new-project-btn {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 4px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.1s;
}

.new-project-btn:hover { background: rgba(55, 53, 47, 0.08); }

.timer-running {
    color: #ef4444 !important;
    border-color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.05) !important;
    font-weight: 600 !important;
}

.spin {
    animation: spin 1s linear infinite;
}

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

/* Main Content Area */
.main {
  flex: 1;
  padding: 48px 96px;
  overflow-y: auto;
  position: relative;
}

.view-container {
  max-width: 1200px;
  margin: 0 auto;
}

.page-header {
    margin-bottom: 32px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.header-user-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.1s;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--primary-color);
    transition: all 0.2s;
}

.user-avatar:hover {
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transform: translateY(-1px);
}

.logout-link {
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
    text-decoration: none;
}

.logout-link:hover {
    background: #fef2f2;
    color: #ef4444 !important;
}

.page-title {
    font-size: 40px;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.page-tabs {
    display: flex;
    gap: 16px;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 8px;
    margin-bottom: 32px;
}

.tab {
    font-size: 14px;
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tab:hover { background: rgba(55, 53, 47, 0.08); }
.tab.active { color: var(--text-primary); border-bottom: 2px solid var(--text-primary); border-radius: 0; }

/* Notion Card Style */
.card {
  background: white;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Notion Kanban Board */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  min-height: 70vh;
}

.kanban-column {
  flex: 1;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  background: rgba(55, 53, 47, 0.02); /* Very subtle background for clarity */
  border-radius: 8px;
  padding: 12px;
  border: 1px solid transparent;
}

.kanban-cards {
    display: flex;
    flex-direction: column;
    gap: 16px; /* Increased space between tasks */
    flex: 1;
}

.kanban-column:hover { border-color: var(--border-subtle); }

.column-label {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    width: fit-content;
}

.column-status-todo { background: var(--pill-purple); color: var(--pill-text-purple); }
.column-status-progress { background: var(--pill-yellow); color: var(--pill-text-yellow); }
.column-status-review { background: var(--pill-blue); color: var(--pill-text-blue); }
.column-status-done { background: var(--pill-green); color: var(--pill-text-green); }

.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  margin-bottom: 8px;
}

.kanban-card {
  background: white;
  border-radius: 4px;
  padding: 8px 12px;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  cursor: pointer;
  transition: background 0.1s;
}

.kanban-card:hover { background: #fbfbfa; }

.card-title { font-size: 14px; font-weight: 400; color: var(--text-primary); line-height: 1.4; }

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 12px;
}

.subtask-progress {
  font-size: 11px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary-color);
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.meta-item { display: flex; align-items: center; gap: 4px; }

.subtask-item {
    border-radius: 4px;
    padding: 4px 8px;
    transition: background 0.1s;
}

.subtask-item:hover {
    background: rgba(55, 53, 47, 0.04);
}

.subtask-item input[type="text"] {
    font-size: 14px;
    color: var(--text-primary);
    cursor: text;
    padding: 2px 4px;
    border-radius: 4px;
}

.subtask-item input[type="text"]:focus {
    background: white;
    box-shadow: 0 0 0 1px var(--border-subtle);
}

/* Progress / Daily Summary */
.progress-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.progress-sidebar {
    position: sticky;
    top: 48px;
    height: fit-content;
}

.sidebar-progress-item {
    padding: 8px 0;
    transition: transform 0.2s ease;
}

.sidebar-progress-item:hover {
    transform: translateX(4px);
}

.project-internal-progress {
    border: 1px solid var(--border-subtle);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.02);
}

.project-summary-card {
  display: flex;
  flex-direction: column;
}

.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.summary-content {
  line-height: 1.6;
}

.summary-content ul {
  list-style: none;
  margin-left: 8px;
}

.summary-content li {
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.summary-edit-area {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 12px;
    display: none;
}

.edit-btn {
    padding: 4px 8px;
    font-size: 11px;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    cursor: pointer;
}

/* Gantt Chart */
.timeline-container {
  overflow-x: auto;
  padding: 0;
  border-radius: 12px;
  background: white;
  border: 1px solid var(--border-subtle);
  margin-top: 24px;
}

.gantt-header-major {
  display: flex;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
}

.gantt-header-minor {
  display: flex;
  background: #fff;
  border-bottom: 1px solid var(--border-subtle);
}

.header-tick {
  flex-shrink: 0;
  width: 140px; 
  padding: 16px 12px; 
  font-size: 11px; /* Reduced font size */
  font-weight: 500;
  border-right: 1px solid var(--border-subtle);
  text-align: center;
}

.gantt-grid {
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: fit-content;
  padding-bottom: 80px; /* Buffer between last item and edge */
}

.gantt-row {
  display: flex;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  min-height: 60px; /* Reduced height a bit */
  align-items: center;
}

.gantt-label { 
    width: 200px; 
    padding: 0 16px;
    font-weight: 500; 
    font-size: 12px; /* Reduced font size */
    border-right: 1px solid var(--border-subtle);
    flex-shrink: 0;
    color: var(--text-secondary);
}

.gantt-bar-area { 
    flex: 1; 
    position: relative; 
    height: 100%; 
    min-width: 1400px; /* 10 weeks @ 140px */
    background-image: linear-gradient(to right, var(--glass-border) 1px, transparent 1px);
    background-size: 140px 100%;
}

.gantt-bar {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: white;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

/* Modal Styling */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: white;
  width: 90%;
  max-width: 600px;
  border-radius: 8px;
  padding: 40px;
  box-shadow: 0 15px 30px rgba(0,0,0,0.1), 0 5px 15px rgba(0,0,0,0.05);
  max-height: 85vh;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
}

.modal-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block; font-size: 11px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px;
    text-transform: uppercase; letter-spacing: 0.5px;
}

.input-group input, .input-group select, .input-group textarea, #project-selector {
    width: 100%; 
    padding: 8px 10px; 
    background: white;
    border: 1px solid var(--border-subtle);
    border-radius: 4px; 
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    transition: background 0.1s;
}

.input-group input:focus, .input-group select:focus, .input-group textarea:focus {
    background: rgba(55, 53, 47, 0.03);
}

#project-selector {
    max-width: 250px;
    text-overflow: ellipsis;
}

/* Notion-style Buttons & Icons */
.add-task-inline, .close-btn {
    background: transparent;
    border: none;
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s;
    color: var(--text-secondary);
}

.add-task-inline:hover, .close-btn:hover {
    background: rgba(55, 53, 47, 0.08);
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    transform: translateX(-100%);
    width: 80%;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .main {
    padding: 20px;
  }
}
