/* Plan History Button (header) */
.plan-history-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border-color, #333);
  border-radius: 6px;
  color: var(--text-primary, #e0e0e0);
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s, border-color 0.15s;
}
.plan-history-btn:hover {
  background: var(--bg-hover, rgba(255,255,255,0.06));
  border-color: var(--accent-color, #DD5100);
}
.plan-history-btn svg {
  flex-shrink: 0;
}

/* Plan History Drawer */
.plan-history-drawer {
  position: fixed;
  right: 0;
  top: 0;
  width: 360px;
  height: 100vh;
  background: var(--bg-secondary, #1a1a1a);
  border-left: 1px solid var(--border-color, #333);
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform 0.25s ease;
}
.plan-history-drawer.hidden {
  display: none;
}

.drawer-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color, #333);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.drawer-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary, #e0e0e0);
}
.drawer-header .close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary, #999);
  line-height: 1;
  padding: 4px;
}
.drawer-header .close-btn:hover {
  color: var(--text-primary, #e0e0e0);
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
}

.plan-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.plan-item {
  padding: 0.75rem 1rem;
  background: var(--bg-primary, #121212);
  border: 1px solid var(--border-color, #333);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.plan-item:hover {
  background: var(--bg-hover, rgba(255,255,255,0.04));
  border-color: var(--accent-color, #DD5100);
}

.plan-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.plan-item-name {
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-primary, #e0e0e0);
}
.plan-delete-btn {
  background: transparent;
  border: none;
  color: var(--text-muted, #666);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.plan-delete-btn:hover {
  color: #fc8181;
  background: rgba(252, 129, 129, 0.1);
}
.plan-item-meta {
  font-size: 0.85rem;
  color: var(--text-secondary, #999);
}
.plan-item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}
.plan-item-count {
  font-size: 0.78rem;
  color: var(--text-muted, #666);
}
.plan-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.plan-item-action {
  font-size: 0.78rem;
  color: var(--accent-color, #DD5100);
  font-weight: 500;
}
.plan-export-btn {
  padding: 2px 8px;
  background: transparent;
  border: 1px solid var(--border-color, #333);
  border-radius: 4px;
  color: var(--text-secondary, #999);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: border-color 0.15s, color 0.15s;
}
.plan-export-btn:hover {
  border-color: var(--accent-color, #DD5100);
  color: var(--accent-color, #DD5100);
}

.plan-empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted, #666);
}
.plan-empty-state.hidden {
  display: none;
}

/* Plan Detail Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
}
.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--bg-primary, #121212);
  border: 1px solid var(--border-color, #333);
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 650px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}
.modal-content h3 {
  margin: 0 0 1rem;
  color: var(--text-primary, #e0e0e0);
}
.modal-content .close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary, #999);
  line-height: 1;
}
.modal-content .close-btn:hover {
  color: var(--text-primary, #e0e0e0);
}

/* Deliverables table inside modal */
.deliverables-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.deliverables-table th,
.deliverables-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border-color, #333);
}
.deliverables-table th {
  color: var(--text-secondary, #999);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.deliverables-table td {
  color: var(--text-primary, #e0e0e0);
}

/* Plan action buttons */
.btn-plan-action {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid #c53030;
  border-radius: 6px;
  color: #fc8181;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s, color 0.15s;
}
.btn-plan-action:hover {
  background: #c53030;
  color: #fff;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .plan-history-drawer {
    width: 100%;
    max-width: 100vw;
  }
  .plan-history-btn span {
    display: none;
  }
  .plan-history-btn {
    padding: 6px;
  }
}
