:root {
  --bg-color: #0b0d17;
  --panel-bg: rgba(255, 255, 255, 0.03);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-main: #f8f9fa;
  --text-muted: #a0aab2;
  --primary: var(--brand-blue, #6366f1);
  --primary-hover: #0284c7;
  --accent-1: #38bdf8;
  --accent-2: #8b5cf6;
  --accent-3: #10b981;
  --accent-4: #f59e0b;
  --accent-5: #3b82f6;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --border-radius: 12px;
  --input-bg: rgba(0, 0, 0, 0.3);
}

.quickgantt-page {
  background-color: var(--bg-color);
  background-image: 
    radial-gradient(at 0% 0%, rgba(6, 158, 252, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(56, 189, 248, 0.15) 0px, transparent 50%);
  background-attachment: fixed;
  height: 100vh;
  overflow: hidden;
  line-height: 1.5;
}

.quickgantt-page .gradient-text {
  background: var(--blue-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline; /* Fix baseline alignment */
}

.quickgantt-page .secondary-gradient-text {
  background: var(--green-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline; /* Fix baseline alignment */
}

.app-container {
  max-width: 100%;
  margin: 0 auto;
  margin-top: 75px; 
  padding: 0 40px;
  height: calc(100vh - 75px);
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
  width: 100%;
}
.header-titles {
  text-align: left;
}
.header-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

header h1 {
  font-size: 3rem;
  font-weight: 800;
  background: linear-gradient(to right, var(--primary), var(--accent-1));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

header p {
  color: var(--text-muted);
  font-size: 1.1rem;
}

main {
  display: flex;
  gap: 2rem;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

.controls-panel {
  flex: 0 0 320px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  padding-right: 10px;
}

.controls-panel::-webkit-scrollbar {
  width: 6px;
}
.controls-panel::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 4px;
  transition: background 0.3s ease;
}
.controls-panel:hover::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
}

.chart-panel {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding-right: 10px;
}

.chart-panel::-webkit-scrollbar {
  width: 6px;
}
.chart-panel::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
}

.card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.card h2 {
  font-size: 1.25rem;
  margin-bottom: 1.25rem;
  font-weight: 600;
  color: var(--text-main);
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 0.75rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group.row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.input-field {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.5rem;
}

.input-field.flex-2 {
  flex: 2;
}

label {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

input {
  background: var(--input-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  padding: 0.75rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  color-scheme: dark;
}

input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.form-actions {
  margin-top: 1.5rem;
}

.btn-primary {
  width: auto;
  min-width: 140px;
  background: linear-gradient(135deg, var(--primary), var(--accent-2));
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: rgba(255,255,255,0.1);
  color: white;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.2);
}

.btn-danger {
  background: var(--danger);
  color: white;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.item-li-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.btn-icon {
  background: rgba(255,255,255,0.1);
  color: var(--text-main);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.btn-icon:hover {
  background: rgba(255,255,255,0.2);
}

.btn-edit {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-edit:hover {
  background: var(--primary-hover);
}

.items-list-card {
  flex-shrink: 0;
}

.items-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.item-li {
  background: var(--input-bg);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}

.item-li-details h4 {
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.item-li-details p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.chart-header h3 {
  font-size: 1.5rem;
  font-weight: 600;
}

.gantt-wrapper {
  overflow-x: auto;
  padding-bottom: 1rem;
}

.gantt-chart {
  min-width: 700px;
  position: relative;
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  border: 1px solid var(--panel-border);
}

/* Chart internals layout */
.gantt-x-axis {
  display: flex;
  border-bottom: 1px solid var(--panel-border);
  height: 40px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(11, 13, 23, 0.9);
  backdrop-filter: blur(4px);
}

.gantt-y-labels-col {
  width: 150px;
  flex-shrink: 0;
  border-right: 1px solid var(--panel-border);
  position: sticky;
  left: 0;
  z-index: 20;
  background: inherit;
}

.gantt-ticks {
  flex: 1;
  display: flex;
  position: relative;
}

.gantt-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px dashed rgba(255, 255, 255, 0.2);
  padding-left: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  transform: none;
}

.gantt-row {
  display: flex;
  height: 60px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  position: relative;
}

.gantt-group-header {
  height: 36px;
  background: rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary);
  border-bottom: 1px solid var(--panel-border);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.gantt-group-header span {
  position: sticky;
  left: 0;
  padding-left: 1rem;
  z-index: 15;
}

.gantt-row:last-child {
  border-bottom: none;
}

.gantt-y-label {
  width: 150px;
  flex-shrink: 0;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 500;
  border-right: 1px solid var(--panel-border);
  background: var(--bg-color);
  color: var(--text-main);
  position: sticky;
  left: 0;
  z-index: 20;
}

.gantt-bar-area {
  flex: 1;
  position: relative;
}

.gantt-bar {
  position: absolute;
  top: 10px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 0.75rem;
  transition: transform 0.2s ease, opacity 0.3s ease;
  cursor: grab;
  user-select: none;
}

.gantt-bar:active {
  cursor: grabbing;
}

.gantt-bar:hover {
  z-index: 5;
}

.gantt-bar-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 10px;
  cursor: ew-resize;
  z-index: 10;
}

.gantt-bar-handle.left {
  left: 0;
}

.gantt-bar-handle.right {
  right: 0;
}

.empty-state {
  padding: 3rem;
  text-align: center;
  color: var(--text-muted);
}

.gantt-cursor-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background-color: var(--primary);
  pointer-events: none;
  z-index: 50;
  display: none;
}

.gantt-cursor-label {
  position: absolute;
  top: 45px;
  left: 8px;
  background-color: var(--primary);
  color: white;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.gantt-weekend-shade {
  position: absolute;
  top: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.03);
  pointer-events: none;
}

/* Utilities */
.color-0 { background: linear-gradient(90deg, var(--primary), var(--accent-2)); }
.color-1 { background: linear-gradient(90deg, var(--accent-1), var(--accent-4)); }
.color-2 { background: linear-gradient(90deg, var(--accent-3), var(--accent-5)); }
.color-3 { background: linear-gradient(90deg, var(--accent-4), var(--danger)); }
.color-4 { background: linear-gradient(90deg, var(--accent-5), var(--primary)); }

@media (max-width: 1024px) {
  main {
    flex-direction: column;
  }
  .controls-panel {
    flex: none;
    width: 100%;
  }
}

/* --- Themes --- */
/* Light Theme */
.theme-light {
  --bg-color: #f3f4f6;
  --panel-bg: rgba(255, 255, 255, 0.7);
  --panel-border: rgba(0, 0, 0, 0.1);
  --border-color: rgba(0, 0, 0, 0.1);
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --text-primary: #1f2937;
  --input-bg: #ffffff;
  color: var(--text-primary);
}

.theme-light header.scrolled {
  background: rgba(255, 255, 255, 0.8);
}

.theme-light .logo-main {
  color: var(--text-primary);
}

.theme-light .logo-subtitle {
  color: var(--text-muted);
}

.theme-light.quickgantt-page {
  background-image: none;
}

.theme-light .btn-secondary {
  color: #1f2937;
  border-color: rgba(0, 0, 0, 0.2);
  background: rgba(0, 0, 0, 0.05);
}

.theme-light #theme-select {
  background-image: url('data:image/svg+xml;utf8,<svg fill="%231f2937" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>') !important;
}

.theme-light .gantt-chart {
  background: rgba(255, 255, 255, 0.8);
}

.theme-light .gantt-x-axis {
  background: rgba(243, 244, 246, 0.9);
}

.theme-light .gantt-tick {
  border-left-color: rgba(0, 0, 0, 0.1);
}

.theme-light .gantt-group-header {
  background: rgba(0, 0, 0, 0.03);
}

.theme-light .gantt-row {
  border-bottom-color: rgba(0, 0, 0, 0.05);
}

.theme-light .gantt-y-label {
  background: var(--bg-color);
}

.theme-light .gantt-weekend-shade {
  background-color: rgba(0, 0, 0, 0.03);
}

.theme-light .item-li {
  background: rgba(255, 255, 255, 0.8);
}

.theme-light .btn-icon {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-main);
}
.theme-light .btn-icon:hover {
  background: rgba(0, 0, 0, 0.1);
}

/* Remove shadows in light theme */
.theme-light .card,
.theme-light .gantt-bar,
.theme-light .gantt-cursor-label,
.theme-light .btn-primary:hover {
  box-shadow: none;
}

/* Dark Theme */
.theme-dark {
  --bg-color: #0f1115;
  --panel-bg: #1a1d24;
  --panel-border: rgba(255, 255, 255, 0.05);
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --input-bg: rgba(0, 0, 0, 0.2);
}

.theme-dark.quickgantt-page {
  background-image: none;
}

.theme-dark .gantt-chart {
  background: rgba(0, 0, 0, 0.2);
}

.theme-dark .gantt-x-axis {
  background: rgba(15, 17, 21, 0.9);
}

/* Basic Themes (Light/Dark) Bar Styling */
.theme-light .gantt-bar,
.theme-dark .gantt-bar {
  border-radius: 2px;
}

.theme-light .color-0, .theme-dark .color-0 { background: var(--primary); }
.theme-light .color-1, .theme-dark .color-1 { background: var(--accent-1); }
.theme-light .color-2, .theme-dark .color-2 { background: var(--accent-3); }
.theme-light .color-3, .theme-dark .color-3 { background: var(--accent-4); }
.theme-light .color-4, .theme-dark .color-4 { background: var(--accent-5); }
